Reputation: 3156
I want jwPlayer to play for 2 sec. and then pause. I implement this functionality but its not working properly in IE 8. Its working in mozilla and chrome. Anybody suggest me how to do it?
JAVASCRIPT :
$(document).ready(function(){
jwplayer('GridMessageBoard__ctl3_dvMsgContent').setup({
var jwplayerid = this.id;
flashplayer: 'mediaplayer/player1.swf',
file: 'http://www.youtube.com/watch?v=HOfdboHvshg',
width: 400,
height: 300
});
jwplayer(jwplayerid).play();
window.setTimeout("PausejwPlayer('"+jwplayerid+"')",1500);
});
function PausejwPlayer(objID)
{
jwplayer(objID).pause(true);
}
HTML :
<div id="GridMessageBoard__ctl3_dvMsgContent" style="display:block;width:100%;"></div>
Thanks
Upvotes: 1
Views: 1551
Reputation: 97
i had the same problem
primary: "flash",
this code will solve your problem :)
Upvotes: 0
Reputation: 28707
Add this to your configuration in setup
(and remove your other call to window.setTimeout
):
events: {
onPlay: function(){
window.setTimeout(function(){
jplayer(jwplayerid).pause(true);
}, 2000);
}
}
I'm guessing that it was just a timing issue, where the player was maybe still starting or buffering, etc. - and the whole 1.5 or 2 seconds had elapsed before the player ever had a chance to play. This will start the timer only after the player has actually started playing.
(I don't see where jplayerid
is being set, so I'm assuming you have it defined elsewhere and above your current code.)
If this doesn't work by itself, add some debugging lines within the function call I provided here to see if the setTimeout is getting called, and that you still have a valid player ID, etc.
Upvotes: 1