File tree Expand file tree Collapse file tree 4 files changed +15
-4
lines changed
java/com/livekit/reactnative
example/android/app/src/main Expand file tree Collapse file tree 4 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -295,6 +295,12 @@ Enabling screenshare requires extra installation steps:
295
295
296
296
Android screenshare requires a foreground service with type ` mediaProjection ` to be present.
297
297
298
+ From 2.4.0 onwards, this is handled internally and no extra setup is required.
299
+
300
+ ---
301
+
302
+ On versions prior to 2.4.0, you must declare your own foreground service.
303
+
298
304
The example app uses [ @supersami/rn-foreground-service ] ( https://github.com/Raja0sama/rn-foreground-service ) for this.
299
305
300
306
Add the following permissions to your ` AndroidManifest.xml ` file:
Original file line number Diff line number Diff line change 10
10
<uses-permission android : name =" android.permission.WAKE_LOCK" />
11
11
<uses-permission android : name =" android.permission.BLUETOOTH" />
12
12
<uses-permission android : name =" android.permission.BLUETOOTH_ADMIN" />
13
+ <uses-permission android : name =" android.permission.FOREGROUND_SERVICE" />
14
+ <uses-permission android : name =" android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION" />
13
15
</manifest >
Original file line number Diff line number Diff line change @@ -30,10 +30,14 @@ object LiveKitReactNative {
30
30
*/
31
31
@JvmStatic
32
32
@JvmOverloads
33
- fun setup (context : Context , audioType : AudioType = AudioType .CommunicationAudioType ()) {
33
+ fun setup (
34
+ context : Context ,
35
+ audioType : AudioType = AudioType .CommunicationAudioType ()
36
+ ) {
34
37
val options = WebRTCModuleOptions .getInstance()
35
38
options.videoEncoderFactory = CustomVideoEncoderFactory (null , true , true )
36
39
options.videoDecoderFactory = CustomVideoDecoderFactory ()
40
+ options.enableMediaProjectionService = true
37
41
38
42
val useHardwareAudioProcessing = Build .VERSION .SDK_INT >= Build .VERSION_CODES .Q
39
43
Original file line number Diff line number Diff line change 9
9
<uses-permission android : name =" android.permission.SYSTEM_ALERT_WINDOW" />
10
10
<uses-permission android : name =" android.permission.WAKE_LOCK" />
11
11
<uses-permission android : name =" android.permission.FOREGROUND_SERVICE" />
12
- <uses-permission android : name =" android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION" />
13
-
12
+ <uses-permission android : name =" android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" />
14
13
<application
15
14
android : name =" .MainApplication"
16
15
android : label =" @string/app_name"
40
39
android : value =" "
41
40
/>
42
41
<service android : name =" com.supersami.foregroundservice.ForegroundService"
43
- android : foregroundServiceType =" mediaProjection " />
42
+ android : foregroundServiceType =" mediaPlayback " />
44
43
<service android : name =" com.supersami.foregroundservice.ForegroundServiceTask" />
45
44
<service android : name =" com.voximplant.foregroundservice.VIForegroundService" />
46
45
</application >
You can’t perform that action at this time.
0 commit comments