mirror of
https://github.com/Docile-Alligator/Infinity-For-Reddit.git
synced 2026-02-23 17:35:51 +00:00
Use mp4 version of the fallback video.
This commit is contained in:
@ -184,7 +184,7 @@ public class ViewVideoActivity extends AppCompatActivity implements CustomFontRe
|
||||
|
||||
private String videoDownloadUrl;
|
||||
private String videoFileName;
|
||||
private String videoFallbackHLSUrl;
|
||||
private String videoFallbackDirectUrl;
|
||||
private String subredditName;
|
||||
private String id;
|
||||
private boolean wasPlaying;
|
||||
@ -411,7 +411,7 @@ public class ViewVideoActivity extends AppCompatActivity implements CustomFontRe
|
||||
Post post = intent.getParcelableExtra(EXTRA_POST);
|
||||
if (post != null) {
|
||||
titleTextView.setText(post.getTitle());
|
||||
videoFallbackHLSUrl = post.getVideoFallBackHLSUrl();
|
||||
videoFallbackDirectUrl = post.getVideoFallBackDirectUrl();
|
||||
}
|
||||
|
||||
trackSelector = new DefaultTrackSelector(this);
|
||||
@ -757,7 +757,7 @@ public class ViewVideoActivity extends AppCompatActivity implements CustomFontRe
|
||||
new FetchPost.FetchPostListener() {
|
||||
@Override
|
||||
public void fetchPostSuccess(Post post) {
|
||||
videoFallbackHLSUrl = post.getVideoFallBackHLSUrl();
|
||||
videoFallbackDirectUrl = post.getVideoFallBackDirectUrl();
|
||||
if (post.isRedgifs()) {
|
||||
videoType = VIDEO_TYPE_REDGIFS;
|
||||
String redgifsId = post.getRedgifsId();
|
||||
@ -851,12 +851,15 @@ public class ViewVideoActivity extends AppCompatActivity implements CustomFontRe
|
||||
}
|
||||
|
||||
private void loadFallbackVideo(Bundle savedInstanceState) {
|
||||
if (videoFallbackHLSUrl != null) {
|
||||
if (videoFallbackDirectUrl != null) {
|
||||
MediaItem mediaItem = player.getCurrentMediaItem();
|
||||
if (mediaItem == null || mediaItem.localConfiguration != null && !videoFallbackHLSUrl.equals(mediaItem.localConfiguration.uri.toString())) {
|
||||
videoType = VIDEO_TYPE_NORMAL;
|
||||
if (mediaItem == null || mediaItem.localConfiguration != null && !videoFallbackDirectUrl.equals(mediaItem.localConfiguration.uri.toString())) {
|
||||
videoType = VIDEO_TYPE_DIRECT;
|
||||
videoDownloadUrl = videoFallbackDirectUrl;
|
||||
mVideoUri = Uri.parse(videoFallbackDirectUrl);
|
||||
videoFileName = FilenameUtils.getName(videoDownloadUrl);
|
||||
player.prepare();
|
||||
player.setMediaSource(new HlsMediaSource.Factory(dataSourceFactory).createMediaSource(MediaItem.fromUri(videoFallbackHLSUrl)));
|
||||
player.setMediaSource(new ProgressiveMediaSource.Factory(dataSourceFactory).createMediaSource(MediaItem.fromUri(mVideoUri)));
|
||||
preparePlayer(savedInstanceState);
|
||||
}
|
||||
}
|
||||
|
||||
@ -399,8 +399,8 @@ public class ParsePost {
|
||||
post.setVideoUrl(videoUrl);
|
||||
post.setVideoDownloadUrl(videoDownloadUrl);
|
||||
}
|
||||
post.setVideoFallBackHLSUrl(Html.fromHtml(data.getJSONObject(JSONUtils.PREVIEW_KEY)
|
||||
.getJSONObject(JSONUtils.REDDIT_VIDEO_PREVIEW_KEY).getString(JSONUtils.HLS_URL_KEY)).toString());
|
||||
post.setVideoFallBackDirectUrl(Html.fromHtml(data.getJSONObject(JSONUtils.PREVIEW_KEY)
|
||||
.getJSONObject(JSONUtils.REDDIT_VIDEO_PREVIEW_KEY).getString(JSONUtils.FALLBACK_URL_KEY)).toString());
|
||||
} else {
|
||||
if (path.endsWith(".jpg") || path.endsWith(".png") || path.endsWith(".jpeg")) {
|
||||
//Image post
|
||||
|
||||
@ -43,7 +43,7 @@ public class Post implements Parcelable {
|
||||
private String url;
|
||||
private String videoUrl;
|
||||
private String videoDownloadUrl;
|
||||
private String videoFallBackHLSUrl;
|
||||
private String videoFallBackDirectUrl;
|
||||
private String redgifsId;
|
||||
private String streamableShortCode;
|
||||
private boolean isImgur;
|
||||
@ -168,7 +168,7 @@ public class Post implements Parcelable {
|
||||
url = in.readString();
|
||||
videoUrl = in.readString();
|
||||
videoDownloadUrl = in.readString();
|
||||
videoFallBackHLSUrl = in.readString();
|
||||
videoFallBackDirectUrl = in.readString();
|
||||
redgifsId = in.readString();
|
||||
streamableShortCode = in.readString();
|
||||
isImgur = in.readByte() != 0;
|
||||
@ -330,12 +330,12 @@ public class Post implements Parcelable {
|
||||
this.videoDownloadUrl = videoDownloadUrl;
|
||||
}
|
||||
|
||||
public String getVideoFallBackHLSUrl() {
|
||||
return videoFallBackHLSUrl;
|
||||
public String getVideoFallBackDirectUrl() {
|
||||
return videoFallBackDirectUrl;
|
||||
}
|
||||
|
||||
public void setVideoFallBackHLSUrl(String videoFallBackHLSUrl) {
|
||||
this.videoFallBackHLSUrl = videoFallBackHLSUrl;
|
||||
public void setVideoFallBackDirectUrl(String videoFallBackDirectUrl) {
|
||||
this.videoFallBackDirectUrl = videoFallBackDirectUrl;
|
||||
}
|
||||
|
||||
public String getRedgifsId() {
|
||||
@ -498,7 +498,7 @@ public class Post implements Parcelable {
|
||||
dest.writeString(url);
|
||||
dest.writeString(videoUrl);
|
||||
dest.writeString(videoDownloadUrl);
|
||||
dest.writeString(videoFallBackHLSUrl);
|
||||
dest.writeString(videoFallBackDirectUrl);
|
||||
dest.writeString(redgifsId);
|
||||
dest.writeString(streamableShortCode);
|
||||
dest.writeByte((byte) (isImgur ? 1 : 0));
|
||||
|
||||
Reference in New Issue
Block a user