AS3 - 如何停止的视频和分离的NetStream [英] as3 - How to stop video and detach NetStream

查看:143
本文介绍了AS3 - 如何停止的视频和分离的NetStream的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从服务器视频流,后来我想通过侧添加另一只是一面。多数民众赞成好,我做到了。当我想删除的视频现在,我的问题就来了。我设法从显示器中删除它,但我能听出来的视频在后台还在打。那么,如何能阻止流式视频? 这是我的code用于设置视频:

  NS =新的NetStream(连接);
ns.addEventListener(AsyncErrorEvent.ASYNC_ERROR,asyncErrorHandler);
ns.play(项目[1]的ToString()+。FLV的);
视频=新视频();
Video.attachNetStream和(NS);
video.width = 160;
video.height = 120;
videoWrapper =新UIComponent();
videoWrapper.addChild(视频)
videos.addElement(videoWrapper);
 

在这里是为了去除

  videos.removeElement(myVideos [P] [1]); // myVideos [P] [1]是videoWrapper的参考
 

解决方案

您可以通过调用 Video.attachNetStream和(空)断开连接,或<关闭流code> ns.close();

这也可能是最好做这两个。

I have video streaming from the server, and later on I want to add another one just side by side. thats all good, I done that. Now my problem comes when i want to remove video. I manage to remove it from display, but I can hear that video is still playing in the background. So how do I can stop streaming that video? Here is my code for setting up the video:

ns = new NetStream(connection);
ns.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);
ns.play(item[1].toString() + ".flv");
video = new Video();
video.attachNetStream( ns );
video.width = 160;
video.height = 120;
videoWrapper = new UIComponent();
videoWrapper.addChild( video );
videos.addElement( videoWrapper );

and here is for removing

videos.removeElement(myVideos[p][1]); // myVideos[p][1] is a reference of videoWrapper

解决方案

You can drop the connection by calling video.attachNetStream(null), or close the stream with ns.close();

It's probably best to do both.

这篇关于AS3 - 如何停止的视频和分离的NetStream的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆