o(∩_∩)o. 原来如此,FLV或者流播放结束的事件不是STOP,而是Complete.

记得几年前,大家制作FLV播放器的时候都困扰一件事情,就是写的代码没有办法监听视频播放结束,其实那时候大家都是在监听NetStream.Play.Stop,其实都错了.....我们要监听的是NetStream.Play.Complete.......这个才是.....给点关键代码

   ns.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
   ns.client = new CustomClient();

class CustomClient {
    public function onMetaData(info:Object):void {
        trace("metadata: duration=" + info.duration + " width=" + info.width + " height=" + info.height + " framerate=" + info.framerate);
    }
 public function onCuePoint(info:Object):void {
        trace("cuepoint: time=" + info.time + " name=" + info.name + " type=" + info.type);
    }

    public function onPlayStatus(info:Object):void {
   trace("这次真的播放结束拉")
    }
}

PS:NetStream.Play.Complete这家伙在好象记得FLASH HELP 里面是没有的...

原文地址:https://www.cnblogs.com/appleseed/p/1391203.html