0

我已经为我的移动 flex 应用程序构建了一个 OSMF 播放器信息,但我找不到一种方法来判断视频何时播放完毕。我能以某种方式告诉视频何时完成吗?
提前致谢!

        import mx.core.UIComponent;

        import org.osmf.events.TimeEvent;

        import spark.components.Button;
        import spark.components.Group;


        public var playerInstance:StrobeMediaPlayback;
        public var grp:Group = new Group();
        protected function init(event:Event):void
        {

            _stage = systemManager.stage;
            _stage.align = StageAlign.TOP_LEFT;
            _parameters  =
                {
                    src:"assets/Mini film 2b with filter on.mp4"
                    , controlBarMode:"docked"
                    , controlBarAutoHide: true
                    , autoPlay: true
                    , playButtonOverlay:true
                    , showVideoInfoOverlayOnStartUp: true
                };

            var playerInstance:StrobeMediaPlayback = new StrobeMediaPlayback();
            playerInstance.initialize(_parameters, _stage, systemManager.loaderInfo, null);
            playerInstance = playerInstance;
            //playerInstance.addEventListener(, remove);
            var ui:UIComponent = new UIComponent();
            ui.addChild(playerInstance as DisplayObject);

            grp.percentWidth = 100;
            grp.percentHeight = 100;
            addElement(grp);
            grp.addElement(ui);
            actionBarVisible = false

        }

        private var urlLoader:URLLoader;
        private var urlRequest:URLRequest;
        private var loader:Loader;
        private var _stage:Stage;
        private var _parameters:Object;
        /* static */
        private static const ALLOW_LOAD_BYTES_CODE_EXECUTION:String = "allowLoadBytesCodeExecution";


        public function emptyCache():void
        {
            //playerInstance.player.pause();

            grp.removeAllElements();
            this.destructionPolicy = "auto";
        }
4

2 回答 2

2

你可以试试这个:

player.addEventListener(TimeEvent.COMPLETE, onComplete);
于 2012-05-15T08:07:22.943 回答
0
function onComplete() {
  console.log("Completed");
}

player.addEventListener("complete", onComplete);

API 文档 http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/org/osmf/events/TimeEvent.html

于 2013-05-29T08:52:57.907 回答