flasheventsadobeosmf

Access Flash Media Playback events and methods via JavaScript


Does anyone know if Flash Media Playback support some API because I need to handle a few methods/events via javascript like:

  1. Play
  2. Pause
  3. Stop
  4. Streaming is ended
  5. Streaming is started
  6. Streaming error

I need the all things like it has Grab Player. But the docs says that we have to implement it. Thanks!!

P.S. Basic FMP implementation is the following:

  <object width="600" height="409"> <param name="movie" value="http://fpdownload.adobe.com/strobe/FlashMediaPlayback.swf"></param><param name="flashvars" value="src=http%3A%2F%2Fosmf.org%2Fvideos%2Fcathy2.flv&poster=http%3A%2F%2Fosmf.org%2Fimages%2Fposter_cathy_fmp.jpg"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://fpdownload.adobe.com/strobe/FlashMediaPlayback.swf" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="600" height="409" flashvars="src=http%3A%2F%2Fosmf.org%2Fvideos%2Fcathy2.flv&poster=http%3A%2F%2Fosmf.org%2Fimages%2Fposter_cathy_fmp.jpg"></embed></object>

Solution

  • Flash Media Playback has support the same features as Strobe Media Playback, but the javascript api that exists for Strobe has always been exploratory so I don't believe there is any support for it in FMP.

    Still, FMP comes with the same plugin architecture as Strobe, you should therefore be able to use OSMF and create plugins for it in the same way as with strobe. I created a plugin for Strobe a while back with the purpose og extending Strobe's javascript api. You may be able to to something similar in FMP. Here is how I did it:

            private function onFullScreen(event:FullScreenEvent):void
        {
            if (event.fullScreen) {
                call([this.javascriptCallback, ExternalInterface.objectID, "fullscreen", true]);
            } else {
                call([this.javascriptCallback, ExternalInterface.objectID, "fullscreen", false]);
            }
        }
    
        private static function call(args:Array, async:Boolean = true):void
        {       
            if (async)
            {
                var asyncTimer:Timer = new Timer(10, 1);    
                asyncTimer.addEventListener(TimerEvent.TIMER, 
                    function(event:Event):void
                    {
                        asyncTimer.removeEventListener(TimerEvent.TIMER, arguments.callee);
                        ExternalInterface.call.apply(ExternalInterface, args);
                    }
                );  
                asyncTimer.start();
                return;
            }
            ExternalInterface.call.apply(ExternalInterface, args);
        }
    }
    

    see: github

    I would drop FMP if I could though. The documentation for FMP is close to non-existent and the support for javascript in Strobe is quite good. I have documented the Strobe javascript api here if you are interested.