aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2020-10-16 02:24:08 +0000
committerAlex Ning <chineseperson5@gmail.com>2020-10-16 02:24:08 +0000
commit79392bbeae9c70f4a2ff1a81848b3d3087e53344 (patch)
tree4b5faf1d266f50cdfd0b793e1ec8e1f17e45a5df /app
parentd23af6981aed4667326f05aba75836f0bb124bed (diff)
downloadinfinity-for-reddit-79392bbeae9c70f4a2ff1a81848b3d3087e53344.tar
infinity-for-reddit-79392bbeae9c70f4a2ff1a81848b3d3087e53344.tar.gz
infinity-for-reddit-79392bbeae9c70f4a2ff1a81848b3d3087e53344.tar.bz2
infinity-for-reddit-79392bbeae9c70f4a2ff1a81848b3d3087e53344.tar.lz
infinity-for-reddit-79392bbeae9c70f4a2ff1a81848b3d3087e53344.tar.xz
infinity-for-reddit-79392bbeae9c70f4a2ff1a81848b3d3087e53344.tar.zst
infinity-for-reddit-79392bbeae9c70f4a2ff1a81848b3d3087e53344.zip
Fix cannot download gfycat and redgifs videos. Fix fetching gfycat and redgifs videos failed in PostRecyclerViewAdapter and CommentAndPostRecyclerViewAdapter. Show progress bar when downloading reddit videos.
Diffstat (limited to '')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewVideoActivity.java19
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java8
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Post/ParsePost.java12
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Service/DownloadMediaService.java17
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Service/DownloadRedditVideoService.java122
-rw-r--r--app/src/main/res/values-de/strings.xml2
-rw-r--r--app/src/main/res/values-es/strings.xml2
-rw-r--r--app/src/main/res/values-fr/strings.xml2
-rw-r--r--app/src/main/res/values-hi/strings.xml2
-rw-r--r--app/src/main/res/values-hr/strings.xml2
-rw-r--r--app/src/main/res/values-it/strings.xml2
-rw-r--r--app/src/main/res/values-ja/strings.xml2
-rw-r--r--app/src/main/res/values-pt-rBR/strings.xml2
-rw-r--r--app/src/main/res/values/strings.xml5
14 files changed, 88 insertions, 111 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewVideoActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewVideoActivity.java
index 946d92a5..a8cefd9f 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewVideoActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewVideoActivity.java
@@ -214,22 +214,27 @@ public class ViewVideoActivity extends AppCompatActivity {
String videoUrl = savedInstanceState.getString(VIDEO_URI_STATE);
if (videoUrl != null) {
mVideoUri = Uri.parse(videoUrl);
- videoDownloadUrl = savedInstanceState.getString(VIDEO_DOWNLOAD_URL_STATE);
}
+ videoDownloadUrl = savedInstanceState.getString(VIDEO_DOWNLOAD_URL_STATE);
} else {
mVideoUri = intent.getData();
+ videoDownloadUrl = intent.getStringExtra(EXTRA_VIDEO_DOWNLOAD_URL);
+ }
+
+ String gfycatId = intent.getStringExtra(EXTRA_GFYCAT_ID);
+ if (gfycatId != null && gfycatId.contains("-")) {
+ gfycatId = gfycatId.substring(0, gfycatId.indexOf('-'));
+ }
+ if (videoType == VIDEO_TYPE_GFYCAT) {
+ videoFileName = "Gfycat-" + gfycatId + ".mp4";
+ } else {
+ videoFileName = "Redgifs-" + gfycatId + ".mp4";
}
if (mVideoUri == null) {
- String gfycatId = intent.getStringExtra(EXTRA_GFYCAT_ID);
- if (gfycatId != null && gfycatId.contains("-")) {
- gfycatId = gfycatId.substring(0, gfycatId.indexOf('-'));
- }
if (videoType == VIDEO_TYPE_GFYCAT) {
- videoFileName = "Gfycat-" + gfycatId + ".mp4";
loadGfycatOrRedgifsVideo(gfycatRetrofit, gfycatId, savedInstanceState, true);
} else {
- videoFileName = "Redgifs-" + gfycatId + ".mp4";
loadGfycatOrRedgifsVideo(redgifsRetrofit, gfycatId, savedInstanceState, false);
}
} else {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java
index 1cbdc75e..53771d97 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Adapter/PostRecyclerViewAdapter.java
@@ -593,12 +593,16 @@ public class PostRecyclerViewAdapter extends PagedListAdapter<Post, RecyclerView
post.setVideoDownloadUrl(mp4);
post.setVideoUrl(webm);
post.setLoadGfyOrRedgifsVideoSuccess(true);
- ((PostVideoAutoplayViewHolder) holder).bindVideoUri(Uri.parse(post.getVideoUrl()));
+ if (position == holder.getAdapterPosition()) {
+ ((PostVideoAutoplayViewHolder) holder).bindVideoUri(Uri.parse(post.getVideoUrl()));
+ }
}
@Override
public void failed(int errorCode) {
- ((PostVideoAutoplayViewHolder) holder).errorLoadingGfycatImageView.setVisibility(View.VISIBLE);
+ if (position == holder.getAdapterPosition()) {
+ ((PostVideoAutoplayViewHolder) holder).errorLoadingGfycatImageView.setVisibility(View.VISIBLE);
+ }
}
});
((PostVideoAutoplayViewHolder) holder).fetchGfycatOrRedgifsVideoLinks
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Post/ParsePost.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Post/ParsePost.java
index b77449cb..99bd969f 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Post/ParsePost.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Post/ParsePost.java
@@ -384,11 +384,19 @@ public class ParsePost {
if (authority != null && (authority.contains("gfycat.com"))) {
post.setIsGfycat(true);
post.setVideoUrl(url);
- post.setGfycatId(url.substring(url.lastIndexOf("/") + 1));
+ String gfycatId = url.substring(url.lastIndexOf("/") + 1);
+ if (gfycatId.contains("-")) {
+ gfycatId = gfycatId.substring(0, gfycatId.indexOf('-'));
+ }
+ post.setGfycatId(gfycatId);
} else if (authority != null && authority.contains("redgifs.com")) {
+ String gfycatId = url.substring(url.lastIndexOf("/") + 1);
+ if (gfycatId.contains("-")) {
+ gfycatId = gfycatId.substring(0, gfycatId.indexOf('-'));
+ }
post.setIsRedgifs(true);
post.setVideoUrl(url);
- post.setGfycatId(url.substring(url.lastIndexOf("/") + 1));
+ post.setGfycatId(gfycatId);
}
} catch (IllegalArgumentException ignore) { }
} else if (post.getPostType() == Post.LINK_TYPE || post.getPostType() == Post.NO_PREVIEW_LINK_TYPE) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Service/DownloadMediaService.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Service/DownloadMediaService.java
index 61d9ce3d..30dfd001 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Service/DownloadMediaService.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Service/DownloadMediaService.java
@@ -16,7 +16,6 @@ import android.os.Build;
import android.os.Environment;
import android.os.IBinder;
import android.provider.MediaStore;
-import android.util.Log;
import androidx.annotation.NonNull;
import androidx.core.app.NotificationCompat;
@@ -145,25 +144,13 @@ public class DownloadMediaService extends Service {
mimeType = mediaType == EXTRA_MEDIA_TYPE_VIDEO ? "video/*" : "image/*";
final DownloadProgressResponseBody.ProgressListener progressListener = new DownloadProgressResponseBody.ProgressListener() {
- boolean firstUpdate = true;
long time = 0;
@Override public void update(long bytesRead, long contentLength, boolean done) {
- if (done) {
- //updateNotification(0, null, -1, null);
- } else {
- if (firstUpdate) {
- firstUpdate = false;
- if (contentLength == -1) {
- Log.i("adfasdf", "content-length: unknown");
- } else {
- Log.i("adfasdf", "content-length: " + contentLength);
- }
- }
-
+ if (!done) {
if (contentLength != -1) {
long currentTime = System.currentTimeMillis();
- if ((currentTime - time) / 1000 > 2) {
+ if (currentTime - time > 1000) {
time = currentTime;
updateNotification(0, (int) ((100 * bytesRead) / contentLength), null);
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Service/DownloadRedditVideoService.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Service/DownloadRedditVideoService.java
index 6ae6350b..440441c7 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Service/DownloadRedditVideoService.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Service/DownloadRedditVideoService.java
@@ -7,7 +7,6 @@ import android.app.PendingIntent;
import android.app.Service;
import android.content.ContentResolver;
import android.content.ContentValues;
-import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.media.MediaCodec;
@@ -21,7 +20,6 @@ import android.os.Build;
import android.os.Environment;
import android.os.IBinder;
import android.provider.MediaStore;
-import android.util.Log;
import androidx.annotation.NonNull;
import androidx.core.app.NotificationCompat;
@@ -82,6 +80,8 @@ public class DownloadRedditVideoService extends Service {
@Inject
CustomThemeWrapper customThemeWrapper;
String resultFile;
+ private NotificationManagerCompat notificationManager;
+ private NotificationCompat.Builder builder;
public DownloadRedditVideoService() {
}
@@ -95,27 +95,20 @@ public class DownloadRedditVideoService extends Service {
public int onStartCommand(Intent intent, int flags, int startId) {
((Infinity) getApplication()).getAppComponent().inject(this);
+ notificationManager = NotificationManagerCompat.from(this);
+ builder = new NotificationCompat.Builder(this, NotificationUtils.CHANNEL_ID_DOWNLOAD_REDDIT_VIDEO);
final DownloadProgressResponseBody.ProgressListener progressListener = new DownloadProgressResponseBody.ProgressListener() {
- boolean firstUpdate = true;
+ long time = 0;
@Override public void update(long bytesRead, long contentLength, boolean done) {
- if (done) {
- Log.i("adfasdf", "completed");
- } else {
- if (firstUpdate) {
- firstUpdate = false;
- if (contentLength == -1) {
- Log.i("adfasdf", "content-length: unknown");
- } else {
- Log.i("adfasdf", "content-length: " + contentLength);
- }
- }
-
- Log.i("adfasdf", "bytes read " + bytesRead);
-
+ if (!done) {
if (contentLength != -1) {
- Log.i("adfasdf", "progress: " + ((100 * bytesRead) / contentLength));
+ long currentTime = System.currentTimeMillis();
+ if (currentTime - time > 1000) {
+ time = currentTime;
+ updateNotification(0, (int) ((100 * bytesRead) / contentLength), null);
+ }
}
}
}
@@ -132,9 +125,6 @@ public class DownloadRedditVideoService extends Service {
retrofit = retrofit.newBuilder().client(client).build();
-
-
-
String videoUrl = intent.getStringExtra(EXTRA_VIDEO_URL);
String audioUrl = videoUrl.substring(0, videoUrl.lastIndexOf('/')) + "/DASH_audio.mp4";
String subredditName = intent.getStringExtra(EXTRA_SUBREDDIT);
@@ -154,7 +144,7 @@ public class DownloadRedditVideoService extends Service {
startForeground(
NotificationUtils.DOWNLOAD_REDDIT_VIDEO_NOTIFICATION_ID,
- createNotification(R.string.downloading_reddit_video, fileNameWithoutExtension[0] + ".mp4", null)
+ createNotification(fileNameWithoutExtension[0] + ".mp4")
);
DownloadFile downloadFile = retrofit.create(DownloadFile.class);
@@ -179,12 +169,12 @@ public class DownloadRedditVideoService extends Service {
String directoryPath = separateDownloadFolder ? directory.getAbsolutePath() + "/Infinity/" + subredditName + "/" : directory.getAbsolutePath() + "/Infinity/";
File infinityDir = new File(directoryPath);
if (!infinityDir.exists() && !infinityDir.mkdir()) {
- downloadFinished(null, destinationFileName, ERROR_CANNOT_GET_DESTINATION_DIRECTORY);
+ downloadFinished(null, ERROR_CANNOT_GET_DESTINATION_DIRECTORY);
return;
}
destinationFileUriString = directoryPath + destinationFileName;
} else {
- downloadFinished(null, destinationFileName, ERROR_CANNOT_GET_DESTINATION_DIRECTORY);
+ downloadFinished(null, ERROR_CANNOT_GET_DESTINATION_DIRECTORY);
return;
}
} else {
@@ -198,21 +188,21 @@ public class DownloadRedditVideoService extends Service {
if (separateDownloadFolder) {
dir = DocumentFile.fromTreeUri(DownloadRedditVideoService.this, Uri.parse(destinationFileDirectory));
if (dir == null) {
- downloadFinished(null, destinationFileName, ERROR_CANNOT_GET_DESTINATION_DIRECTORY);
+ downloadFinished(null, ERROR_CANNOT_GET_DESTINATION_DIRECTORY);
return;
}
dir = dir.findFile(subredditName);
if (dir == null) {
dir = DocumentFile.fromTreeUri(DownloadRedditVideoService.this, Uri.parse(destinationFileDirectory)).createDirectory(subredditName);
if (dir == null) {
- downloadFinished(null, destinationFileName, ERROR_CANNOT_GET_DESTINATION_DIRECTORY);
+ downloadFinished(null, ERROR_CANNOT_GET_DESTINATION_DIRECTORY);
return;
}
}
} else {
dir = DocumentFile.fromTreeUri(DownloadRedditVideoService.this, Uri.parse(destinationFileDirectory));
if (dir == null) {
- downloadFinished(null, destinationFileName, ERROR_CANNOT_GET_DESTINATION_DIRECTORY);
+ downloadFinished(null, ERROR_CANNOT_GET_DESTINATION_DIRECTORY);
return;
}
}
@@ -225,13 +215,13 @@ public class DownloadRedditVideoService extends Service {
}
picFile = dir.createFile("video/*", fileNameWithoutExtension[0] + ".mp4");
if (picFile == null) {
- downloadFinished(null, destinationFileName, ERROR_CANNOT_GET_DESTINATION_DIRECTORY);
+ downloadFinished(null, ERROR_CANNOT_GET_DESTINATION_DIRECTORY);
return;
}
destinationFileUriString = picFile.getUri().toString();
}
- updateNotification(R.string.downloading_reddit_video_audio_track, destinationFileName, null);
+ updateNotification(R.string.downloading_reddit_video_audio_track, 0, null);
downloadFile.downloadFile(audioUrl).enqueue(new Callback<ResponseBody>() {
@Override
public void onResponse(@NonNull Call<ResponseBody> call, @NonNull Response<ResponseBody> audioResponse) {
@@ -249,12 +239,12 @@ public class DownloadRedditVideoService extends Service {
new File(videoFilePath).delete();
new File(audioFilePath).delete();
new File(outputFilePath).delete();
- downloadFinished(destinationFileUri, destinationFileName, errorCode);
+ downloadFinished(destinationFileUri, errorCode);
}
@Override
public void updateProgressNotification(int stringResId) {
- updateNotification(stringResId, destinationFileName, null);
+ updateNotification(stringResId, -1, null);
}
}).execute();
} else {
@@ -267,12 +257,12 @@ public class DownloadRedditVideoService extends Service {
@Override
public void finished(Uri destinationFileUri, int errorCode) {
new File(videoFilePath).delete();
- downloadFinished(destinationFileUri, destinationFileName, errorCode);
+ downloadFinished(destinationFileUri, errorCode);
}
@Override
public void updateProgressNotification(int stringResId) {
- updateNotification(stringResId, destinationFileName, null);
+ updateNotification(stringResId, -1, null);
}
}).execute();
}
@@ -289,56 +279,56 @@ public class DownloadRedditVideoService extends Service {
@Override
public void finished(Uri destinationFileUri, int errorCode) {
new File(videoFilePath).delete();
- downloadFinished(destinationFileUri, destinationFileName, errorCode);
+ downloadFinished(destinationFileUri, errorCode);
}
@Override
public void updateProgressNotification(int stringResId) {
- updateNotification(stringResId, destinationFileName, null);
+ updateNotification(stringResId, -1, null);
}
}).execute();
}
});
} else {
- downloadFinished(null, destinationFileName, ERROR_VIDEO_FILE_CANNOT_DOWNLOAD);
+ downloadFinished(null, ERROR_VIDEO_FILE_CANNOT_DOWNLOAD);
}
}
@Override
public void onFailure(@NonNull Call<ResponseBody> call, @NonNull Throwable t) {
- downloadFinished(null, destinationFileName, ERROR_VIDEO_FILE_CANNOT_DOWNLOAD);
+ downloadFinished(null, ERROR_VIDEO_FILE_CANNOT_DOWNLOAD);
}
});
} else {
- downloadFinished(null, destinationFileName, ERROR_CANNOT_GET_CACHE_DIRECTORY);
+ downloadFinished(null, ERROR_CANNOT_GET_CACHE_DIRECTORY);
}
return START_NOT_STICKY;
}
- private void downloadFinished(Uri destinationFileUri, String fileName, int errorCode) {
+ private void downloadFinished(Uri destinationFileUri, int errorCode) {
if (errorCode != NO_ERROR) {
switch (errorCode) {
case ERROR_CANNOT_GET_CACHE_DIRECTORY:
- updateNotification(R.string.downloading_reddit_video_failed_cannot_get_cache_directory, fileName, null);
+ updateNotification(R.string.downloading_reddit_video_failed_cannot_get_cache_directory, -1, null);
break;
case ERROR_VIDEO_FILE_CANNOT_DOWNLOAD:
- updateNotification(R.string.downloading_reddit_video_failed_cannot_download_video, fileName, null);
+ updateNotification(R.string.downloading_reddit_video_failed_cannot_download_video, -1, null);
break;
case ERROR_VIDEO_FILE_CANNOT_SAVE:
- updateNotification(R.string.downloading_reddit_video_failed_cannot_save_video, fileName, null);
+ updateNotification(R.string.downloading_reddit_video_failed_cannot_save_video, -1, null);
break;
case ERROR_AUDIO_FILE_CANNOT_SAVE:
- updateNotification(R.string.downloading_reddit_video_failed_cannot_save_audio, fileName, null);
+ updateNotification(R.string.downloading_reddit_video_failed_cannot_save_audio, -1, null);
break;
case ERROR_MUX_FAILED:
- updateNotification(R.string.downloading_reddit_video_failed_cannot_mux, fileName, null);
+ updateNotification(R.string.downloading_reddit_video_failed_cannot_mux, -1, null);
break;
case ERROR_MUXED_VIDEO_FILE_CANNOT_SAVE:
- updateNotification(R.string.downloading_reddit_video_failed_cannot_save_mux_video, fileName, null);
+ updateNotification(R.string.downloading_reddit_video_failed_cannot_save_mux_video, -1, null);
break;
case ERROR_CANNOT_GET_DESTINATION_DIRECTORY:
- updateNotification(R.string.downloading_media_failed_cannot_save_to_destination_directory, fileName, null);
+ updateNotification(R.string.downloading_media_failed_cannot_save_to_destination_directory, -1, null);
break;
}
EventBus.getDefault().post(new DownloadRedditVideoEvent(false));
@@ -351,7 +341,7 @@ public class DownloadRedditVideoService extends Service {
intent.setDataAndType(destinationFileUri, "video/*");
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT);
- updateNotification(R.string.downloading_reddit_video_finished, fileName, pendingIntent);
+ updateNotification(R.string.downloading_reddit_video_finished, -1, pendingIntent);
EventBus.getDefault().post(new DownloadRedditVideoEvent(true));
}
);
@@ -359,22 +349,27 @@ public class DownloadRedditVideoService extends Service {
stopForeground(false);
}
- private Notification createNotification(int stringResId, String fileName, PendingIntent pendingIntent) {
- NotificationCompat.Builder builder = new NotificationCompat.Builder(this, NotificationUtils.CHANNEL_ID_DOWNLOAD_REDDIT_VIDEO);
- builder.setContentTitle(fileName).setContentText(getString(stringResId));
- if (pendingIntent != null) {
- builder.setContentIntent(pendingIntent);
- }
+ private Notification createNotification(String fileName) {
+ builder.setContentTitle(fileName).setContentText(getString(R.string.downloading_reddit_video)).setProgress(100, 0, false);
return builder.setSmallIcon(R.drawable.ic_notification)
.setColor(customThemeWrapper.getColorPrimaryLightTheme())
.build();
}
- private void updateNotification(int stringResId, String fileName, PendingIntent pendingIntent) {
- NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
+ private void updateNotification(int contentStringResId, int progress, PendingIntent pendingIntent) {
if (notificationManager != null) {
- notificationManager.notify(NotificationUtils.DOWNLOAD_REDDIT_VIDEO_NOTIFICATION_ID,
- createNotification(stringResId, fileName, pendingIntent));
+ if (progress < 0) {
+ builder.setProgress(0, 0, false);
+ } else {
+ builder.setProgress(100, progress, false);
+ }
+ if (contentStringResId != 0) {
+ builder.setContentText(getString(contentStringResId));
+ }
+ if (pendingIntent != null) {
+ builder.setContentIntent(pendingIntent);
+ }
+ notificationManager.notify(NotificationUtils.DOWNLOAD_REDDIT_VIDEO_NOTIFICATION_ID, builder.build());
}
}
@@ -418,14 +413,12 @@ public class DownloadRedditVideoService extends Service {
@Override
protected Void doInBackground(Void... voids) {
- publishProgress(R.string.downloading_reddit_video_save_video);
String savedVideoFilePath = writeResponseBodyToDisk(videoResponse, videoFilePath);
if (savedVideoFilePath == null) {
errorCode = ERROR_VIDEO_FILE_CANNOT_SAVE;
return null;
}
if (audioResponse != null) {
- publishProgress(R.string.downloading_reddit_video_save_audio);
String savedAudioFilePath = writeResponseBodyToDisk(audioResponse, audioFilePath);
if (savedAudioFilePath == null) {
errorCode = ERROR_AUDIO_FILE_CANNOT_SAVE;
@@ -529,7 +522,7 @@ public class DownloadRedditVideoService extends Service {
int audioTrack = muxer.addTrack(audioFormat);
boolean sawEOS = false;
int offset = 100;
- int sampleSize = 2048 * 1024;
+ int sampleSize = 4096 * 1024;
ByteBuffer videoBuf = ByteBuffer.allocate(sampleSize);
ByteBuffer audioBuf = ByteBuffer.allocate(sampleSize);
MediaCodec.BufferInfo videoBufferInfo = new MediaCodec.BufferInfo();
@@ -540,6 +533,7 @@ public class DownloadRedditVideoService extends Service {
muxer.start();
+ int muxedSize = 0;
while (!sawEOS) {
videoBufferInfo.offset = offset;
videoBufferInfo.size = videoExtractor.readSampleData(videoBuf, offset);
@@ -551,6 +545,7 @@ public class DownloadRedditVideoService extends Service {
videoBufferInfo.presentationTimeUs = videoExtractor.getSampleTime();
videoBufferInfo.flags = videoExtractor.getSampleFlags();
muxer.writeSampleData(videoTrack, videoBuf, videoBufferInfo);
+ muxedSize += videoTrack;
videoExtractor.advance();
}
}
@@ -571,10 +566,9 @@ public class DownloadRedditVideoService extends Service {
}
}
- try {
- muxer.stop();
- muxer.release();
- } catch (IllegalStateException ignore) {}
+ muxer.stop();
+ muxer.release();
+ } catch (IllegalStateException ignore) {
} catch (IOException e) {
e.printStackTrace();
return false;
diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml
index 2a4513c1..5cb295fe 100644
--- a/app/src/main/res/values-de/strings.xml
+++ b/app/src/main/res/values-de/strings.xml
@@ -764,8 +764,6 @@ Sie ist nicht krank oder so, aber sie könnte sich definitiv bessern."</string>
<string name="error_fetching_imgur_media">"Kann Bilder nicht laden"</string>
<string name="downloading_reddit_video">"Lade Videospur herunter"</string>
<string name="downloading_reddit_video_audio_track">"Lade Audiospur herunter"</string>
- <string name="downloading_reddit_video_save_video">"Speichere Videospur"</string>
- <string name="downloading_reddit_video_save_audio">"Speichere Tonspur"</string>
<string name="downloading_reddit_video_muxing">"Muxe Ton und Video"</string>
<string name="downloading_reddit_video_save_file_to_public_dir">"Speichere Video"</string>
<string name="downloading_reddit_video_finished">"Heruntergeladen"</string>
diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml
index c3fac9d6..ff2dd86d 100644
--- a/app/src/main/res/values-es/strings.xml
+++ b/app/src/main/res/values-es/strings.xml
@@ -758,8 +758,6 @@ Base: Indigo OLED"</string>
<string name="error_fetching_imgur_media">"Ocurrió un error cargando las imágenes"</string>
<string name="downloading_reddit_video">"Descargando Track Vídeo"</string>
<string name="downloading_reddit_video_audio_track">"Descargando Track Audio"</string>
- <string name="downloading_reddit_video_save_video">"Guardando Audio"</string>
- <string name="downloading_reddit_video_save_audio">"Guardado Audio Track"</string>
<string name="downloading_reddit_video_muxing">"Muxtiplexar Vídeo y Audio"</string>
<string name="downloading_reddit_video_save_file_to_public_dir">"Guardando Vídeo"</string>
<string name="downloading_reddit_video_finished">"Descargado"</string>
diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml
index 923848b9..3dc93012 100644
--- a/app/src/main/res/values-fr/strings.xml
+++ b/app/src/main/res/values-fr/strings.xml
@@ -814,8 +814,6 @@ Basé sur le thème sombre Indigo"</string>
<string name="error_fetching_imgur_media">"Ne peut pas charger les images"</string>
<string name="downloading_reddit_video">"Téléchargement de la piste vidéo"</string>
<string name="downloading_reddit_video_audio_track">"Téléchargement de la piste audio"</string>
- <string name="downloading_reddit_video_save_video">"Enregistrement de la piste vidéo"</string>
- <string name="downloading_reddit_video_save_audio">"Enregistrement de la piste audio"</string>
<string name="downloading_reddit_video_muxing">"Muxage vidéo et audio"</string>
<string name="downloading_reddit_video_save_file_to_public_dir">"Téléchargement de la vidéo"</string>
<string name="downloading_reddit_video_finished">"Téléchargé"</string>
diff --git a/app/src/main/res/values-hi/strings.xml b/app/src/main/res/values-hi/strings.xml
index 30329e50..8dfad5fd 100644
--- a/app/src/main/res/values-hi/strings.xml
+++ b/app/src/main/res/values-hi/strings.xml
@@ -783,8 +783,6 @@ https://play.google.com/store/apps/details?id=ml.docilealligator.infinityforredd
<string name="error_fetching_imgur_media">"चित्र लोड नहीं हो सका "</string>
<string name="downloading_reddit_video">"वीडियो ट्रैक डाउनलोड हो रहा है "</string>
<string name="downloading_reddit_video_audio_track">"ऑडियो ट्रैक डाउनलोड हो रहा है "</string>
- <string name="downloading_reddit_video_save_video">"वीडियो ट्रैक सहेजा जा रहा है "</string>
- <string name="downloading_reddit_video_save_audio">"ऑडियो ट्रैक सहेजा जा रहा है "</string>
<string name="downloading_reddit_video_muxing">"वीडियो एवं ऑडियो का एकीकरण किया जा रहा है "</string>
<string name="downloading_reddit_video_save_file_to_public_dir">"वीडियो सहेजी जा रही है "</string>
<string name="downloading_reddit_video_finished">"वीडियो सेब हो गया"</string>
diff --git a/app/src/main/res/values-hr/strings.xml b/app/src/main/res/values-hr/strings.xml
index 1f4cb520..bf916b5a 100644
--- a/app/src/main/res/values-hr/strings.xml
+++ b/app/src/main/res/values-hr/strings.xml
@@ -759,8 +759,6 @@ Baziraj na Indigo Amoled temi"</string>
<string name="error_fetching_imgur_media">"Nije moguće učitati slike"</string>
<string name="downloading_reddit_video">"Preuzimanje videozapisa"</string>
<string name="downloading_reddit_video_audio_track">"Preuzimanje audio zapisa"</string>
- <string name="downloading_reddit_video_save_video">"Spremanje videozapisa"</string>
- <string name="downloading_reddit_video_save_audio">"Spremanje audio zapisa"</string>
<string name="downloading_reddit_video_muxing">"Multipleksiranje videa i audija"</string>
<string name="downloading_reddit_video_save_file_to_public_dir">"Spremanje videa"</string>
<string name="downloading_reddit_video_finished">"Preuzeto"</string>
diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml
index 0ecbb0c4..d64e14dd 100644
--- a/app/src/main/res/values-it/strings.xml
+++ b/app/src/main/res/values-it/strings.xml
@@ -790,8 +790,6 @@ Non è malata o altro, ma potrebbe sicuramente stare meglio."</string>
<string name="error_fetching_imgur_media">"Impossibile caricare immagini"</string>
<string name="downloading_reddit_video">"Download Traccia Video"</string>
<string name="downloading_reddit_video_audio_track">"Download Traccia Audio"</string>
- <string name="downloading_reddit_video_save_video">"Salvataggio Traccia Video"</string>
- <string name="downloading_reddit_video_save_audio">"Salvataggio Traccia Audio"</string>
<string name="downloading_reddit_video_muxing">"Muxing Video e Audio"</string>
<string name="downloading_reddit_video_save_file_to_public_dir">"Salvataggio Video"</string>
<string name="downloading_reddit_video_finished">"Scaricato"</string>
diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml
index a3b8f3d4..bd4ce474 100644
--- a/app/src/main/res/values-ja/strings.xml
+++ b/app/src/main/res/values-ja/strings.xml
@@ -693,8 +693,6 @@ https://play.google.com/store
<string name="error_fetching_imgur_media">"画像をロードできません"</string>
<string name="downloading_reddit_video">"動画トラックをダウンロード中"</string>
<string name="downloading_reddit_video_audio_track">"音声トラックをダウンロード中"</string>
- <string name="downloading_reddit_video_save_video">"動画トラックを保存中"</string>
- <string name="downloading_reddit_video_save_audio">"音声トラックを保存中"</string>
<!-- Shouldn't the english translation be
"Mixing Video and Audio"? -->
diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml
index 40b2e5f1..6e1f8037 100644
--- a/app/src/main/res/values-pt-rBR/strings.xml
+++ b/app/src/main/res/values-pt-rBR/strings.xml
@@ -754,8 +754,6 @@ Baseado no Tema Indigo Amoled"</string>
<string name="error_fetching_imgur_media">"Não foi possível carregar as imagens"</string>
<string name="downloading_reddit_video">"Executando download do vídeo"</string>
<string name="downloading_reddit_video_audio_track">"Executando download do áudio"</string>
- <string name="downloading_reddit_video_save_video">"Salvando vídeo"</string>
- <string name="downloading_reddit_video_save_audio">"Salvando áudio"</string>
<string name="downloading_reddit_video_muxing">"Sincronizando áudio e vídeo"</string>
<string name="downloading_reddit_video_save_file_to_public_dir">"Salvando vídeo"</string>
<string name="downloading_reddit_video_finished">"Baixado"</string>
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 294f9fce..886d65c0 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -843,8 +843,6 @@
<string name="downloading_reddit_video">Downloading Video Track</string>
<string name="downloading_reddit_video_audio_track">Downloading Audio Track</string>
- <string name="downloading_reddit_video_save_video">Saving Video Track</string>
- <string name="downloading_reddit_video_save_audio">Saving Audio Track</string>
<string name="downloading_reddit_video_muxing">Muxing Video and Audio</string>
<string name="downloading_reddit_video_save_file_to_public_dir">Saving Video</string>
<string name="downloading_reddit_video_finished">Downloaded</string>
@@ -854,8 +852,6 @@
<string name="downloading_reddit_video_failed_cannot_save_audio">Download failed: cannot save audio to cache directory</string>
<string name="downloading_reddit_video_failed_cannot_mux">Download failed: cannot mux video and audio</string>
<string name="downloading_reddit_video_failed_cannot_save_mux_video">Download failed: cannot save the video to public directory</string>
- <string name="downloading_video">Downloading Video</string>
- <string name="downloading_video_save_video">Saving Video</string>
<string name="downloading">Downloading</string>
<string name="downloading_media_finished">Downloaded</string>
@@ -885,7 +881,6 @@
<string name="view_full_comment_markdown">View Full Markdown</string>
<string name="select_user_flair_success">User flair selected</string>
- <string name="select_user_flair_failed">Cannot select user flair</string>
<string name="select_this_user_flair">Select this user flair?</string>
<string name="select_header_size">Select Header Size</string>