mirror of
https://github.com/yattee/yattee.git
synced 2024-12-22 21:43:41 +00:00
Improve setting audio session
This commit is contained in:
parent
60f38a80aa
commit
1cf37e5a00
@ -285,10 +285,6 @@ final class AVPlayerBackend: PlayerBackend {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let startPlaying = {
|
let startPlaying = {
|
||||||
#if !os(macOS)
|
|
||||||
try? AVAudioSession.sharedInstance().setActive(true)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
self.setRate(self.model.currentRate)
|
self.setRate(self.model.currentRate)
|
||||||
|
|
||||||
guard let item = self.model.playerItem, self.isAutoplaying(item) else { return }
|
guard let item = self.model.playerItem, self.isAutoplaying(item) else { return }
|
||||||
|
@ -192,10 +192,6 @@ final class MPVBackend: PlayerBackend {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let startPlaying = {
|
let startPlaying = {
|
||||||
#if !os(macOS)
|
|
||||||
try? AVAudioSession.sharedInstance().setActive(true)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
DispatchQueue.main.async { [weak self] in
|
DispatchQueue.main.async { [weak self] in
|
||||||
guard let self = self else {
|
guard let self = self else {
|
||||||
return
|
return
|
||||||
|
@ -755,11 +755,6 @@ final class PlayerModel: ObservableObject {
|
|||||||
remoteCommandCenterConfigured = true
|
remoteCommandCenterConfigured = true
|
||||||
|
|
||||||
#if !os(macOS)
|
#if !os(macOS)
|
||||||
try? AVAudioSession.sharedInstance().setCategory(
|
|
||||||
.playback,
|
|
||||||
mode: .moviePlayback
|
|
||||||
)
|
|
||||||
|
|
||||||
UIApplication.shared.beginReceivingRemoteControlEvents()
|
UIApplication.shared.beginReceivingRemoteControlEvents()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -247,6 +247,11 @@ struct YatteeApp: App {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !os(macOS)
|
||||||
|
try? AVAudioSession.sharedInstance().setCategory(.playback)
|
||||||
|
try? AVAudioSession.sharedInstance().setActive(true)
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
func migrateAccounts() {
|
func migrateAccounts() {
|
||||||
|
Loading…
Reference in New Issue
Block a user