2010-09-18 76 views

回答

3

你想做什麼?什麼版本的JWPlayer?

用戶可以模擬一個「播放」做這個點擊JWPlayer 4: http://developer.longtailvideo.com/trac/wiki/Player4Api#Sendingevents

player.sendEvent("PLAY","true"); 

否則,如果你想要做的事當視頻播放需要監聽的事件。

var player = null; 
function playerReady(thePlayer) { 
player = document.getElementById(thePlayer.id); 
addListeners(); 
} 


function addListeners() { 
if (player) { 
    player.addModelListener("STATE", "stateListener"); 
} else { 
    setTimeout("addListeners()",100); 
} 
} 
function stateListener(obj) { //IDLE, BUFFERING, PLAYING, PAUSED, COMPLETED 
currentState = obj.newstate; 
previousState = obj.oldstate; 

var tmp = document.getElementById("stat"); 
if (tmp) { 
    tmp.innerHTML = "current state: " + currentState + 
    "<br>previous state: " + previousState; 
} 

if ((currentState == "COMPLETED")&&(previousState == "PLAYING")) { 
    document.location.href="http://www.longtailvideo.com/players/jw-flv-player/"; 
} 
} 
+0

感謝它幫了我很多。 – 2010-10-08 13:24:11