当前位置: 动力学知识库 > 问答 > 编程问答 >

android - Monitoring the state of a MediaPlayer in the GUI

问题描述:

Android's documentation describes how MediaPlayer changes state as outlined in this diagram:

I'd like to update my GUI to provide the user with playback feedback. There should be a label in the interface that says "Playing", "Buffering" or "Stopped" depending on the state of the player. How can I implement this? I've been looking for something like an OnStateChangedListener, but apparently that doesn't exist.

网友答案:

For buffering you can listen setOnBufferingUpdateListener.
For "Playing" and "Stopped" after onPrepared() is called, you can monitor getCurrentPosition.

分享给朋友:
您可能感兴趣的文章:
随机阅读: