2013-02-06 88 views
1

媒体播放事件和方法有谁知道,如果Flash Media Playback支持一些API,因为我需要通过javascript像处理的几种方法/事件:访问闪存通过JavaScript

  1. 播放
  2. 暂停
  3. 停止
  4. 流结束
  5. 流开始
  6. 流错误

我需要像它一样的所有东西Grab Player。但docs说,我们必须执行它。 谢谢!

P.S.基本FMP实现如下:

<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> 

回答

1

的Flash媒体播放具有支持相同的功能,频闪媒体播放,但存在频闪JavaScript API的一贯的探索,所以我不认为有任何的支持它在FMP中。

尽管如此,FMP带有与Strobe相同的插件架构,因此您应该能够像使用频闪一样使用OSMF并为其创建插件。我为Strobe创建了一个插件,目的是扩展Strobe的javascript api。您可能可以在FMP中找到类似的东西。这是我如何做的:

 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); 
    } 
} 

见:github

如果我可以,虽然我会下降FMP。 FMP的文档接近不存在,Strobe中对javascript的支持相当不错。如果您有兴趣,我已经记录了Strobe javascript api here