How sonos IOS app works streaming in background? - ios

How sonos IOS app works streaming in background?
They are using Airplay or another technique?

Sonos is not sending the audio from the device to the speaker - the speaker makes the request directly. This passes the "beer run test" which allows you to leave with you phone with interrupting the music that others are listening to.

Related

Background Audio mode with MPMusicPlayerController.systemMusicPlayer

I'm working on an iOS app that uses MPMusicPlayerController.systemMusicPlayer to play songs from Apple Music to the user.
My app should be able to append songs to the Music player's queue based on messages it receives from a server. I have this working with a simple WebSocket connection between the app and the server, but as soon as the app enters the background the socket is automatically closed (which makes sense).
Because the actual music playback is done by the Music app, I can't use the Background Audio background mode to keep my app alive. Is there a way around this?
Things I have already considered (and why I don't think they will work):
Remote Notifications are throttled too slow to be of any real use
Background App Refresh is also too slow
PushKit / VoIP (the app isn't a VoIP app)
Playing "blank" or nearly silent audio over the actual audio which seems too "hacky" and likely won't pass app review
Using background location tracking (again, almost certainly won't pass review)
Ditching systemMusicPlayer completely and using AVAudioPlayer with the Apple Music API (this would be reinventing the wheel a little bit and would force streaming even if the media was downloaded)
Using applicationQueuePlayer and just forcing the user to stay in app (this would be a bad user experience imo, they should be able to listen in the background)
Any help would be appreciated, thank you!
In iOS 15 and later, you should be able to just set the background plist flag for your app, and then just use ApplicationMusicPlayer.
https://developer.apple.com/documentation/musickit/applicationmusicplayer

Using Vidyo and Callkit on iOS - Audio question

I've integrated Vidyo with CallKit on iOS for VOIP, except for one issue: Audio is sometimes muted on connection, and either needs the microphone toggled twice, or stays muted. I'm using the Vidyo.io resource to connect. I know that Apple has special calls to enhance audio when using voip protocols, but I do not call these, because I think Vidyo is handling the audio here (plus I don't know what to call!). Has anyone successfully integrated CallKit into Vidyo, and, if so, what do you do for Configure AVAudioSession?

AVAudioSession not working when receiving a VOIP/SIP Call on iOS. WebRTC | SIP

We have audio video calling feature in the application. When I make a call to an android device then both the sender and receiver can hear the voices. However, when the call is received at the iOS device, there is no sound of voice anywhere.

Tokbox iOS: Video call disconnects when phone lock

I am using tokbox for video calling in my iOS application. I am getting the issue when while video calling, when I lock the app, the stream gets disconnected and the call ends.
This documentation outlines running TokBox in the background, i.e. when the phone is locked. The following is an excerpt from the limitations of running TokBox in the background:
Apps cannot do the following while in the background state:
Use the camera as a video source for a publisher.
The documentation goes on to explain that you can keep an audio-only session active when running in the background, but not a video session.

How to tell when your iPhone audio is being rerouted to an external device?

I would like to be notified when my iPhone's audio is being re-routed to another device , say if I connect it to an external Hi-fi system (an MFi device). Put another way, how do I detect if the audio is playing from my iPhone vs. another device when it happens?
How should I go about doing this?
Read Apple's Audio Session documentation on how to request and handle Audio Session route change notifications, and what kind of audio notifications are possible.

Resources