End of the flv Movie listener

1.4k Views Asked by At

I am looking forward to have a Event Listener, which gives me a possibility to start my actionscript after the FLV movie has finished its playing.

In AS2 I had the function VideoEvent.COMPLETE but that doesn't work in AS3.

I am using, Flash Action Player: 11.4

1

There are 1 best solutions below

1
On BEST ANSWER

Check if following statement is added,

 import fl.video.VideoEvent;

If still not working, then check Flash Version (must be above 10)

Yet no solution then try following,

check if it is "Event" not "VideoEvent",

yourFLVPlayer.addEventListener(Event.COMPLETE, onFLVPlayingCompleted);

 function onFLVPlayingCompleted(e:Event):void
 {
      trace("Finished playing FLV");
 }

I am just giving another tryout if event.complete is not working. Try the following code. Check for playheadTime.

 yourFLVPlayer.addEventListener(VideoEvent.STATE_CHANGE, flvPlayerStateChanged);     

 function flvPlayerStateChanged(e:VideoEvent):void
 {
      if (yourFLVPlayer.getVideoPlayer(0).state != "playing")
      {     
          trace("Stopped playing FLV"); 

          //You might check for playhead time
          trace(yourFLVPlayer.playheadTime);

          //if playheadtime is equal to total time of flv then you call it as end of FLV

      }
 }