mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-11-07 03:07:26 +01:00
Handle Streamable and Imgur videos when parsing v.redd.it videos in ViewVideoActivity.
This commit is contained in:
parent
7150ac6981
commit
dc4fa2e6b8
@ -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);
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user