使用一个 NetStream 对象同时传输两个 Video 对象
我试图将单个 NetStream 对象附加到两个单独的视频对象,而不是从服务器拉出冗余流。预期的行为是两个视频显示相同的内容。但是,我附加 NetStream 的最后一个视频似乎是唯一会显示内容的视频。
还有其他人遇到过这个吗?如果不需要,我宁愿不执行使用 BitmapData 克隆像素的不雅步骤。
谢谢
I'm trying to attach a single NetStream Object to two separate Video objects instead of pulling redundant streams from the server. The expected behavior would be for both Video's to display the same content. However, it seems that the last video I attach the NetStream to is the only Video that will display the content.
Has anyone else run into this? I'd rather not go to the inelegant steps of using BitmapData to clone pixels if I don't have to.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
从 Flash 10.1 开始,Adobe 终于添加了一些新功能,用于直接连接到 NetStream 对象的字节。新方法称为appendBytes,正如它所暗示的那样,它允许以编程方式向NetStream 对象添加字节。这主要用于 Adobe 对 HTTP 流的支持(最后)。 此处位于 bytearray.org,有更多信息和演示。
这意味着您可以使用 HTTP 流传输视频。您可以使用 HTTP 流传输视频,然后将来自单个 HTTP 流的字节提供给两个不同的 NetStream。因此,您从 HTTP 流中获取字节,然后对每个 NetStream 对象调用 ns.appendBytes(inputbytes)。您将拥有 2 个 NetStream 对象,但它会节省您尝试为每个对象提取冗余流的带宽。
然后您可能会遇到的是 如果您尝试滚动自己的视频分割器,则在视频片段之间跳转。 Adobe 在其视频服务器中支持 HTTP 流分割,但我无法找到一个很好的参考来展示如何自己进行此操作。
As of Flash 10.1 Adobe finally added some new functionality for connecting directly to the bytes for the NetStream object. The new method is called appendBytes, which as it suggests allows adding bytes programatically to the NetStream object. This is primarily used for Adobe's support of HTTP streaming (finally). There is some more info and demos for this here at bytearray.org.
What this means is that what you may be able to do is stream your video using HTTP streaming. You can get your video streamed using HTTP streaming, then feed your two different NetStreams with the bytes from the single HTTP stream. So you get your bytes from HTTP streaming, then you call ns.appendBytes(inputbytes) on each NetStream object. You'll have 2 NetStream objects, but it will save you the bandwidth of trying to pull redundant streams for each.
What you may then run into is that you have skipping between your video segments if you try to roll your own video splitter. Adobe supports the HTTP stream splitting in its video server, but I haven't been able to find a good reference that shows how do roll this myself.
嗯,对视频流进行两次解码是不是有点愚蠢?在 EnterFrame 处理程序中使用 BitmapData.draw() 来复制视频既简单又高效。
Ummm, isn't it kinda dumb to decode the video stream twice? Using BitmapData.draw() in an enterFrame handler to copy the video is simple and efficient.