BookPlayer
BookPlayer copied to clipboard
Ability to choose how to handle notifications
Feature request
Ability to change the way how to handle the notification sounds
Narrative
Given that I for example drive and have a navigation app working, it gives voice guidance, and often small sounds signaling that I'm speeding for example. For every single of them, BookReader pauses, and "eats" half a second after resume.
It would be nice to have the ability to choose how to handle external sounds, pause, lower volume, completely ignore.
I've been looking through the options here and testing, I think we can have a new row in the 'Playback Settings' section for 'Audio'. The new screen will start having only the 'Mix' section with two rows with toggles, the first one will be about allowing audio mixing, the second one about ducking the audio of others, this second one will only be interact-able when the first one is enabled. The footer description for this section should specify that if the 'duck others' is disabled, then other audios can duck BookPlayer's sound, and if it's enabled, it will prevent the app audio from being ducked, and try to duck others, but won't be able to duck them if they also have the duck others specified.
This new audio options screen will be a good starting point for other feature requests related to audio like equalizer, background secondary audio track, etc
code reference to put into the PlayerManager
file
do {
let mode: AVAudioSession.Mode
let options: AVAudioSession.CategoryOptions
if UserDefaults.standard.bool(forKey: Constants.UserDefaults.allowPlaybackMixing.rawValue) {
mode = .default
if UserDefaults.standard.bool(forKey: Constants.UserDefaults.duckOthers.rawValue) {
options = [.mixWithOthers, .duckOthers]
} else {
options = [.mixWithOthers]
}
} else {
mode = .spokenAudio
options = []
}
try AVAudioSession.sharedInstance().setCategory(.playback, mode: mode, options: options)
try AVAudioSession.sharedInstance().setActive(true)
} catch {
fatalError("Failed to activate the audio session, \(error), description: \(error.localizedDescription)")
}
I'm seeing the same issue: where navigation instructions pausing the playback, and upon resume the playback position is further ahead than when it was paused. This is causing words to get dropped/missed and manual skip back is needed.
This request seems to be for a preference to configure this behavior, but other apps just handle this case and jump back a little when resuming. It wouldn't need the complication of creating a preference/options, just setting a standard "jump back" time to account for this.