I was using Actionscript 3.0 API for YouTube and I noticed that the documentation makes no reference to dispatch an event when the video comes at the end.
Deepening the thing, I realized that the event onStateChange can have the following values:
- -1 ( unstarted )
- 0 ( ended )
- 1 ( playing)
- 2 ( paused )
- 3 ( buffering )
- 5 ( video cued )
So at this point just to catch the event and if the onStateChange value is 0 (zero) then the video came at the end.
Example:
loader.content.addEventListener("onStateChange", onPlayerStateChange);
private function onPlayerStateChange(evt:Event):void
{
var state:Number=(Object(evt).data);
if(state==0)
{
trace("THE END");
}
}
No comments:
Post a Comment