开发者

How to get gapless playback?in android mediaplayer

开发者 https://www.devze.com 2022-12-27 05:41 出处:网络
I am trying to play continuous stream using android mediaplayer.but am not able to avoid gap in playback while updating the datasource f开发者_如何学Pythonile of mediaplayer.Hw can i overcome this pro

I am trying to play continuous stream using android mediaplayer.but am not able to avoid gap in playback while updating the datasource f开发者_如何学Pythonile of mediaplayer.Hw can i overcome this problem? Thanks in advance


The only way to guarantee no gaps in playback is to download the whole file first and start playback when it's finished. Otherwise, if you lose connectivity before the file is finished downloading, pausing is unavoidable.

I'd download on a background thread using the runnable/handler mechanism to a temp location. The handler gets called when downloading is complete, and you load the file into the MediaPlayer instance in the handler.

0

精彩评论

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

关注公众号