Background Modes

When your app goes into the background, by default it can no longer access camera or microphone and publish it to other peers in the room. Also, you cannot hear audio of other participants in the call if your app is in the background without enabling Background Modes.

This is the default iOS platform behaviour whereby it limits access to Microphone & Camera for capturing Audio & Video. By default, iOS also stops playing audio of the Room when your app is in Background.

By Enabling Background Modes you can ensure that your iOS app has access to Microphone & can play incoming Audio from the Room.

Following steps show how to add Background Modes in iOS:

Add Capability

Click on your project in Navigator then select your app target under TARGETS and click on Signing & Capabilities and add Capability.

addCapability

Background Mode

Search background mode and add it to project by clicking on it.

backgroundMode

Enable Background Mode

Enable the checkbox under Background Modes named Audio, AirPlay, and Picture in Picture.

backgroundProcessing

Let's look at different scenarios on iOS with & without Enabling Background Modes.

Without Background Modes Enabled (Default iOS Behaviour)

The table lists down iOS app behaviours when the app transitions to background when a 100ms Room is ongoing without enabling background processing.

The "Scenario" on the left of the Table below implies the activity which is ongoing in the App when user has joined a 100ms Room.

The "Behaviours" on the right of the Table shows what happens when the App transitions to Background.

ScenarioBehaviours
Mic is UnmutedMic will get Muted
Camera is unmutedCamera will get Muted
Remote Peers are publishing audioIncoming Audio from Room Stops Playing

The table lists down iOS app behaviours when the app transitions to background when a 100ms Room is ongoing with Background Modes Enabled.

The "Scenario" on the left of the Table below implies the activity which is ongoing in the App when user has joined a 100ms Room.

The "Behaviours" on the right of the Table shows what happens when the App transitions to Background.

ScenarioBehaviours
Mic is unmutedMic will remain Unmuted and the user will able to publish audio without any restriction
Camera is unmutedCamera will get Muted
Remote Peers are publishing audioIncoming Audio from Room Continues to Play

👀 To see an example iOS app that uses background mode and 100ms SDK, checkout our example project.


Have a suggestion? Recommend changes ->

Was this helpful?

1234