mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Fix capitalization of language in track selector
Issue: #9452 PiperOrigin-RevId: 400680794
This commit is contained in:
parent
d4b9fe33b4
commit
8ed6c9fcf5
3 changed files with 15 additions and 2 deletions
|
|
@ -35,6 +35,8 @@
|
||||||
`Player.addListener`.
|
`Player.addListener`.
|
||||||
* Fix initial timestamp display in `PlayerControlView`
|
* Fix initial timestamp display in `PlayerControlView`
|
||||||
([#9524](https://github.com/google/ExoPlayer/issues/9254)).
|
([#9524](https://github.com/google/ExoPlayer/issues/9254)).
|
||||||
|
* Fix capitalization of languages in the track selector
|
||||||
|
([#9452](https://github.com/google/ExoPlayer/issues/9452)).
|
||||||
* Extractors:
|
* Extractors:
|
||||||
* MP4: Correctly handle HEVC tracks with pixel aspect ratios other than 1.
|
* MP4: Correctly handle HEVC tracks with pixel aspect ratios other than 1.
|
||||||
* TS: Correctly handle HEVC tracks with pixel aspect ratios other than 1.
|
* TS: Correctly handle HEVC tracks with pixel aspect ratios other than 1.
|
||||||
|
|
|
||||||
|
|
@ -2243,6 +2243,11 @@ public final class Util {
|
||||||
return systemLocales;
|
return systemLocales;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Returns the default {@link Locale.Category#DISPLAY DISPLAY} {@link Locale}. */
|
||||||
|
public static Locale getDefaultDisplayLocale() {
|
||||||
|
return Util.SDK_INT >= 24 ? Locale.getDefault(Locale.Category.DISPLAY) : Locale.getDefault();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Uncompresses the data in {@code input}.
|
* Uncompresses the data in {@code input}.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -104,8 +104,14 @@ public class DefaultTrackNameProvider implements TrackNameProvider {
|
||||||
if (TextUtils.isEmpty(language) || C.LANGUAGE_UNDETERMINED.equals(language)) {
|
if (TextUtils.isEmpty(language) || C.LANGUAGE_UNDETERMINED.equals(language)) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
Locale locale = Util.SDK_INT >= 21 ? Locale.forLanguageTag(language) : new Locale(language);
|
Locale languageLocale =
|
||||||
return locale.getDisplayName();
|
Util.SDK_INT >= 21 ? Locale.forLanguageTag(language) : new Locale(language);
|
||||||
|
Locale displayLocale = Util.getDefaultDisplayLocale();
|
||||||
|
String languageName = languageLocale.getDisplayName(displayLocale);
|
||||||
|
// Capitalize the first letter. See: https://github.com/google/ExoPlayer/issues/9452.
|
||||||
|
int firstCodePointLength = languageName.offsetByCodePoints(0, 1);
|
||||||
|
return languageName.substring(0, firstCodePointLength).toUpperCase(displayLocale)
|
||||||
|
+ languageName.substring(firstCodePointLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String buildRoleString(Format format) {
|
private String buildRoleString(Format format) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue