2011-06-27 33 views
0

這裏是我的代碼:我想在我的網站中嵌入JW播放器。我得到的錯誤「找不到視頻或訪問被拒絕」當我嘗試播放視頻

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1- strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> 
    <head> 
    <title>SWFObject dynamic embed - step 1</title> 
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> 
    <script type="text/javascript" src="swfobject/swfobject.js"></script> 
    <script type="text/javascript" src="jwplayer/jwplayer.js"></script> 

    </head> 
    <body> 

    <div id="flashContent"> 
     <p>Alternative content</p> 
    </div> 

    <script type="text/javascript"> 
    var flashvars = { file:'/video.flv'}; 
    var params = { allowfullscreen:'true', allowscriptaccess:'always' }; 
    var attributes = { id:'player1', name:'player1' }; 

    swfobject.embedSWF('player1.swf','flashContent','480','270','9.0.115','false', flashvars, params, attributes, flashLoaded); 

function flashLoaded(e) { 
// e.ref is a reference to the Flash object. We'll pass it to jwplayer() so the API knows where the player is. 

// Add event listeners 
jwplayer(e.ref).onReady(function() { alert('Player is ready'); e.ref.play();e.ref.seek(10); }); 
jwplayer(e.ref).onPlay(function() { e.ref.play();}); 
jwplayer(e.ref).onStop(function() { e.ref.stop();}); 
jwplayer(e.ref).onVolume(function() { e.ref.seek(100);}); 
// Interact with the player 
} 

</script> 

</body> 
</html> 

「video.flv」是在同一目錄中的HTML文件

+0

如果格式爲.mov,則不是這種情況。它只發生在.flv格式。有沒有解決方法? 任何幫助將不勝感激 – Poojan

+0

嘗試從'file:'/ video.flv''刪除斜槓,因爲它通常用於絕對URL,這意味着視頻文件必須位於您網站的Web根目錄中,而不是一定在HTML文件所在的位置。 – NightHawk

回答

相關問題