Check command availability before getting tracks in PlayerView

#minor-release

PiperOrigin-RevId: 554451569
This commit is contained in:
kimvde 2023-08-07 13:01:49 +00:00 committed by Tianyi Feng
parent ff3902debb
commit 117b18f54c

View File

@ -589,7 +589,8 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
} 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();
}