AS3 StageVideo,如何确定何时结束?

时间:2015-04-15 16:56:45

标签: actionscript-3 events video

将此SimpleStageVideo包装用于AS3 AIR视频播放器。

http://www.bytearray.org/?p=2571

我需要确定视频何时结束,但不能看到触发的事件。

有人可以建议解决方法吗?

1 个答案:

答案 0 :(得分:1)

StageVideoVideo都使用NetStream(这是实际的视频内容)。这是您收听与内容相关的事件的地方。

因此,如果您目前正在使用链接的组件播放视频,那么您应该已经拥有NetStream个对象。

以下是一个例子:

var stream:NetStream = ...//your net stream object you should already have to play the video, assumption here is you already have it instantiated.

stream.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler,false,0,true);

function netStatusHandler(event:NetStatusEvent):void {
    switch (event.info.code) {
        case "NetStream.Play.StreamNotFound":
            //the video wasn't found, better tell the user something
            break;

        case "NetStream.Play.Start":
            //video started playing
            break;

        case "NetStream.Play.Stop":
            videoFinishedHandler(); //do something now that the video is finished playing
            break;
    }
} 

如果您想查看可以拦截的所有其他NetStream Status事件的列表,请参阅the documentation