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.
精彩评论