2011-05-10 33 views
0

我讨厌使用这些,因为我永远无法找到他们的教程。JPlayer与FLV的文件

我有一个jPlayer,我试图用来播放.flv视频文件。我一直在寻找一个教程如何使用jPlayer但一切我能找到要么完全是垃圾,或者没有显示什么那么,刚刚结束的产品(非常有帮助,我知道)的任何代码。

这里是如何使我的jPlayer

//Creates the JPlayer for that video 
$('#videoPlayerDiv').jPlayer({ 
    ready: function() { 
     $(this).jPlayer("setMedia", { 
      flv: videoLocation 
     }).jPlayer("play"); 
    }, 
    supplied: "flv", 
    swfPath: "jPlayer/js" 
}); 

videoLocation是每个视频文件的位置。我已经测试过这个位置,它是正确的。当我运行该页面时,我会看到视频框,但我无法播放它,或显示任何视频文件位置。

如果任何人都可以找到一个问题(或教程),这将帮助我很多。

+0

是什么videoLocation的内容?你能举个例子吗? – 2011-05-10 19:26:39

+0

它从服务器上传。我不能给予充分的位置,但它的东西沿着这些路线:'HTTP:// mytabs /标签/ our_tabs/our_solutions /视频/ myvideos.flv' – 2011-05-10 19:32:35

+1

你必须使用jPlayer这个?我从来没有使用jPlayer进行视频,我个人使用流式播放器。 – ngen 2011-05-10 19:58:35

回答

1

试试这个:

$('#videoPlayerDiv').jPlayer({ 
    ready: function() { 
     this.element.jPlayer("setFile","path/to/flv/video/file.flv"); 
    } 
}); 

编辑: OP决定改用jPlayer的的Flowplayer。

+0

这工作得更好一点。它看起来(我不完全确定)视频文件被加载到播放器中,但它仍然不会播放(我做了'this.element.jPlayer(“setFile”,“path/to/flv/video/file。 flv“)。play();'思想) – 2011-05-10 19:37:55

+0

你的播放功能看起来与此相似吗? '$( “#戏”)点击(函数(){ \t $( “#jquery_jplayer”)jPlayer( “玩”); \t showPauseBtn(); \t返回FALSE; });' – ngen 2011-05-10 19:42:32

+0

我没有玩过(我不知道你需要它),但我尝试过,但仍然无法玩。下面是它的外观:'function playVideo(videoLocation){//为该视频创建JPlayer $('#videoPlayerDiv')。jPlayer准备好函数function(){this.lement.jPlayer(“setFile” ,videoLocation).play(); } }); $( “#戏”)点击(函数(){$( “#jquery_jplayer”)jPlayer( “玩”); showPauseBtn();返回false;}); }' – 2011-05-10 19:47:47

0

这里是另一个答案为我工作:

<!DOCTYPE html> 

<link href="http://jplayer.org/latest/skin/pink.flag/jplayer.pink.flag.css" rel="stylesheet" type="text/css" /> 

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>  
    <script type="text/javascript" src="http://jplayer.org/2.1.0/js/jquery.jplayer.min.js"></script> 
    <script type="text/javascript"> 

     /*paste or reference your JS here*/ 

    </script> 

</head> 
<body> 
    <div id="jquery_jplayer_1" class="jp-jplayer"></div> 

    <div id="jp_container_1" class="jp-audio"> 
     <div class="jp-type-single"> 
      <div class="jp-gui jp-interface"> 
       <ul class="jp-controls"> 

        <!-- comment out any of the following <li>s to remove these buttons --> 

        <li><a href="javascript:;" class="jp-play" tabindex="1">play</a></li> 
        <li><a href="javascript:;" class="jp-pause" tabindex="1">pause</a></li> 
        <li><a href="javascript:;" class="jp-stop" tabindex="1">stop</a></li> 
        <li><a href="javascript:;" class="jp-mute" tabindex="1" title="mute">mute</a></li> 
        <li><a href="javascript:;" class="jp-unmute" tabindex="1" title="unmute">unmute</a></li> 
        <li><a href="javascript:;" class="jp-volume-max" tabindex="1" title="max volume">max volume</a></li> 
       </ul> 

       <!-- you can comment out any of the following <div>s too --> 

       <div class="jp-progress"> 
        <div class="jp-seek-bar"> 
         <div class="jp-play-bar"></div> 
        </div> 
       </div> 
       <div class="jp-volume-bar"> 
        <div class="jp-volume-bar-value"></div> 
       </div> 
       <div class="jp-current-time"></div> 
       <div class="jp-duration"></div>     
      </div> 
      <div class="jp-title"> 
       <ul> 
        <li>Cro Magnon Man</li> 
       </ul> 
      </div> 
      <div class="jp-no-solution"> 
       <span>Update Required</span> 
       To play the media you will need to either update your browser to a recent version or update your <a href="http://get.adobe.com/flashplayer/" target="_blank">Flash plugin</a>. 
      </div> 
     </div> 
    </div> 


</body> 



$(document).ready(function() { 

$("#jquery_jplayer_1").jPlayer({ 
    ready: function(event) { 
     $(this).jPlayer("setMedia", { 
      flv:"http://www.website.com/videos/training_videos/Buying_Online_vs_Buying_From_Talent_Advisor.flv" 
     }); 
    }, 
    swfPath: "http://www.jplayer.org/2.1.0/js", 
    supplied: "flv" 
}); 
});