mirror of
https://github.com/samsonjs/media.git
synced 2026-04-02 10:45:51 +00: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
(cherry picked from commit 6469fffd8f)
This commit is contained in:
parent
a7501f4aaf
commit
5c498c3eca
1 changed files with 4 additions and 0 deletions
|
|
@ -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…
Reference in a new issue