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

Revert "Improve setting audio session"

This reverts commit eedc8f32d1.

Fix #307
This commit is contained in:
Arkadiusz Fal 2022-09-23 20:36:10 +02:00
parent cc60011cc6
commit a7a3e0827d
4 changed files with 13 additions and 5 deletions

View File

@ -276,6 +276,10 @@ 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

@ -182,6 +182,10 @@ 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

@ -714,6 +714,11 @@ 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

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