mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2024-11-16 14:54:57 +00:00
-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) {
|
public void onPositionDiscontinuity(int reason) {
|
||||||
if (DEBUG) Log.d(TAG, "onPositionDiscontinuity() called with reason = [" + reason + "]");
|
if (DEBUG) Log.d(TAG, "onPositionDiscontinuity() called with reason = [" + reason + "]");
|
||||||
// Refresh the playback if there is a transition to the next video
|
// 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 */
|
/* Discontinuity reasons!! Thank you ExoPlayer lords */
|
||||||
switch (reason) {
|
switch (reason) {
|
||||||
case DISCONTINUITY_REASON_PERIOD_TRANSITION:
|
case DISCONTINUITY_REASON_PERIOD_TRANSITION:
|
||||||
if (newWindowIndex == playQueue.getIndex()) {
|
if (newPeriodIndex == playQueue.getIndex()) {
|
||||||
registerView();
|
registerView();
|
||||||
} else {
|
} else {
|
||||||
playQueue.offsetIndex(+1);
|
playQueue.offsetIndex(+1);
|
||||||
|
@ -391,10 +391,10 @@ public abstract class VideoPlayer extends BasePlayer
|
|||||||
// Create subtitle sources
|
// Create subtitle sources
|
||||||
for (final Subtitles subtitle : info.getSubtitles()) {
|
for (final Subtitles subtitle : info.getSubtitles()) {
|
||||||
final String mimeType = PlayerHelper.mimeTypesOf(subtitle.getFileType());
|
final String mimeType = PlayerHelper.mimeTypesOf(subtitle.getFileType());
|
||||||
if (mimeType == null) continue;
|
if (mimeType == null || context == null) continue;
|
||||||
|
|
||||||
final Format textFormat = Format.createTextSampleFormat(null, mimeType,
|
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(
|
final MediaSource textSource = new SingleSampleMediaSource(
|
||||||
Uri.parse(subtitle.getURL()), cacheDataSourceFactory, textFormat, TIME_UNSET);
|
Uri.parse(subtitle.getURL()), cacheDataSourceFactory, textFormat, TIME_UNSET);
|
||||||
mediaSources.add(textSource);
|
mediaSources.add(textSource);
|
||||||
|
@ -66,9 +66,11 @@ public class PlayerHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@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());
|
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,
|
public static String resizeTypeOf(@NonNull final Context context,
|
||||||
|
@ -406,6 +406,7 @@
|
|||||||
<string name="resize_fill">FILL</string>
|
<string name="resize_fill">FILL</string>
|
||||||
<string name="resize_zoom">ZOOM</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="caption_font_size_settings_title">Caption Font Size</string>
|
||||||
<string name="smaller_caption_font_size">Smaller Font</string>
|
<string name="smaller_caption_font_size">Smaller Font</string>
|
||||||
<string name="normal_caption_font_size">Normal Font</string>
|
<string name="normal_caption_font_size">Normal Font</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user