mirror of
https://github.com/yattee/yattee.git
synced 2024-12-12 21:30:32 +05:30
don’t activate AVAudioSession on app start
Signed-off-by: Toni Förster <toni.foerster@gmail.com>
This commit is contained in:
parent
740a2f85ac
commit
633af02577
@ -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
|
||||
|
@ -23,7 +23,6 @@ final class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||
// Configure the audio session for playback
|
||||
do {
|
||||
try AVAudioSession.sharedInstance().setCategory(.playback, mode: .moviePlayback)
|
||||
try AVAudioSession.sharedInstance().setActive(true)
|
||||
} catch {
|
||||
logger.error("Failed to set audio session category: \(error)")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user