mirror of
https://github.com/yattee/yattee.git
synced 2025-12-23 05:00:13 +00:00
feat: default lang and mpv audio track switching
This commit is contained in:
@@ -210,6 +210,14 @@ final class PlayerModel: ObservableObject {
|
||||
var keyPressMonitor: Any?
|
||||
#endif
|
||||
|
||||
@Published var selectedAudioTrackIndex = 0 {
|
||||
didSet {
|
||||
if oldValue != selectedAudioTrackIndex {
|
||||
handleAudioTrackChange()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
init() {
|
||||
#if os(iOS)
|
||||
isOrientationLocked = Defaults[.isOrientationLocked]
|
||||
@@ -1467,4 +1475,12 @@ final class PlayerModel: ObservableObject {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
private func handleAudioTrackChange() {
|
||||
(backend as? MPVBackend)?.switchAudioTrack(to: selectedAudioTrackIndex)
|
||||
}
|
||||
|
||||
var availableAudioTracks: [Stream.AudioTrack] {
|
||||
(backend as? MPVBackend)?.availableAudioTracks ?? []
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user