gpt4 book ai didi

android - 播放完歌曲后的 MediaPlayer 状态

转载 作者:行者123 更新时间:2023-11-29 01:44:42 25 4
gpt4 key购买 nike

给定图表 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 with setLooping(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 a OnCompletionListener is registered beforehand via setOnCompletionListener(OnCompletionListener). The invoke of the callback signals that the object is now in the PlaybackCompleted state.

While in the PlaybackCompleted state, calling start() can restart the playback from the beginning of the audio/video source.

于是进入PlaybackCompletedState,播放完成后进入stop状态。如果循环设置为真,它将保持启动状态。

关于android - 播放完歌曲后的 MediaPlayer 状态,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22216104/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com