直接从网络流(http)播放媒体(视频)
我想直接从网络流(http)播放媒体(视频),因此我必须以某种方式向 Android MediaPlayer 提供数据。
我有 FileOutputStream outstream = new FileOutputStream(outputfile);我通过 outstream.write(buffer, 0, count); 写入输出文件
是否有任何以流作为输入的API....???....请帮助...
I would like play media (video) from a network stream(http) directly, hence so I have to somehow feed Android MediaPlayer with the data.
I have FileOutputStream outstream = new FileOutputStream(outputfile); which I write into the outputfile by outstream.write(buffer, 0, count);
Is there any API which takes stream as input....???.... Please help...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Android 支持渐进式下载和 HTTP Live Streaming(仅在 3.0 中),并且这两者都通过 HTTP 工作。
您可以使用
VideoView
或Mediaplayer
来利用渐进式下载和播放视频:请参阅此讨论。另外,如果您的服务器提供符合 Apple 的 Http Live Streaming IETF 草案,您可以直接向
MediaPlayer
提供 URL 并使用SurfaceView
播放视频。注意:您必须将 URL 中的“http”替换为“httplive:”。Android supports Progressive download and HTTP Live Streaming(only in 3.0) and both of these work over HTTP.
You can use
VideoView
orMediaplayer
to leverage Progressive downloading and play your videos: see this discussion.Also, if your server, delivers segmented files(.ts) in conformance to Apple's Http Live Streaming IETF draft, you can directly supply the URL to
MediaPlayer
and play your video usingSurfaceView
. Note: that you will have to replace "http" with "httplive:" in your URL.