I'm encountering an intriguing issue with interactive widgets and the AudioPlaybackIntent
on my device.
Specifically, my problem arises when the device is set to silent mode. Despite the silence setting, selecting the category .playback
continues to play sounds, which is the expected behaviour.
However, when I opt for alternative categories like .ambient
or .soloAmbient,
these widgets cease to produce sound, even when the device is in ringer mode.
I would appreciate any insights, solutions, or discussion on this matter within the Apple forum community.
// This code snippet allows audio to play in widgets with interactive buttons, even in silent mode.
try? AVAudioSession.sharedInstance().setCategory(.playback, mode: .default, options: [])
try? AVAudioSession.sharedInstance().setActive(true)
// Conversely, this code snippet prevents audio playback in widgets with interactive buttons, even in silent mode.
try? AVAudioSession.sharedInstance().setCategory(.ambient, mode: .default, options: [])
try? AVAudioSession.sharedInstance().setActive(true)
Works as expected on the Simulator, but encounters issues when tested on a physical device using Xcode 15 Beta 8