mirror of
https://github.com/yattee/yattee.git
synced 2024-12-22 13:33:42 +00:00
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
|
self.asset = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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 }
|
||||||
|
@ -245,6 +245,21 @@ final class MPVBackend: PlayerBackend {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let startPlaying = {
|
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
|
DispatchQueue.main.async { [weak self] in
|
||||||
guard let self else {
|
guard let self else {
|
||||||
return
|
return
|
||||||
|
@ -23,7 +23,6 @@ final class AppDelegate: UIResponder, UIApplicationDelegate {
|
|||||||
// Configure the audio session for playback
|
// Configure the audio session for playback
|
||||||
do {
|
do {
|
||||||
try AVAudioSession.sharedInstance().setCategory(.playback, mode: .moviePlayback)
|
try AVAudioSession.sharedInstance().setCategory(.playback, mode: .moviePlayback)
|
||||||
try AVAudioSession.sharedInstance().setActive(true)
|
|
||||||
} catch {
|
} catch {
|
||||||
logger.error("Failed to set audio session category: \(error)")
|
logger.error("Failed to set audio session category: \(error)")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user