ExternalInterface w/External FLV Player

350 Views Asked by At

I am curious if anyone knows of a way I can set my .SWF external FLV player to call a JavaScript function once the flv is ready/buffered for playback? Everything I have tried thus far has not worked...Any help would be greatly appreciated!

1

There are 1 best solutions below

4
On BEST ANSWER

If you're using the FLVPlayback class , you need to listen to the fl.video.VideoEvent.READY

Edit// Make sure to set the following in your embed code

param name="allowScriptAccess" value="always"

Edit//

you're probably using the FLVPlayback component in Flash CS , this component should have an instance name, so try to add this code at the same level , replacing "flvInstanceName" with the instance name of your FLV component. if your FLVPlayback component is on the main timeline, just add a Layer, in the first frame create a blank keyframe and add this code.

Try to run the swf , when the video is ready to play, you should have a trace statement. If you do , then you just have to set up your JS function

import flash.external.ExternalInterface;

flvInstanceName.addEventListener(VideoEvent.READY , videoReadyListener);

private function videoReadyListener(event:VideoEvent):void
{
  ExternalInterface.call("nameOfJSFunction");
  trace( event );
  removeEventListener(VideoEvent.READY , videoReadyListener );
}