Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Android 的文档描述了如何MediaPlayer更改状态,如下图所示:
MediaPlayer
我想更新我的 GUI 以向用户提供播放反馈。界面中应该有一个标签,根据播放器的状态显示“正在播放”、“正在缓冲”或“已停止”。我该如何实施?我一直在寻找类似的东西OnStateChangedListener,但显然不存在。
OnStateChangedListener
对于缓冲,你可以听setOnBufferingUpdateListener。 对于调用 () 之后的“正在播放”和“停止” onPrepared,您可以监控 getCurrentPosition。
setOnBufferingUpdateListener
onPrepared