1
0
mirror of https://github.com/yattee/yattee.git synced 2024-12-13 05:40:32 +05:30

Improve setting audio session

This commit is contained in:
Arkadiusz Fal 2022-08-26 22:44:02 +02:00
parent 8d912f2646
commit eedc8f32d1
4 changed files with 5 additions and 13 deletions

View File

@ -285,10 +285,6 @@ final class AVPlayerBackend: PlayerBackend {
}
let startPlaying = {
#if !os(macOS)
try? AVAudioSession.sharedInstance().setActive(true)
#endif
self.setRate(self.model.currentRate)
guard let item = self.model.playerItem, self.isAutoplaying(item) else { return }

View File

@ -192,10 +192,6 @@ final class MPVBackend: PlayerBackend {
}
let startPlaying = {
#if !os(macOS)
try? AVAudioSession.sharedInstance().setActive(true)
#endif
DispatchQueue.main.async { [weak self] in
guard let self = self else {
return

View File

@ -755,11 +755,6 @@ final class PlayerModel: ObservableObject {
remoteCommandCenterConfigured = true
#if !os(macOS)
try? AVAudioSession.sharedInstance().setCategory(
.playback,
mode: .moviePlayback
)
UIApplication.shared.beginReceivingRemoteControlEvents()
#endif

View File

@ -247,6 +247,11 @@ struct YatteeApp: App {
}
}
#endif
#if !os(macOS)
try? AVAudioSession.sharedInstance().setCategory(.playback)
try? AVAudioSession.sharedInstance().setActive(true)
#endif
}
func migrateAccounts() {