Post

Replies

Boosts

Views

Activity

Reply to Background audio not playing on iPhone 13+
This is how I configure the AudioSession: await audioSessionIOS.configure(AudioSessionConfiguration( avAudioSessionCategory: AVAudioSessionCategory.playback, avAudioSessionMode: AVAudioSessionMode.defaultMode, avAudioSessionCategoryOptions: AVAudioSessionCategoryOptions.mixWithOthers)); I also tried adding listeners to begin/end interruptions, becomingNoisyEventStream, and devicesChangedEventStream. But error is still the same: 'prim' with category MediaPlayback and mode Default and mixable does not have assertions to start mixable playback 'prim'' has insufficient privileges to take control translating CM session error -16980 Operation denied. Cannot start playing PlatformException(561015905, Session activation failed, null, null) The error leads to https://developer.apple.com/documentation/avfaudio/avaudiosession/errorcode/cannotstartplaying. Which states: An error code that indicates an attempt to start audio playback when it wasn’t allowed. This error type can occur if the app’s Information property list doesn’t permit audio use. It can also occur if the app is in the background and using a category that doesn’t allow background audio. I'm sure I have the audio in UIBackgroundModes of Info.plist. And I'm sure it's in the right place. I'm saying this because I have ImageNotification extension, which receives the push notifications. But it doesn't execute the handle. It calls a separate isolate that is related to the main app process. I know this because I traced the packageName and appName to the main Info.plist and not the extension's Info.plist. The category is playback which should allow for background usage. Especially with mixWithOthers. But for some reason it has insufficient privileges to take control. Again, this doesn't happen on iPhone 6s. It works correctly with that real device. The error is on iPhone 13. We tested with different iOS versions. iPhone 6s has iOS 15.7.9. We tested on two iPhone 13 devices. One of them has iOS 15.6 which is lower than the 6's version.
Oct ’23