1
0
mirror of https://github.com/yattee/yattee.git synced 2024-12-13 22:00:31 +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 = { 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 }

View File

@ -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

View File

@ -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

View File

@ -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() {