You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docusaurus/docs/Flutter/05-advanced/03-screen-sharing.mdx
+35-8Lines changed: 35 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -46,11 +46,11 @@ If you use our UI components you can also add `ToggleScreenShareOption` as one o
46
46
When the method is invoked, ReplayKit will ask for the user's consent that their screen will be shared. Only after the permission is granted, the screensharing starts.
47
47
48
48
#### Broadcasting
49
-
In most cases, you would need to share your screen while you are in the background, to be able to open other apps. For this, you need to create a Broadcast Upload Extension.
49
+
In most cases, you would need to share your screen while the app is in the background, to be able to open other apps. For this, you need to create a Broadcast Upload Extension.
50
50
51
51
##### Toggle screen sharing with broadcast mode
52
52
53
-
If you want to start screen sharing in broadcast mode on iOS you will need to toggle on using `ScreenShareConstraints`. Just set the flag to true inside `ToggleScreenShareOption` or when you use `call.setScreenShareEnabled()` directly.
53
+
If you want to start screen sharing in broadcast mode on iOS you will need to toggle it by setting `useiOSBroadcastExtension` flag to true in `ScreenShareConstraints`. You can set the constraints inside `ToggleScreenShareOption` or when you use `call.setScreenShareEnabled()` directly.
iOS requires the use of Broadcast Upload Extensions to facilitate screen sharing when your app is in the background. This extension provides the necessary framework to handle capturing and broadcasting the screen content.
76
+
75
77
Now add the extension, without UI, to your project in Xcode:
You can customize the screen sharing behavior by providing `ScreenShareConstraints` to the `ToggleScreenShareOption` widget or `setScreenShareEnabled()` method.
195
+
196
+
You can specify the following settings:
197
+
198
+
-`useiOSBroadcastExtension` - Set to `true` to enable broadcast mode on iOS.
199
+
200
+
-`captureScreenAudio` - Set to `true` to capture audio from the screen.
201
+
202
+
-`sourceId` - The device ID of an audio source, if you want to capture audio from a specific source.
203
+
204
+
-`maxFrameRate` - The maximum frame rate for the screen sharing video.
205
+
206
+
-`params` - The video parameters for the screen sharing video.
207
+
208
+
For `params` you can use one of our predefined presets in `RtcVideoParametersPresets`.
Copy file name to clipboardExpand all lines: docusaurus/docs/Flutter/05-advanced/04-picture-in-picture.mdx
+84-27Lines changed: 84 additions & 27 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,41 +6,19 @@ title: Picture in Picture (PiP)
6
6
7
7
Picture in picture (PIP) keeps the call running and visible while you navigate to other apps.
8
8
9
-
:::info
10
-
At the moment Picture in Picture is only supported on Android.
11
-
:::
12
-
13
9
### Enable Picture-in-Picture
14
-
You can enable Picture in Picture by setting the `enablePictureInPicture` property to `true` in the `StreamCallContainer` or `StreamCallContent` widget.
10
+
You can enable Picture in Picture by setting the `enablePictureInPicture` property to `true` in the `PictureInPictureConfiguration` provided to `StreamCallContainer` or `StreamCallContent` widget.
To enable Picture in Picture on Android, you need to add the following configuration to your `AndroidManifest.xml` file.
@@ -67,6 +45,85 @@ class MainActivity: FlutterActivity() {
67
45
}
68
46
```
69
47
48
+
### Android Customization
49
+
50
+
For Android, you can customize the widget rendered while app is in Picture-in-Picture mode by providing `callPictureInPictureBuilder` to `PictureInPictureConfiguration`.
By default iOS is not allowing usage of local camera feed when app is in the background. That includes Picture in picture mode and Split View mode. To enable it you need to request the [multitasking-camera-access](https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_developer_avfoundation_multitasking-camera-access) permission directly from Apple (this will change from iOS 18).
81
+
If you already have the permission you have to enable local feed support in our PiP implementation by setting `ignoreLocalParticipantVideo` to `false`.
### Enabling PiP support with custom call content widget
106
+
107
+
If you are not using our `StreamCallContent` and instead building custom call content widget you can still enable Picture in Picture mode by adding `StreamPictureInPictureUiKitView` anywhere in the widget tree. This widget will handle the Picture in Picture mode in iOS for you.
108
+
109
+
```dart
110
+
StreamCallContainer(
111
+
call: widget.call,
112
+
callContentBuilder: (
113
+
BuildContext context,
114
+
Call call,
115
+
CallState callState,
116
+
) {
117
+
return Stack(
118
+
children: [
119
+
StreamPictureInPictureUiKitView(call: call),
120
+
// YOUR CUSTOM WIDGET
121
+
],
122
+
);
123
+
},
124
+
);
125
+
```
126
+
70
127
Done. Now after leaving the app, you'll see that the call will be still alive in the background like the one below:
71
128
72
129

0 commit comments