Skip to content

Commit

Permalink
fix(android): avoid blinking on video track change (#3782)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
freeboub authored May 17, 2024
1 parent 6455380 commit 7b1e129
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,12 @@ public void onCues(List<Cue> cues) {
@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) {
Expand Down

0 comments on commit 7b1e129

Please sign in to comment.