Always name audio tracks

This commit is contained in:
Zoe Roux 2023-06-13 11:10:31 +09:00
parent 72e74cea32
commit 47a22b6540
3 changed files with 16 additions and 10 deletions

View File

@ -165,7 +165,6 @@ export const Player: QueryPage<{ slug: string }> = ({ slug }) => {
e.preventDefault();
displayControls ? setMouseMoved(false) : show();
}}
onStartShouldSetResponder={(e) => true}
onPointerDown={(e) => {
e.preventDefault();
if (e.nativeEvent.pointerType !== "mouse") {

View File

@ -65,7 +65,7 @@ export const fullscreenAtom = atom(
set(privateFullscreen, false);
screen.orientation.unlock();
}
} catch(e) {
} catch (e) {
console.error(e);
}
},
@ -134,7 +134,10 @@ export const Video = memo(function _Video({
volume={volume}
resizeMode="contain"
onBuffer={({ isBuffering }) => setLoad(isBuffering)}
onError={(status) => setError(status.error.errorString)}
onError={(status) => {
console.error(status);
setError(status.error.errorString);
}}
onProgress={(progress) => {
setPrivateProgress(progress.currentTime);
setBuffered(progress.playableDuration);
@ -153,8 +156,7 @@ export const Video = memo(function _Video({
}
fonts={fonts}
onMediaUnsupported={() => {
if (mode == PlayMode.Direct)
setPlayMode(PlayMode.Hls);
if (mode == PlayMode.Direct) setPlayMode(PlayMode.Hls);
}}
// TODO: textTracks: external subtitles
/>

View File

@ -70,11 +70,16 @@ impl Transcoder {
// The group-id allows to distinguish multiple qualities from multiple variants.
// We could create another quality set and use group-ids hiqual and lowqual.
master.push_str("GROUP-ID=\"audio\",");
if let Some(language) = audio.language {
if let Some(language) = audio.language.clone() {
master.push_str(format!("LANGUAGE=\"{}\",", language).as_str());
}
// Exoplayer throws if audio tracks dont have names so we always add one.
if let Some(title) = audio.title {
master.push_str(format!("NAME=\"{}\",", title).as_str());
} else if let Some(language) = audio.language {
master.push_str(format!("NAME=\"{}\"", language).as_str());
} else {
master.push_str(format!("NAME=\"Audio {}\"", audio.index).as_str());
}
// TODO: Support aac5.1 (and specify the number of channel bellow)
// master.push_str(format!("CHANNELS=\"{}\",", 2).as_str());