pub async fn player_switch_audio_track(
player: State<'_, PlayerStateWrapper>,
repository_manager: State<'_, RepositoryManagerWrapper>,
repository_handle: String,
stream_index: i32,
array_index: i32,
use_html5: bool,
current_position: Option<f64>,
media_source_id: Option<String>,
) -> Result<AudioTrackSwitchResponse, String>Expand description
Switch audio track - handles both HTML5 (stream reload) and native (direct switch) Note: Frontend should handle saving series preferences after this command succeeds
The split is the requirement: an HTML5 <video> element cannot be told to
change audio track, so the stream is re-opened at the chosen
AudioStreamIndex and the frontend seeks the reloaded element back to
position; a native backend (ExoPlayer) switches in place by track-group
index. libmpv implements neither — it is the audio-only backend here and
leaves PlayerBackend::set_audio_track at its not_implemented() default,
which is why IR-019 is met by these two paths rather than by MPV.
TRACES: UR-021 | IR-019, DR-024