idle hamster
FLVPlayback Not Playing
1st June 2009 | 2 Comments
I ran across an interesting bug within the FLVPlayback component include with CS4 today. About half the time the component wouldn't play a video (I think its related to a combination of other classes imported in my FLA). I tried setting just about every property I could to no avail. I manage to track down the problem to the event model. The video progress event would say that the entire video was downloaded, but the video complete event woudn't fire. The workaround I came up with was to check if the video was downloaded in the progress event then fire the play command. Its seems to have fixed my problem for now. Hopefully you won't have to waste a few hours of troubleshooting like me.
Discussion
You are a f*cking legend!
I’m using Flash Player 10.1… is it just a bug in this beta version… or is it for all the versions?
Still seems to be a little intermittent… do you have any copies of the actual code yo wrote on this?
Thanks,
John
I know I wasn’t using the beta player at that time. If I remember which project I was working on I’ll grab the code. But in reality all you need to do is add an event listener to the component and have it listen for VideoProgressEvent.PROGRESS. Then you just need to check to see if the bytesLoaded is equal to the bytesTotal.
I’m just coding this from memory so their might be a typo.
myPlaybackComponent.addEventListener(VideoProgressEvent.PROGRESS, vidListener);
function vidListener(e:VideoProgressEvent):void {
if(e.bytesLoaded >= e.bytesTotal) {
myPlaybackComponent.play();
}
}