mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Keep aspect ratio of PlayerView
when IDLE
When the video renderer is disabled, the video size is set to 0/0 and sent to listeners. The `PlayerView` potentially still has the last frame displayed when the player is stopped or an error occurs. This may have the effect that the frame is displayed distorted. Not changing the aspect ratio when the video size arrives when the player is IDLE avoids the problem. In the case when playback starts again and the renderes is enabled, another video size is sent to the listener. #minor-release PiperOrigin-RevId: 534860889
This commit is contained in:
parent
749c64c74f
commit
6469fffd8f
@ -1602,6 +1602,10 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
|
||||
|
||||
@Override
|
||||
public void onVideoSizeChanged(VideoSize videoSize) {
|
||||
if (videoSize.equals(VideoSize.UNKNOWN)
|
||||
&& (player == null || player.getPlaybackState() == Player.STATE_IDLE)) {
|
||||
return;
|
||||
}
|
||||
updateAspectRatio();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user