我已经在我的移动灵活应用程序中构建了一个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";
}
答案 0 :(得分:2)
你可以试试这个:
player.addEventListener(TimeEvent.COMPLETE, onComplete);
答案 1 :(得分:0)
function onComplete() {
console.log("Completed");
}
player.addEventListener("complete", onComplete);
API doc http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/org/osmf/events/TimeEvent.html