开发者

How do I know, when the player stops playing?

开发者 https://www.devze.com 2023-04-07 15:18 出处:网络
public function videoPlayer() { connection = new NetConnection(); connection.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
        public function videoPlayer()
        {
            connection = new NetConnection();
            connection.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
            conne开发者_C百科ction.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
            connection.connect(null);
        }


        private function connectStream():void
        {
            stream= new NetStream(connection);
            stream.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
            stream.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);
            stream.client = this;
            stream.bufferTime = 30;
            video = new Video(600,313);
            video.attachNetStream(stream);
            stream.play(vName); 
            addChild(video);
        }


    }
    private function netStatusHandler(event:NetStatusEvent):void
    {

        trace(event.info.code);

    }

If the video ended playing its not tracing "NetStream.Play.Stop" info code. Why?


You need to look at http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/NetStream.html#event:onPlayStatus

From Adobe:

Establishes a listener to respond when a NetStream object has completely played a stream. The associated event object provides information in addition to what's returned by the netStatus event. You can use this property to trigger actions in your code when a NetStream object has switched from one stream to another stream in a playlist (as indicated by the information object NetStream.Play.Switch) or when a NetStream object has played to the end (as indicated by the information object NetStream.Play.Complete).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号