Skip to content

Commit

Permalink
Listen to playWhenReady changes in LeanbackPlayerAdapter
Browse files Browse the repository at this point in the history
#minor-release

Issue: #10420
PiperOrigin-RevId: 460223064
(cherry picked from commit c43d9f5)
  • Loading branch information
christosts authored and rohitjoins committed Jul 11, 2022
1 parent 43eb3d0 commit 36a99cb
Showing 1 changed file with 8 additions and 5 deletions.
Expand Up @@ -234,11 +234,6 @@ public void surfaceDestroyed(SurfaceHolder surfaceHolder) {

// Player.Listener implementation.

@Override
public void onPlaybackStateChanged(@Player.State int playbackState) {
notifyStateChanged();
}

@Override
public void onPlayerError(PlaybackException error) {
Callback callback = getCallback();
Expand Down Expand Up @@ -283,5 +278,13 @@ public void onVideoSizeChanged(VideoSize videoSize) {
int scaledWidth = Math.round(videoSize.width * videoSize.pixelWidthHeightRatio);
getCallback().onVideoSizeChanged(LeanbackPlayerAdapter.this, scaledWidth, videoSize.height);
}

@Override
public void onEvents(Player player, Player.Events events) {
if (events.containsAny(
Player.EVENT_PLAY_WHEN_READY_CHANGED, Player.EVENT_PLAYBACK_STATE_CHANGED)) {
notifyStateChanged();
}
}
}
}

0 comments on commit 36a99cb

Please sign in to comment.