2011-05-10 43 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" 
}); 
});