diff options
4 files changed, 18 insertions, 4 deletions
diff --git a/app/build.gradle b/app/build.gradle index 2dc84ee5..6500f7cf 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -85,7 +85,7 @@ dependencies { implementation 'com.google.android.material:material:1.12.0' /** ExoPlayer **/ - def media3_version = "1.3.1" + def media3_version = "1.4.0-alpha02" implementation "androidx.media3:media3-exoplayer:$media3_version" implementation "androidx.media3:media3-exoplayer-dash:$media3_version" implementation "androidx.media3:media3-exoplayer-hls:$media3_version" diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java index 49927c8f..7f3cd774 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java @@ -61,6 +61,7 @@ import androidx.media3.datasource.DataSource; import androidx.media3.datasource.DefaultHttpDataSource; import androidx.media3.datasource.cache.CacheDataSource; import androidx.media3.datasource.cache.SimpleCache; +import androidx.media3.exoplayer.DefaultRenderersFactory; import androidx.media3.exoplayer.ExoPlayer; import androidx.media3.exoplayer.hls.HlsMediaSource; import androidx.media3.exoplayer.source.ProgressiveMediaSource; @@ -404,7 +405,10 @@ public class ViewVideoActivity extends AppCompatActivity implements CustomFontRe trackSelector.buildUponParameters() .setMaxVideoSize(dataSavingModeDefaultResolution, dataSavingModeDefaultResolution)); } - player = new ExoPlayer.Builder(this).setTrackSelector(trackSelector).build(); + player = new ExoPlayer.Builder(this) + .setTrackSelector(trackSelector) + .setRenderersFactory(new DefaultRenderersFactory(this).setEnableDecoderFallback(true)) + .build(); if (zoomable) { PlayerControlView playerControlView = findViewById(R.id.player_control_view_view_video_activity); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurVideoFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurVideoFragment.java index 09f84337..eb6adac8 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurVideoFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurVideoFragment.java @@ -20,6 +20,7 @@ import android.widget.LinearLayout; import android.widget.Toast; import androidx.annotation.NonNull; +import androidx.annotation.OptIn; import androidx.core.content.ContextCompat; import androidx.core.content.res.ResourcesCompat; import androidx.fragment.app.Fragment; @@ -33,6 +34,7 @@ import androidx.media3.datasource.DataSource; import androidx.media3.datasource.DefaultHttpDataSource; import androidx.media3.datasource.cache.CacheDataSource; import androidx.media3.datasource.cache.SimpleCache; +import androidx.media3.exoplayer.DefaultRenderersFactory; import androidx.media3.exoplayer.ExoPlayer; import androidx.media3.exoplayer.source.ProgressiveMediaSource; import androidx.media3.exoplayer.trackselection.DefaultTrackSelector; @@ -87,6 +89,7 @@ public class ViewImgurVideoFragment extends Fragment { } + @OptIn(markerClass = UnstableApi.class) @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { @@ -143,7 +146,10 @@ public class ViewImgurVideoFragment extends Fragment { }); TrackSelector trackSelector = new DefaultTrackSelector(activity); - player = new ExoPlayer.Builder(activity).setTrackSelector(trackSelector).build(); + player = new ExoPlayer.Builder(activity) + .setTrackSelector(trackSelector) + .setRenderersFactory(new DefaultRenderersFactory(activity).setEnableDecoderFallback(true)) + .build(); binding.getRoot().setPlayer(player); dataSourceFactory = new CacheDataSource.Factory().setCache(mSimpleCache) .setUpstreamDataSourceFactory(new DefaultHttpDataSource.Factory().setAllowCrossProtocolRedirects(true).setUserAgent(APIUtils.USER_AGENT)); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryVideoFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryVideoFragment.java index 8482cc49..8a64999e 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryVideoFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryVideoFragment.java @@ -34,6 +34,7 @@ import androidx.media3.datasource.DataSource; import androidx.media3.datasource.DefaultHttpDataSource; import androidx.media3.datasource.cache.CacheDataSource; import androidx.media3.datasource.cache.SimpleCache; +import androidx.media3.exoplayer.DefaultRenderersFactory; import androidx.media3.exoplayer.ExoPlayer; import androidx.media3.exoplayer.source.ProgressiveMediaSource; import androidx.media3.exoplayer.trackselection.DefaultTrackSelector; @@ -147,7 +148,10 @@ public class ViewRedditGalleryVideoFragment extends Fragment { }); TrackSelector trackSelector = new DefaultTrackSelector(activity); - player = new ExoPlayer.Builder(activity).setTrackSelector(trackSelector).build(); + player = new ExoPlayer.Builder(activity) + .setTrackSelector(trackSelector) + .setRenderersFactory(new DefaultRenderersFactory(activity).setEnableDecoderFallback(true)) + .build(); binding.getPlayerView().setPlayer(player); dataSourceFactory = new CacheDataSource.Factory().setCache(mSimpleCache) .setUpstreamDataSourceFactory(new DefaultHttpDataSource.Factory().setAllowCrossProtocolRedirects(true).setUserAgent(APIUtils.USER_AGENT)); |