2011-08-23 75 views
2

有誰知道如何在播放列表的每個剪輯末尾添加延遲。 我是想這樣的事情:Flowplayer autoplaying播放列表與視頻之間的延遲

flowplayer("a.flowplayer", {src: "/flowplayer2/dist/swf/flowplayer-3.2.7.swf",wmode: 'transparent'}, { 
    clip: { 
     onFinish: function(clip) { 
      this.pause(); 
      var obj = this; 
      setTimeout(function(){ 
       obj.play() 
      },5*1000); 

     }, 
    }, 
    plugins: { 
     controls: { 
      autoHide: "always" 
     }, 
     ova: { 
      url: '/flowplayer2/dist/swf/d/ova.swf', 
      "autoPlay" : true, 
      "autoBuffering": true, 
      "shows": { 
       "streams": [ 
        { "file":"one.flv"}, 
        { "file":"two.flv"}, 
        { "file":"three.flv"} 
       ] 
      }, 
      "ads": { 
       "pauseOnClickThrough": true, 
       "displayCompanions": true, 
       "restoreCompanions": false, 
       "companions": [{ 
        "id":"lcBannerDiv", 
        "width":"300", 
        "height":"250", 
        "resourceType": "iframe" 
       }], 
       "notice": { show: false }, 
       "schedule": [{ 
        "position": "pre-roll", 
        "server": { 
         "type": "direct", 
         "tag": VAST_URL 
        } 
       }] 
      } 
     } 
    } 
}); 

,但它不工作,它只是在玩第一視頻後停止。

謝謝 梅德

回答

2

我從來沒有使用過OVA插件的Flowplayer,但在技術上你onFinish功能只是暫停播放器之後,它再次上場。然後它進入剪輯的最後,然後停下來,我想。

如果您的播放器得到了OVA插件播放列表(您可以通過調用$f().getPlaylist()檢查這個JavaScript控制檯,它返回剪輯的數組),然後再考慮改變你的onFinish功能是這樣的:

flowplayer("a.flowplayer", {src: "/flowplayer2/dist/swf/flowplayer-3.2.7.swf",wmode: 'transparent'}, { 
    clip: { 
     onFinish: function(clip) { 
      // First check where you are in your playlist 
      var currentClipIndex = this.getClip().index; 
      // Get length of playlist 
      var playlistLength = this.getPlaylist().length; 
      // save handle to player instance 
      var fp = this; 
      // check if there is a clip after the current (last clip has index "playlistLength -1") 
      if (currentClipIndex < playlistLength -1) { 
       setTimeout(function() { 
        // tell fp to play clip with next index 
        fp.play(currentClipIndex + 1); 
       // in five seconds 
       }, 5*1000) 
      } 
     }, 
    }, 
    {...} 
});