Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions LoopFollow/Controllers/AlarmSound.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class AlarmSound {
audioPlayer = try AVAudioPlayer(contentsOf: soundURL)
audioPlayer!.delegate = audioPlayerDelegate

try AVAudioSession.sharedInstance().setCategory(.playback, mode: .default, options: [])
try AVAudioSession.sharedInstance().setCategory(.playback, mode: .default, options: .duckOthers)
try AVAudioSession.sharedInstance().setActive(true)

audioPlayer?.numberOfLoops = 0
Expand Down Expand Up @@ -126,7 +126,7 @@ class AlarmSound {
audioPlayer = try AVAudioPlayer(contentsOf: soundURL)
audioPlayer!.delegate = audioPlayerDelegate

try AVAudioSession.sharedInstance().setCategory(.playback, mode: .default, options: [])
try AVAudioSession.sharedInstance().setCategory(.playback, mode: .default, options: .duckOthers)
try AVAudioSession.sharedInstance().setActive(true)

// Only use numberOfLoops if we're not using delay-based repeating
Expand Down Expand Up @@ -184,7 +184,7 @@ class AlarmSound {
audioPlayer = try AVAudioPlayer(contentsOf: soundURL)
audioPlayer!.delegate = audioPlayerDelegate

try AVAudioSession.sharedInstance().setCategory(.playback, mode: .default, options: [])
try AVAudioSession.sharedInstance().setCategory(.playback, mode: .default, options: .duckOthers)
try AVAudioSession.sharedInstance().setActive(true)

audioPlayer!.numberOfLoops = 0
Expand Down Expand Up @@ -213,7 +213,7 @@ class AlarmSound {
audioPlayer = try AVAudioPlayer(contentsOf: soundURL)
audioPlayer!.delegate = audioPlayerDelegate

try AVAudioSession.sharedInstance().setCategory(.playback, mode: .default, options: [])
try AVAudioSession.sharedInstance().setCategory(.playback, mode: .default, options: .duckOthers)
try AVAudioSession.sharedInstance().setActive(true)

// Play endless loops
Expand Down Expand Up @@ -262,7 +262,7 @@ class AlarmSound {

fileprivate static func enableAudio() {
do {
try AVAudioSession.sharedInstance().setCategory(.playback, mode: .default, options: [])
try AVAudioSession.sharedInstance().setCategory(.playback, mode: .default, options: .duckOthers)
try AVAudioSession.sharedInstance().setActive(true)
LogManager.shared.log(category: .alarm, message: "Audio session configured for alarm playback")
} catch {
Expand Down