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: google/ExoPlayer#10420
PiperOrigin-RevId: 460223064
  • Loading branch information
christosts authored and rohitjoins committed Jul 12, 2022
1 parent 05e728a commit 4eb34e4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
3 changes: 3 additions & 0 deletions RELEASENOTES.md
Expand Up @@ -32,6 +32,9 @@
* RTSP:
* Add RTP reader for H263
([#63](https://github.com/androidx/media/pull/63)).
* Leanback extension:
* Listen to `playWhenReady` changes in `LeanbackAdapter`
([10420](https://github.com/google/ExoPlayer/issues/10420)).

### 1.0.0-beta01 (2022-06-16)

Expand Down
Expand Up @@ -236,11 +236,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 @@ -285,5 +280,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 4eb34e4

Please sign in to comment.