开发者

Android MediaPlayer's playing state [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
开发者_如何学编程

Want to improve this question? Update the question so it focuses on one problem only by editing this post.

Closed 4 years ago.

Improve this question

I'm creating an app that streams audio from the web. I'd like to be able to detect connection interruptions and stuff like that. So when the audio stops playing, I'd tell the user it stopped playing. Does anyone knows a good way to do that?

Thanks!


You are looking for MediaPlayer.setOnErrorListener() for troubles during playback and MediaPlayer.setOnCompletionListener() for receiving a callback when the sound is done playing.

Please note that the callbacks may not be on the UI thread so make sure to use runOnUiThread() when updating UI on the callbacks.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜