diff --git a/app/src/main/java/org/schabi/newpipe/player/BasePlayer.java b/app/src/main/java/org/schabi/newpipe/player/BasePlayer.java
index 07d567d57..222f0fad8 100644
--- a/app/src/main/java/org/schabi/newpipe/player/BasePlayer.java
+++ b/app/src/main/java/org/schabi/newpipe/player/BasePlayer.java
@@ -617,12 +617,12 @@ public abstract class BasePlayer implements Player.EventListener, PlaybackListen
public void onPositionDiscontinuity(int reason) {
if (DEBUG) Log.d(TAG, "onPositionDiscontinuity() called with reason = [" + reason + "]");
// Refresh the playback if there is a transition to the next video
- final int newWindowIndex = simpleExoPlayer.getCurrentPeriodIndex();
+ final int newPeriodIndex = simpleExoPlayer.getCurrentPeriodIndex();
/* Discontinuity reasons!! Thank you ExoPlayer lords */
switch (reason) {
case DISCONTINUITY_REASON_PERIOD_TRANSITION:
- if (newWindowIndex == playQueue.getIndex()) {
+ if (newPeriodIndex == playQueue.getIndex()) {
registerView();
} else {
playQueue.offsetIndex(+1);
diff --git a/app/src/main/java/org/schabi/newpipe/player/VideoPlayer.java b/app/src/main/java/org/schabi/newpipe/player/VideoPlayer.java
index 67e4e6919..40b7df2dc 100644
--- a/app/src/main/java/org/schabi/newpipe/player/VideoPlayer.java
+++ b/app/src/main/java/org/schabi/newpipe/player/VideoPlayer.java
@@ -391,10 +391,10 @@ public abstract class VideoPlayer extends BasePlayer
// Create subtitle sources
for (final Subtitles subtitle : info.getSubtitles()) {
final String mimeType = PlayerHelper.mimeTypesOf(subtitle.getFileType());
- if (mimeType == null) continue;
+ if (mimeType == null || context == null) continue;
final Format textFormat = Format.createTextSampleFormat(null, mimeType,
- SELECTION_FLAG_AUTOSELECT, PlayerHelper.captionLanguageOf(subtitle));
+ SELECTION_FLAG_AUTOSELECT, PlayerHelper.captionLanguageOf(context, subtitle));
final MediaSource textSource = new SingleSampleMediaSource(
Uri.parse(subtitle.getURL()), cacheDataSourceFactory, textFormat, TIME_UNSET);
mediaSources.add(textSource);
diff --git a/app/src/main/java/org/schabi/newpipe/player/helper/PlayerHelper.java b/app/src/main/java/org/schabi/newpipe/player/helper/PlayerHelper.java
index 4929be9a3..ea3f73a17 100644
--- a/app/src/main/java/org/schabi/newpipe/player/helper/PlayerHelper.java
+++ b/app/src/main/java/org/schabi/newpipe/player/helper/PlayerHelper.java
@@ -66,9 +66,11 @@ public class PlayerHelper {
}
@NonNull
- public static String captionLanguageOf(@NonNull final Subtitles subtitles) {
+ public static String captionLanguageOf(@NonNull final Context context,
+ @NonNull final Subtitles subtitles) {
final String displayName = subtitles.getLocale().getDisplayName(subtitles.getLocale());
- return displayName + (subtitles.isAutoGenerated() ? " (auto-generated)" : "");
+ return displayName + (subtitles.isAutoGenerated() ?
+ " (" + context.getString(R.string.caption_auto_generated)+ ")" : "");
}
public static String resizeTypeOf(@NonNull final Context context,
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index ab94ddce3..184219bad 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -406,6 +406,7 @@
FILL
ZOOM
+ Auto-generated
Caption Font Size
Smaller Font
Normal Font