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) {