mirror of
https://github.com/yattee/yattee.git
synced 2025-08-06 10:44:06 +00:00
don’t activate AVAudioSession on app start
Signed-off-by: Toni Förster <toni.foerster@gmail.com>
This commit is contained in:
@@ -362,8 +362,11 @@ final class AVPlayerBackend: PlayerBackend {
|
||||
self.asset = nil
|
||||
}
|
||||
|
||||
|
||||
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 }
|
||||
|
@@ -245,6 +245,21 @@ final class MPVBackend: PlayerBackend {
|
||||
}
|
||||
|
||||
let startPlaying = {
|
||||
#if !os(macOS)
|
||||
do {
|
||||
try AVAudioSession.sharedInstance().setActive(true)
|
||||
|
||||
NotificationCenter.default.addObserver(
|
||||
self,
|
||||
selector: #selector(self.handleAudioSessionInterruption(_:)),
|
||||
name: AVAudioSession.interruptionNotification,
|
||||
object: nil
|
||||
)
|
||||
} catch {
|
||||
self.logger.error("Error setting up audio session: \(error)")
|
||||
}
|
||||
#endif
|
||||
|
||||
DispatchQueue.main.async { [weak self] in
|
||||
guard let self else {
|
||||
return
|
||||
|
Reference in New Issue
Block a user