Streaming from background
On Android, it is possible to continue streaming when app is in background. Unfortunately this functionality is not available on iOS (due to Apple limitations)
Below is configuration required to make it work:
- Expo
- Bare workflow
You need to modify app.json
file and add our plugin:
{
"expo": {
...
"plugins": {
...
[
"@fishjam-cloud/react-native-client",
{
"android": {
"enableForegroundService": true
}
}
],
...
}
}
}
You need to modify AndroidManifest.xml
file and add below service:
AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
...
<application ...>
...
<service android:name="io.fishjam.reactnative.FishjamForegroundService" android:foregroundServiceType="camera|microphone|mediaProjection"/>
</application>
</manifest>
Usage
- Android
- iOS
You can use useForegroundService
hook to handle how foreground service behaves on Android.
Permissions
If you want to use enableCamera
or enableMicrophone
,
user must first grant permission for this resource. useForegroundService
will check if permission is
granted and only then allow to start a service.
useForegroundService({
channelId: "io.fishjam.example.fishjamchat.foregroundservice.channel",
channelName: "Fishjam Chat Notifications",
notificationTitle: "Your video call is ongoing",
notificationContent: "Tap to return to the call.",
enableCamera: isCameraOn,
enableMicrophone: isMicrophoneOn,
});
This feature is unavailable on iOS.