aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java32
1 files changed, 18 insertions, 14 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 7362e892..a9e366ca 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java
@@ -553,20 +553,24 @@ public class ViewVideoActivity extends AppCompatActivity {
loadGfycatOrRedgifsVideo(redgifsRetrofit, gfycatId, savedInstanceState, false);
} else {
progressBar.setVisibility(View.INVISIBLE);
- mVideoUri = Uri.parse(post.getVideoUrl());
- subredditName = post.getSubredditName();
- id = post.getId();
- videoDownloadUrl = post.getVideoDownloadUrl();
-
- videoFileName = subredditName + "-" + id + ".mp4";
- // 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 HlsMediaSource.Factory(dataSourceFactory).createMediaSource(mVideoUri));
- preparePlayer(savedInstanceState);
+ if (post.getVideoUrl() != null) {
+ mVideoUri = Uri.parse(post.getVideoUrl());
+ subredditName = post.getSubredditName();
+ id = post.getId();
+ videoDownloadUrl = post.getVideoDownloadUrl();
+
+ videoFileName = subredditName + "-" + id + ".mp4";
+ // 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 HlsMediaSource.Factory(dataSourceFactory).createMediaSource(mVideoUri));
+ preparePlayer(savedInstanceState);
+ } else {
+ Toast.makeText(ViewVideoActivity.this, R.string.error_fetching_v_redd_it_video_cannot_get_video_url, Toast.LENGTH_LONG).show();
+ }
}
}