2014-07-15 87 views
1

我正在使用最新的JW Player雲託管版本。jwplayer:使用seek(),onTime()和stop()播放部分視頻

我需要尋找視頻從某個位置開始,並使用seek(),onTime()stop()在某個位置停止。

jwplayer().onReady(function() { 
    jwplayer().seek(300).onTime(function(event) { 
     if(event.position>330) { 
      jwplayer().stop(); 
     } 
    }); 
}); 

視頻啓動和停止使用上述命令,但如果用戶點擊播放按鈕再次,從開始的,而不是在seek()指定的時間開始。

我有與此視頻相關的廣告。

任何幫助!

感謝

回答

4

你可以嘗試使用onBeforePlay()方法,其激發只是在玩,像以前一樣:

jwplayer('player').setup({ 
     ...... 
    }); 
jwplayer().onBeforePlay(function(){ 
    jwplayer().seek(300); 
}); 
+0

那是快...我錯過onBeforePlay(),感謝 我在做的檢查即使我們使用seek(),進度條也會從頭開始,並且會完成視頻的部分播放。 – Pradino

+0

不客氣:) :) –

+0

非常好,upvoted :) – emaxsaun