diff options
author | Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> | 2024-06-25 20:51:22 +0000 |
---|---|---|
committer | Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> | 2024-06-25 20:51:22 +0000 |
commit | 5a1b67f599bc95b9f04d06cc7f22cc65994995f0 (patch) | |
tree | e69bc88390dc119eb1bc8a2be496f82d7738527b /app/src/main/java/ml | |
parent | e1f4dbd01fa4651b1599fdb42e7604df1e86a058 (diff) | |
download | infinity-for-reddit-5a1b67f599bc95b9f04d06cc7f22cc65994995f0.tar infinity-for-reddit-5a1b67f599bc95b9f04d06cc7f22cc65994995f0.tar.gz infinity-for-reddit-5a1b67f599bc95b9f04d06cc7f22cc65994995f0.tar.bz2 infinity-for-reddit-5a1b67f599bc95b9f04d06cc7f22cc65994995f0.tar.lz infinity-for-reddit-5a1b67f599bc95b9f04d06cc7f22cc65994995f0.tar.xz infinity-for-reddit-5a1b67f599bc95b9f04d06cc7f22cc65994995f0.tar.zst infinity-for-reddit-5a1b67f599bc95b9f04d06cc7f22cc65994995f0.zip |
Upgrade Media3 and enable decoder fallback.
Diffstat (limited to 'app/src/main/java/ml')
3 files changed, 17 insertions, 3 deletions
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)); |