我想在我的网站上嵌入JW播放器。当我尝试播放视频时,我收到错误“视频未找到或访问被拒绝”

时间:2011-06-27 08:50:19

标签: html jwplayer

这是我的代码:

<!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>

'vid​​eo.flv'与html文件位于同一目录

1 个答案:

答案 0 :(得分:0)

尝试完整路径 例如:

  

var flashvars = {file:'http://yourwebsite.com/video.flv'};