Skip to content

Commit

Permalink
Exo: Update video size when switching video source
Browse files Browse the repository at this point in the history
  • Loading branch information
jenshandersson committed Jun 16, 2020
1 parent 419b66b commit a2440ac
Showing 1 changed file with 1 addition and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import android.content.Context;
import androidx.core.content.ContextCompat;
import android.util.AttributeSet;
import android.util.Log;
import android.view.Gravity;
import android.view.SurfaceView;
import android.view.TextureView;
Expand All @@ -20,7 +19,6 @@
import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.source.TrackGroupArray;
import com.google.android.exoplayer2.text.Cue;
import com.google.android.exoplayer2.text.TextRenderer;
import com.google.android.exoplayer2.text.TextOutput;
import com.google.android.exoplayer2.trackselection.TrackSelectionArray;
import com.google.android.exoplayer2.ui.SubtitleView;
Expand Down Expand Up @@ -214,13 +212,8 @@ public void onCues(List<Cue> cues) {

@Override
public void onVideoSizeChanged(int width, int height, int unappliedRotationDegrees, float pixelWidthHeightRatio) {
boolean isInitialRatio = layout.getAspectRatio() == 0;
layout.setAspectRatio(height == 0 ? 1 : (width * pixelWidthHeightRatio) / height);

// React native workaround for measuring and layout on initial load.
if (isInitialRatio) {
post(measureAndLayout);
}
post(measureAndLayout);
}

@Override
Expand Down

0 comments on commit a2440ac

Please sign in to comment.