upgrade exoplayer

This commit is contained in:
Gabriel Rivero 2022-08-26 10:32:22 -04:00
parent 10f7e9701a
commit f558d05923
3 changed files with 17 additions and 14 deletions

View File

@ -33,7 +33,7 @@ repositories {
dependencies {
implementation "com.facebook.react:react-native:${safeExtGet('reactNativeVersion', '+')}"
implementation('com.google.android.exoplayer:exoplayer:2.17.1') {
implementation('com.google.android.exoplayer:exoplayer:2.18.1') {
exclude group: 'com.android.support'
}
@ -42,7 +42,7 @@ dependencies {
implementation "androidx.core:core:1.1.0"
implementation "androidx.media:media:1.1.0"
implementation('com.google.android.exoplayer:extension-okhttp:2.17.1') {
implementation('com.google.android.exoplayer:extension-okhttp:2.18.1') {
exclude group: 'com.squareup.okhttp3', module: 'okhttp'
}
implementation 'com.squareup.okhttp3:okhttp:${OKHTTP_VERSION}'

View File

@ -18,7 +18,7 @@ import com.google.android.exoplayer2.PlaybackParameters;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.TracksInfo;
import com.google.android.exoplayer2.Tracks;
import com.google.android.exoplayer2.text.Cue;
import com.google.android.exoplayer2.trackselection.TrackSelectionArray;
import com.google.android.exoplayer2.ui.SubtitleView;
@ -230,7 +230,7 @@ public final class ExoPlayerView extends FrameLayout {
@Override
public void onCues(List<Cue> cues) {
subtitleLayout.onCues(cues);
subtitleLayout.setCues(cues);
}
// ExoPlayer.VideoListener implementation
@ -284,7 +284,7 @@ public final class ExoPlayerView extends FrameLayout {
}
@Override
public void onTracksInfoChanged(TracksInfo tracksInfo) {
public void onTracksChanged(Tracks tracks) {
updateForCurrentTrackSelections();
}

View File

@ -42,8 +42,9 @@ import com.google.android.exoplayer2.PlaybackParameters;
import com.google.android.exoplayer2.Player;
import com.google.android.exoplayer2.ExoPlayer;
import com.google.android.exoplayer2.Timeline;
import com.google.android.exoplayer2.TracksInfo;
import com.google.android.exoplayer2.Tracks;
import com.google.android.exoplayer2.drm.DefaultDrmSessionManager;
import com.google.android.exoplayer2.drm.DefaultDrmSessionManagerProvider;
import com.google.android.exoplayer2.drm.DrmSessionEventListener;
import com.google.android.exoplayer2.drm.DrmSessionManager;
import com.google.android.exoplayer2.drm.DrmSessionManagerProvider;
@ -72,8 +73,8 @@ import com.google.android.exoplayer2.trackselection.AdaptiveTrackSelection;
import com.google.android.exoplayer2.trackselection.DefaultTrackSelector;
import com.google.android.exoplayer2.trackselection.MappingTrackSelector;
import com.google.android.exoplayer2.trackselection.ExoTrackSelection;
import com.google.android.exoplayer2.trackselection.TrackSelectionOverrides;
import com.google.android.exoplayer2.trackselection.TrackSelectionOverrides.TrackSelectionOverride;
import com.google.android.exoplayer2.trackselection.TrackSelectionParameters;
import com.google.android.exoplayer2.trackselection.TrackSelectionOverride;
import com.google.android.exoplayer2.ui.PlayerControlView;
import com.google.android.exoplayer2.upstream.BandwidthMeter;
import com.google.android.exoplayer2.upstream.DataSource;
@ -548,7 +549,7 @@ class ReactExoplayerView extends FrameLayout implements
private void initializePlayerCore(ReactExoplayerView self) {
ExoTrackSelection.Factory videoTrackSelectionFactory = new AdaptiveTrackSelection.Factory();
self.trackSelector = new DefaultTrackSelector(videoTrackSelectionFactory);
self.trackSelector = new DefaultTrackSelector(getContext(), videoTrackSelectionFactory);
self.trackSelector.setParameters(trackSelector.buildUponParameters()
.setMaxVideoBitrate(maxBitRate == 0 ? Integer.MAX_VALUE : maxBitRate));
@ -698,6 +699,8 @@ class ReactExoplayerView extends FrameLayout implements
return drmSessionManager;
}
};
} else {
drmProvider = new DefaultDrmSessionManagerProvider();
}
switch (type) {
case C.TYPE_SS:
@ -1253,7 +1256,7 @@ class ReactExoplayerView extends FrameLayout implements
}
@Override
public void onTracksInfoChanged(TracksInfo tracksInfo) {
public void onTracksChanged(Tracks tracks) {
// Do nothing.
}
@ -1567,7 +1570,7 @@ class ReactExoplayerView extends FrameLayout implements
DefaultTrackSelector.Parameters selectionParameters = trackSelector.getParameters()
.buildUpon()
.setRendererDisabled(rendererIndex, false)
.setTrackSelectionOverrides(new TrackSelectionOverrides.Builder().addOverride(selectionOverride).build())
.addOverride(selectionOverride)
.build();
trackSelector.setParameters(selectionParameters);
}