-Fixed auto-generated string not translatable.
This commit is contained in:
parent
762f374f93
commit
c1a302834c
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -406,6 +406,7 @@
|
|||
<string name="resize_fill">FILL</string>
|
||||
<string name="resize_zoom">ZOOM</string>
|
||||
|
||||
<string name="caption_auto_generated">Auto-generated</string>
|
||||
<string name="caption_font_size_settings_title">Caption Font Size</string>
|
||||
<string name="smaller_caption_font_size">Smaller Font</string>
|
||||
<string name="normal_caption_font_size">Normal Font</string>
|
||||
|
|
Loading…
Reference in New Issue