fix(android): avoid blinking on video track change (#3782)

* perf: ensure we do not provide callback to native if no callback provided from app

* chore: rework bufferConfig to make it more generic and reduce ReactExoplayerView code size

* chore: improve issue template

* fix(android): avoid video view flickering at playback startup

* fix(android): avoid ghost resizing when video track change
This commit is contained in:
Olivier Bouillet 2024-05-17 14:47:03 +02:00 committed by GitHub
parent 6455380f9e
commit 7b1e1293f6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -279,7 +279,12 @@ public final class ExoPlayerView extends FrameLayout implements AdViewProvider {
@Override
public void onVideoSizeChanged(VideoSize videoSize) {
boolean isInitialRatio = layout.getAspectRatio() == 0;
layout.setAspectRatio(videoSize.height == 0 ? 1 : (videoSize.width * videoSize.pixelWidthHeightRatio) / videoSize.height);
if (videoSize.height == 0 || videoSize.width == 0) {
// When changing video track we receive an ghost state with height / width = 0
// No need to resize the view in that case
return;
}
layout.setAspectRatio((videoSize.width * videoSize.pixelWidthHeightRatio) / videoSize.height);
// React native workaround for measuring and layout on initial load.
if (isInitialRatio) {