开发者

jw player show & start via jquery/javascript

i'm trying my damndest to get a video to .show() by doing just tha开发者_运维知识库t and start playing with the sendEvent('play') method to the player (originally loaded with a false autostart) but nothing seems to be working. from what i understand, it's pretty straightforward. can anyone shed some light? i really need this working, as this page is supposed to drop in a few hours. thanks in advance.

fyi, i am also using a state listener, but that's not doing the trick and it doesn't look like a state gets published when it's first loaded. i'm thinking i need to do a short delay and then sendEvent?


I think this is related to the fact that your Flash player isn't visible. You'll need to call $(player).show() and wait for the playerReady callback. This will look something like:

<embed id='player' name='player' src='player.swf' width='470' height='320' bgcolor='#000000' allowscriptaccess='always' allowfullscreen='true' flashvars='file=video.mp4' />

<script type="text/javascript">
$('#player').show();

function playerReady(obj) {
    var player = document.getElementById(obj['id']).play();
    player.setModelListener('STATE', stateCallback);
}

function stateCallback(evt){
    //TODO: Your code here
}
</script>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜