AS2:没有网络流视频,只有音频
所以我在加载网络流视频时遇到了 AS2 问题。
my_vid = _root.createEmptyMovieClip("my_vid", _root.getNextHighestDepth());
var video:Video = new Video();
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
video.attachVideo(ns);
my_vid.attachVideo(video);
and later
ns.play("http://localhost/video.mp4");
我实际上可以在后台收听音频,但由于某种原因我看不到任何图片。我尝试只播放没有影片剪辑的视频,反之亦然,只听音频。
我肯定做错了什么,但是什么?
So I'm having a problem with AS2 when loading a netstream video.
my_vid = _root.createEmptyMovieClip("my_vid", _root.getNextHighestDepth());
var video:Video = new Video();
var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
video.attachVideo(ns);
my_vid.attachVideo(video);
and later
ns.play("http://localhost/video.mp4");
I can actually listen to the audio in background but for some reason i can't see any picture. I tried with a video only without a movieclip, and the other way around and keep listening only to audio.
I'm definitely doing something wrong but what?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的问题是您从未将视频对象附加到舞台上。此行
my_vid.attachVideo(video);
不执行任何操作,因为 MovieClip 没有名为attachVideo
的方法。您需要在库中创建一个视频对象并将其添加到舞台上。为此,请在 IDE 中执行以下步骤:
New Video...
。视频(ActionScript 控制)
单选按钮,然后单击“确定”。myVideo
)。videoContainer
),然后按确定。现在,您的库中有一个可以使用代码附加的项目,该项目已经包含可以使用的视频对象。假设您使用与我上面相同的名称,您的代码应按如下方式修改。
Your problem is that you don't ever attach the video object to the stage. This line
my_vid.attachVideo(video);
does nothing, because MovieClip does not have a method calledattachVideo
.You need to create a video object in your library and add it to the stage. To do this, follow these steps in the IDE:
New Video...
from the dropdown.Video (ActionScript-controlled)
radio button and click OK.myVideo
).videoContainer
), then press OK.Now you have an item in your library that you can attach with code, that already contains a video object that is ready to work. Your code should be modified as follows, assuming you used the same names as I did above.