diff options
author | Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> | 2024-02-28 16:34:05 +0000 |
---|---|---|
committer | Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> | 2024-02-28 16:34:05 +0000 |
commit | 0ae49fc19f390758a3300c29704bb4e677fbabcf (patch) | |
tree | 94a6d89589c7604395a0512a11d707b4888d7817 /app/src/main | |
parent | 4a58527d1bdac6564c48b06e27fb2206088c76ca (diff) | |
download | infinity-for-reddit-0ae49fc19f390758a3300c29704bb4e677fbabcf.tar infinity-for-reddit-0ae49fc19f390758a3300c29704bb4e677fbabcf.tar.gz infinity-for-reddit-0ae49fc19f390758a3300c29704bb4e677fbabcf.tar.bz2 infinity-for-reddit-0ae49fc19f390758a3300c29704bb4e677fbabcf.tar.lz infinity-for-reddit-0ae49fc19f390758a3300c29704bb4e677fbabcf.tar.xz infinity-for-reddit-0ae49fc19f390758a3300c29704bb4e677fbabcf.tar.zst infinity-for-reddit-0ae49fc19f390758a3300c29704bb4e677fbabcf.zip |
Version 7.0.1. Fix fallback video unable to play in ViewVideoActivity.
Diffstat (limited to 'app/src/main')
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java | 23 |
1 files changed, 3 insertions, 20 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 b631a590..697f0237 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java @@ -586,6 +586,9 @@ public class ViewVideoActivity extends AppCompatActivity implements CustomFontRe } setPlaybackSpeed(Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.DEFAULT_PLAYBACK_SPEED, "100"))); + // Produces DataSource instances through which media data is loaded. + dataSourceFactory = new CacheDataSource.Factory().setCache(mSimpleCache) + .setUpstreamDataSourceFactory(new DefaultHttpDataSource.Factory().setAllowCrossProtocolRedirects(true).setUserAgent(APIUtils.USER_AGENT)); if (videoType == VIDEO_TYPE_STREAMABLE) { if (savedInstanceState != null) { videoDownloadUrl = savedInstanceState.getString(VIDEO_DOWNLOAD_URL_STATE); @@ -598,8 +601,6 @@ public class ViewVideoActivity extends AppCompatActivity implements CustomFontRe if (mVideoUri == null) { loadStreamableVideo(shortCode, savedInstanceState); } else { - dataSourceFactory = new CacheDataSource.Factory().setCache(mSimpleCache) - .setUpstreamDataSourceFactory(new DefaultHttpDataSource.Factory().setAllowCrossProtocolRedirects(true).setUserAgent(APIUtils.USER_AGENT)); player.prepare(); player.setMediaSource(new ProgressiveMediaSource.Factory(dataSourceFactory).createMediaSource(MediaItem.fromUri(mVideoUri))); preparePlayer(savedInstanceState); @@ -622,8 +623,6 @@ public class ViewVideoActivity extends AppCompatActivity implements CustomFontRe if (mVideoUri == null) { loadRedgifsVideo(redgifsId, savedInstanceState); } else { - dataSourceFactory = new CacheDataSource.Factory().setCache(mSimpleCache) - .setUpstreamDataSourceFactory(new DefaultHttpDataSource.Factory().setAllowCrossProtocolRedirects(true).setUserAgent(APIUtils.USER_AGENT)); player.prepare(); player.setMediaSource(new ProgressiveMediaSource.Factory(dataSourceFactory).createMediaSource(MediaItem.fromUri(mVideoUri))); preparePlayer(savedInstanceState); @@ -635,9 +634,6 @@ public class ViewVideoActivity extends AppCompatActivity implements CustomFontRe } else { videoFileName = "imgur-" + FilenameUtils.getName(videoDownloadUrl); } - // Produces DataSource instances through which media data is loaded. - dataSourceFactory = new CacheDataSource.Factory().setCache(mSimpleCache) - .setUpstreamDataSourceFactory(new DefaultHttpDataSource.Factory().setAllowCrossProtocolRedirects(true).setUserAgent(APIUtils.USER_AGENT)); // Prepare the player with the source. player.prepare(); player.setMediaSource(new ProgressiveMediaSource.Factory(dataSourceFactory).createMediaSource(MediaItem.fromUri(mVideoUri))); @@ -647,9 +643,6 @@ public class ViewVideoActivity extends AppCompatActivity implements CustomFontRe subredditName = intent.getStringExtra(EXTRA_SUBREDDIT); id = intent.getStringExtra(EXTRA_ID); videoFileName = subredditName + "-" + id + ".mp4"; - // Produces DataSource instances through which media data is loaded. - dataSourceFactory = new CacheDataSource.Factory().setCache(mSimpleCache) - .setUpstreamDataSourceFactory(new DefaultHttpDataSource.Factory().setAllowCrossProtocolRedirects(true).setUserAgent(APIUtils.USER_AGENT)); // Prepare the player with the source. player.prepare(); player.setMediaSource(new HlsMediaSource.Factory(dataSourceFactory).createMediaSource(MediaItem.fromUri(mVideoUri))); @@ -727,8 +720,6 @@ public class ViewVideoActivity extends AppCompatActivity implements CustomFontRe progressBar.setVisibility(View.GONE); mVideoUri = Uri.parse(webm); videoDownloadUrl = mp4; - dataSourceFactory = new CacheDataSource.Factory().setCache(mSimpleCache) - .setUpstreamDataSourceFactory(new DefaultHttpDataSource.Factory().setAllowCrossProtocolRedirects(true).setUserAgent(APIUtils.USER_AGENT)); preparePlayer(savedInstanceState); player.prepare(); player.setMediaSource(new ProgressiveMediaSource.Factory(dataSourceFactory).createMediaSource(MediaItem.fromUri(mVideoUri))); @@ -777,9 +768,6 @@ public class ViewVideoActivity extends AppCompatActivity implements CustomFontRe videoDownloadUrl = post.getVideoDownloadUrl(); videoType = VIDEO_TYPE_IMGUR; videoFileName = "imgur-" + FilenameUtils.getName(videoDownloadUrl); - // Produces DataSource instances through which media data is loaded. - dataSourceFactory = new CacheDataSource.Factory().setCache(mSimpleCache) - .setUpstreamDataSourceFactory(new DefaultHttpDataSource.Factory().setAllowCrossProtocolRedirects(true).setUserAgent(APIUtils.USER_AGENT)); // Prepare the player with the source. player.prepare(); player.setMediaSource(new ProgressiveMediaSource.Factory(dataSourceFactory).createMediaSource(MediaItem.fromUri(mVideoUri))); @@ -793,9 +781,6 @@ public class ViewVideoActivity extends AppCompatActivity implements CustomFontRe videoDownloadUrl = post.getVideoDownloadUrl(); videoFileName = subredditName + "-" + id + ".mp4"; - // Produces DataSource instances through which media data is loaded. - dataSourceFactory = new CacheDataSource.Factory().setCache(mSimpleCache) - .setUpstreamDataSourceFactory(new DefaultHttpDataSource.Factory().setAllowCrossProtocolRedirects(true).setUserAgent(APIUtils.USER_AGENT)); // Prepare the player with the source. preparePlayer(savedInstanceState); player.prepare(); @@ -837,8 +822,6 @@ public class ViewVideoActivity extends AppCompatActivity implements CustomFontRe progressBar.setVisibility(View.GONE); videoDownloadUrl = streamableVideo.mp4 == null ? streamableVideo.mp4Mobile.url : streamableVideo.mp4.url; mVideoUri = Uri.parse(videoDownloadUrl); - dataSourceFactory = new CacheDataSource.Factory().setCache(mSimpleCache) - .setUpstreamDataSourceFactory(new DefaultHttpDataSource.Factory().setAllowCrossProtocolRedirects(true).setUserAgent(APIUtils.USER_AGENT)); preparePlayer(savedInstanceState); player.prepare(); player.setMediaSource(new ProgressiveMediaSource.Factory(dataSourceFactory).createMediaSource(MediaItem.fromUri(mVideoUri))); |