给定图表 http://developer.android.com/reference/android/media/MediaPlayer.html#Valid_and_Invalid_States当 mediaplayer 对象正在播放然后停止播放时(因为 song finished ofc),它是进入停止状态还是仍然处于启动状态?非常感谢
最佳答案
引用您分享的链接:
When the playback reaches the end of stream, the playback completes.
If the looping mode was being set to
true
withsetLooping(boolean)
, the MediaPlayer object shall remain in the Started state.If the looping mode was set to
false
, the player engine calls a user supplied callback method,OnCompletion.onCompletion()
, if aOnCompletionListener
is registered beforehand viasetOnCompletionListener(OnCompletionListener)
. The invoke of the callback signals that the object is now in thePlaybackCompleted
state.While in the
PlaybackCompleted
state, callingstart()
can restart the playback from the beginning of the audio/video source.
于是进入PlaybackCompletedState,播放完成后进入stop状态。如果循环设置为真,它将保持启动状态。
关于android - 播放完歌曲后的 MediaPlayer 状态,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22216104/