Search code examples
androidandroid-mediaplayerandroid-video-playerexoplayer

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;
    }
}

What is 'playWhenReady' in "onPlayerStateChanged(boolean playWhenReady, int playbackState)" method ? & When does player goes to 'Player.STATE_IDLE'? When does all four Stages mention in given code occurs ?


Solution

  • The following links answer your questions.