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 = {
#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

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

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

View File

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