aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/ml
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2021-12-20 13:50:26 +0000
committerAlex Ning <chineseperson5@gmail.com>2021-12-20 13:50:26 +0000
commitdc4fa2e6b8e27e987e8730e5d5e26a0dd2a0411d (patch)
treee85220b9a809c153394b7f0c2152e8897e94ea78 /app/src/main/java/ml
parent7150ac69815a34011a3c92f2adf75baa5bf76c65 (diff)
downloadinfinity-for-reddit-dc4fa2e6b8e27e987e8730e5d5e26a0dd2a0411d.tar
infinity-for-reddit-dc4fa2e6b8e27e987e8730e5d5e26a0dd2a0411d.tar.gz
infinity-for-reddit-dc4fa2e6b8e27e987e8730e5d5e26a0dd2a0411d.tar.bz2
infinity-for-reddit-dc4fa2e6b8e27e987e8730e5d5e26a0dd2a0411d.tar.lz
infinity-for-reddit-dc4fa2e6b8e27e987e8730e5d5e26a0dd2a0411d.tar.xz
infinity-for-reddit-dc4fa2e6b8e27e987e8730e5d5e26a0dd2a0411d.tar.zst
infinity-for-reddit-dc4fa2e6b8e27e987e8730e5d5e26a0dd2a0411d.zip
Handle Streamable and Imgur videos when parsing v.redd.it videos in ViewVideoActivity.
Diffstat (limited to 'app/src/main/java/ml')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java16
2 files changed, 17 insertions, 1 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java
index a8c609f2..6e744fd4 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/LinkResolverActivity.java
@@ -265,7 +265,7 @@ public class LinkResolverActivity extends AppCompatActivity {
url = url.replaceFirst("http://" , "https://");
url = url.substring(0, url.length() - 5) + ".mp4";
Intent intent = new Intent(this, ViewVideoActivity.class);
- intent.putExtra(ViewVideoActivity.EXTRA_VIDEO_TYPE, ViewVideoActivity.VIDEO_TYPE_DIRECT);
+ intent.putExtra(ViewVideoActivity.EXTRA_VIDEO_TYPE, ViewVideoActivity.VIDEO_TYPE_IMGUR);
intent.putExtra(ViewVideoActivity.EXTRA_IS_NSFW, getIntent().getBooleanExtra(EXTRA_IS_NSFW, false));
intent.setData(Uri.parse(url));
startActivity(intent);
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 b53ddf7e..9431ca29 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java
@@ -721,6 +721,22 @@ public class ViewVideoActivity extends AppCompatActivity {
videoFileName = "Redgifs-" + gfycatId + ".mp4";
}
loadGfycatOrRedgifsVideo(redgifsRetrofit, gfycatId, savedInstanceState, false);
+ } else if (post.isStreamable()) {
+ videoType = VIDEO_TYPE_STREAMABLE;
+ String shortCode = post.getStreamableShortCode();
+ videoFileName = "Streamable-" + shortCode + ".mp4";
+ loadStreamableVideo(shortCode, savedInstanceState);
+ } else if (post.isImgur()) {
+ mVideoUri = Uri.parse(post.getVideoUrl());
+ videoDownloadUrl = post.getVideoDownloadUrl();
+ videoType = VIDEO_TYPE_IMGUR;
+ videoFileName = "imgur-" + FilenameUtils.getName(videoDownloadUrl);
+ // Produces DataSource instances through which media data is loaded.
+ dataSourceFactory = new CacheDataSourceFactory(mSimpleCache,
+ new DefaultHttpDataSourceFactory(Util.getUserAgent(ViewVideoActivity.this, "Infinity")));
+ // Prepare the player with the source.
+ player.prepare(new ProgressiveMediaSource.Factory(dataSourceFactory).createMediaSource(mVideoUri));
+ preparePlayer(savedInstanceState);
} else {
progressBar.setVisibility(View.GONE);
if (post.getVideoUrl() != null) {