开发者

Audio Streaming on Android

开发者 https://www.devze.com 2023-02-21 16:13 出处:网络
I\'m attempting to stream from a URL using Android\'s built in MediaPlayer class.However, I also need to send a special header along with the UR开发者_如何转开发L.Is this possible without having to re

I'm attempting to stream from a URL using Android's built in MediaPlayer class. However, I also need to send a special header along with the UR开发者_如何转开发L. Is this possible without having to rewrite the whole steaming process?

If it's not possible to send a header, I would need to stream the file manually. However, it appears that the MediaPlayer class locks the file you are writing to when it begins reading the file. This means you cant just simply continue writing to the file while reading from it. I've seen the 'double buffer' method however that results in choppy playback. Any suggestions?


I asked a question recently about alternatives to the double buffer method you mentioned:
is-there-a-better-way-to-save-streamed-files-with-mediaplayer


I guess you could act as a proxy in a thread, handle your header and forward the rest to the media player? Or if you control the server pass the extra data in a different request...

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号