在Flash、AS3中,我使用NetConnection连接到RTMP服务器,然后使用NetStream播放视频+音频流。
我将流 (attachNetStream) 附加到添加到舞台的 flash.media.Video 实例(仔细检查它是否在舞台上)并播放它,但我得到的只是正在播放的流的声音 - 没有视频显示。
请注意,即使我看不到视频,当我收听流的 onMetaData 时,我可以获得有关视频的大量信息,例如宽度、高度、FPS(播放过程中的变化,就像显示视频一样)、解码数量帧。
有人知道我怎样才能使视频也正常工作吗?
In Flash, AS3, I am using NetConnection to connect to a RTMP server, then I use NetStream to play a video+audio stream.
I attach the stream (attachNetStream) to a flash.media.Video instance that is added to stage (double checked that it is ON the stage) and play it, but all I get is the sound of the stream that's being played - no video is displayed.
Note that even though I cannot see the video, when I listen to the onMetaData of the stream I can get plenty of information about the video such as width, height, FPS (changes during playback as if a video is shown), number of decoded frames.
Does anybody have an idea how can I make the video work too?
发布评论
评论(2)
谢谢你们!但我找到了答案:
显然Flash的(CS3)内置
Video
类不支持H.264
流。我尝试在 Flex 3.5 中编译完全相同的代码,一切正常!CS4 也有可能支持
H.264
流。我没有尝试。JWPlayer 很棒,我没有尝试 Pyro。
干杯。
Thank you guys! but I found out the answer:
Apparently Flash's (CS3) built-in
Video
class does not supportH.264
streams. I tried to compile the exact same code in Flex 3.5 and everything worked!There is a possibility that CS4 also supports
H.264
streams. I did not try.JWPlayer is great, I did not try Pyro.
Cheers.
我建议使用一些包装器,例如 火焰兵玩家。它基本上是一个视频 API,我已经多次将它用于 RTMP 视频,它的工作方式就像一个魅力(我总是发现 Adobe 的视频组件有很多错误,特别是在显示来自 RTMP 服务器的视频时)。尝试一下!
Instead of using "raw" NetConnection and NetStream and attach it to a flash.media.Video, I'd recommend using some wrapper such as Pyro Player. Its basically a video API and I've used it many times for RTMP video and it works like a charm (I've always found the Video component from Adobe very buggy, specially when displaying video from a RTMP server). Give it a try!