aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/ml
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/ml')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java6
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurVideoFragment.java8
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryVideoFragment.java6
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));