Skip to content

Commit

Permalink
Check command availability before getting tracks in PlayerView
Browse files Browse the repository at this point in the history
#minor-release

PiperOrigin-RevId: 554451569
(cherry picked from commit 2063db1)
  • Loading branch information
kim-vde authored and tianyif committed Aug 7, 2023
1 parent 5ccbeec commit 212a912
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,8 @@ public void setPlayer(@Nullable Player player) {
} else if (surfaceView instanceof SurfaceView) {
player.setVideoSurfaceView((SurfaceView) surfaceView);
}
if (player.getCurrentTracks().isTypeSupported(C.TRACK_TYPE_VIDEO)) {
if (!player.isCommandAvailable(COMMAND_GET_TRACKS)
|| player.getCurrentTracks().isTypeSupported(C.TRACK_TYPE_VIDEO)) {
// If the player already is or was playing a video, onVideoSizeChanged isn't called.
updateAspectRatio();
}
Expand Down

0 comments on commit 212a912

Please sign in to comment.