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(); e.preventDefault();
displayControls ? setMouseMoved(false) : show(); displayControls ? setMouseMoved(false) : show();
}} }}
onStartShouldSetResponder={(e) => true}
onPointerDown={(e) => { onPointerDown={(e) => {
e.preventDefault(); e.preventDefault();
if (e.nativeEvent.pointerType !== "mouse") { if (e.nativeEvent.pointerType !== "mouse") {

View File

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

View File

@ -70,11 +70,16 @@ impl Transcoder {
// The group-id allows to distinguish multiple qualities from multiple variants. // The group-id allows to distinguish multiple qualities from multiple variants.
// We could create another quality set and use group-ids hiqual and lowqual. // We could create another quality set and use group-ids hiqual and lowqual.
master.push_str("GROUP-ID=\"audio\","); 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()); 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 { if let Some(title) = audio.title {
master.push_str(format!("NAME=\"{}\",", title).as_str()); 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) // TODO: Support aac5.1 (and specify the number of channel bellow)
// master.push_str(format!("CHANNELS=\"{}\",", 2).as_str()); // master.push_str(format!("CHANNELS=\"{}\",", 2).as_str());