Does anyone know how to add delay at the end of each clip of playlist. I was trying something like this:
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
}
开发者_如何学JAVA }]
}
}
}
});
but it doesn't work, it just stops after playing first video.
Thank you, Dmitry
I never used OVA plugin for Flowplayer, but technically your onFinish function just pauses the player and after that it plays again. Then it goes to the end of the clip and stops, I think.
If your player got a playlist from OVA plugin (you can check this on JavaScript console via calling $f().getPlaylist()
, it returns an array of clips), then consider changing your onFinish function like this:
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)
}
},
},
{...}
});
精彩评论