Android Exoplayer : "onPlayerStateChanged(boolean playWhenReady, int playbackState)" 方法中的 'playWhenReady' 是什么

Android Exoplayer : What is 'playWhenReady' in "onPlayerStateChanged(boolean playWhenReady, int playbackState)" method

@Override
public void onPlayerStateChanged(boolean playWhenReady, int playbackState) {
    switch (playbackState) {
        case Player.STATE_IDLE:  **//1.When this happens ?**

            if (playWhenReady==false) {  **//2.What "playWhenReady" indicate ?**

                **//3.When this condition occur ?**
            }
            else{
                **//4.When this condition occur ?**
            }
            break;
    }
}

onPlayerStateChanged(boolean playWhenReady, int playbackState)”方法中的“playWhenReady”是什么? & 玩家什么时候去'Player.STATE_IDLE'?给定代码中提及的所有四个阶段何时发生?

以下链接回答了您的问题。

根据文档

void onPlayerStateChanged(boolean playWhenReady,int playbackState)

当从 ExoPlayer.getPlayWhenReady() 或 ExoPlayer.getPlaybackState() 返回的值发生变化时调用。 playWhenReady - 准备好后是否继续播放。 playbackState - ExoPlayer 接口中定义的状态常量之一。

Checkout the link.

Checkout the docs

希望这能解决问题。