Apply audio mode to downloaded videos

Downloads bypass stream selection and reach play() as ready-made local
file streams, so audio mode never affected them. Apply the mode at that
choke point instead: swap a local video stream for the separately
downloaded audio track, or play a muxed file with the video track
disabled (vid set per-load in MPVClient, never toggled live). The
transform is bidirectional so stored audio-only queue/history entries
restore full video when the mode is off, and setAudioMode now reloads
downloaded content at the current position in both directions.
This commit is contained in:
Arkadiusz Fal
2026-07-17 09:27:09 +02:00
parent 6514cb426e
commit c2554cee04
4 changed files with 111 additions and 7 deletions

View File

@@ -495,7 +495,13 @@ final class MPVBackend: PlayerBackend {
// Load the stream
do {
try mpvClient?.loadFile(stream.url, audioURL: audioStream?.url, httpHeaders: stream.httpHeaders, useEDL: useEDL)
try mpvClient?.loadFile(
stream.url,
audioURL: audioStream?.url,
httpHeaders: stream.httpHeaders,
useEDL: useEDL,
disableVideoTrack: stream.requiresVideoTrackDisabled
)
// Give MPV a moment to process the loadfile command
try await Task.sleep(for: .milliseconds(100))