从字节流播放视频在Android中字节、视频、Android

2023-09-05 06:51:50 作者:王的羁绊;

有没有什么办法可以从Android的一个字节流播放视频? 我使用的是特定的通信中间件,所以我不能只是通过HTTP / RTSP链接到MediaPlayer对象。

Is there any way to play a video from a bytes stream in Android? I'm using an specific communications middleware so I can't just pass the http/rtsp link to the MediaPlayer object.

我在想,如果我可以总结我流与本地HTTP / RTSP链接,这样我可以发挥,而不是等到文件下载到播放流。

I was wondering if I can wrap my stream with a local http/rtsp link so I can play the stream instead of waiting until the file is downloaded to play it.

我的中间件工作在TCP所以我还以为我可以总结我的RTSP数据报一个TCP数据包,跨preT它们的客户端上不知何故,去除TCP报头后。

My middleware works over TCP so I've also thought that I can wrap my rtsp datagrams with a tcp datagram and interpret them on the client somehow, after removing the TCP headers.

我真的很惊讶,我不能只传递一个字节流的MediaPlayer的。 先谢谢了。

I'm really surprised that I can't just pass a bytes stream to the MediaPlayer. Thanks in advance.

推荐答案

自定义数据流在Android中并不像我想的那么简单。我已经成功地做​​到这一点,但只有非常具体的视频。 MPEG4的视频是较差交错似乎是流化。 我已经得到的最远的流媒体视频:

Custom streaming in Android isn't as easy as I thought. I've managed to do it but only with very specific videos. MPEG4 Videos that are poorly interleaved seem to be streamable. The farest I've gotten is streaming this video:

http://www.pocketjourney.com/downloads/pj/video/ famous.3gp

由于CIPI回答我,大多数格式不能只是装在一个字节的缓冲区,并把它传递给MediaPlayer的。他们需要一些头,尾,等我不知道哪种格式包含在上述文件,但我想这是MPEG4。

As Cipi answered me, most formats cannot just be packed in a bytes buffer and pass it to MediaPlayer. They need some headers, tails, etc. I'm not sure which format is contained within the aforementioned file, but I guess it's MPEG4.