views:

89

answers:

1

hi all,

i'm trying my damndest to get a video to .show() by doing just that 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?

A: 

Hi user405324,

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>
zach at longtail