Browse Source

feat(android) set target SDK to 34 (#14129)

* feat(android) set target SDK to 34 and fixed mediaProjection service type
factor2
Saúl Ibarra Corretgé 1 year ago
parent
commit
f8cef330f7
No account linked to committer's email address

+ 6
- 3
android/app/build.gradle View File

@@ -15,11 +15,13 @@ def vcode = (int) (((new Date().getTime() / 1000) - 1546297200) / 10)
15 15
 android {
16 16
     compileSdkVersion rootProject.ext.compileSdkVersion
17 17
     buildToolsVersion rootProject.ext.buildToolsVersion
18
-
19 18
     packagingOptions {
20
-        exclude 'lib/*/libhermes*.so'
19
+        jniLibs {
20
+            excludes += ['lib/*/libhermes*.so']
21
+        }
21 22
     }
22 23
 
24
+
23 25
     defaultConfig {
24 26
         applicationId 'org.jitsi.meet'
25 27
         versionCode vcode
@@ -72,12 +74,13 @@ android {
72 74
         sourceCompatibility JavaVersion.VERSION_1_8
73 75
         targetCompatibility JavaVersion.VERSION_1_8
74 76
     }
77
+    namespace 'org.jitsi.meet'
75 78
 }
76 79
 
77 80
 dependencies {
78 81
     implementation 'androidx.appcompat:appcompat:1.5.1'
79 82
 
80
-    debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.7'
83
+    debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.13'
81 84
 
82 85
     if (!rootProject.ext.libreBuild) {
83 86
         // Sync with react-native-google-signin

+ 0
- 1
android/app/src/main/AndroidManifest.xml View File

@@ -1,6 +1,5 @@
1 1
 <manifest
2 2
     xmlns:android="http://schemas.android.com/apk/res/android"
3
-    package="org.jitsi.meet"
4 3
     android:installLocation="auto">
5 4
   <application
6 5
       android:allowBackup="true"

+ 3
- 3
android/build.gradle View File

@@ -10,7 +10,7 @@ buildscript {
10 10
         mavenCentral()
11 11
     }
12 12
     dependencies {
13
-        classpath 'com.android.tools.build:gradle:7.3.1'
13
+        classpath 'com.android.tools.build:gradle:7.4.2'
14 14
         classpath 'com.google.gms:google-services:4.4.0'
15 15
         classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.9'
16 16
     }
@@ -19,9 +19,9 @@ buildscript {
19 19
 ext {
20 20
     kotlinVersion = "1.7.0"
21 21
     buildToolsVersion = "33.0.2"
22
-    compileSdkVersion = 33
22
+    compileSdkVersion = 34
23 23
     minSdkVersion    = 24
24
-    targetSdkVersion = 33
24
+    targetSdkVersion = 34
25 25
     supportLibVersion = "28.0.0"
26 26
 
27 27
     // We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.

+ 1
- 0
android/sdk/build.gradle View File

@@ -30,6 +30,7 @@ android {
30 30
             }
31 31
         }
32 32
     }
33
+    namespace 'org.jitsi.meet.sdk'
33 34
 }
34 35
 
35 36
 dependencies {

+ 8
- 3
android/sdk/src/main/AndroidManifest.xml View File

@@ -1,7 +1,6 @@
1 1
 <?xml version="1.0" encoding="utf-8"?>
2 2
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
3
-    xmlns:tools="http://schemas.android.com/tools"
4
-    package="org.jitsi.meet.sdk">
3
+    xmlns:tools="http://schemas.android.com/tools">
5 4
     <!-- XXX ACCESS_NETWORK_STATE is required by WebRTC. -->
6 5
     <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
7 6
     <uses-permission android:name="android.permission.BLUETOOTH" />
@@ -13,6 +12,8 @@
13 12
     <uses-permission android:name="android.permission.WAKE_LOCK" />
14 13
     <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
15 14
     <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
15
+    <uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION" />
16
+    <uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" />
16 17
 
17 18
     <uses-feature
18 19
         android:glEsVersion="0x00020000"
@@ -48,6 +49,10 @@
48 49
 
49 50
         <service
50 51
             android:name="org.jitsi.meet.sdk.JitsiMeetOngoingConferenceService"
52
+            android:foregroundServiceType="mediaPlayback" />
53
+
54
+        <service
55
+            android:name="org.jitsi.meet.sdk.JitsiMeetMediaProjectionService"
51 56
             android:foregroundServiceType="mediaProjection" />
52 57
 
53 58
         <provider
@@ -66,4 +71,4 @@
66 71
 
67 72
     </application>
68 73
 
69
-</manifest>
74
+</manifest>

+ 42
- 0
android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetMediaProjectionModule.java View File

@@ -0,0 +1,42 @@
1
+package org.jitsi.meet.sdk;
2
+
3
+import android.content.Context;
4
+
5
+import androidx.annotation.NonNull;
6
+
7
+import com.facebook.react.bridge.ReactApplicationContext;
8
+import com.facebook.react.bridge.ReactContextBaseJavaModule;
9
+import com.facebook.react.bridge.ReactMethod;
10
+import com.facebook.react.module.annotations.ReactModule;
11
+
12
+
13
+@ReactModule(name = JitsiMeetMediaProjectionModule.NAME)
14
+class JitsiMeetMediaProjectionModule
15
+    extends ReactContextBaseJavaModule {
16
+
17
+    public static final String NAME = "JitsiMeetMediaProjectionModule";
18
+
19
+    public JitsiMeetMediaProjectionModule(ReactApplicationContext reactContext) {
20
+        super(reactContext);
21
+    }
22
+
23
+    @ReactMethod
24
+    public void launch() {
25
+        Context context = getReactApplicationContext();
26
+
27
+        JitsiMeetMediaProjectionService.launch(context);
28
+    }
29
+
30
+    @ReactMethod
31
+    public void abort() {
32
+        Context context = getReactApplicationContext();
33
+
34
+        JitsiMeetMediaProjectionService.abort(context);
35
+    }
36
+
37
+    @NonNull
38
+    @Override
39
+    public String getName() {
40
+        return NAME;
41
+    }
42
+}

+ 100
- 0
android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetMediaProjectionService.java View File

@@ -0,0 +1,100 @@
1
+/*
2
+ * Copyright @ 2019-present 8x8, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ *     http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+package org.jitsi.meet.sdk;
18
+
19
+
20
+import android.app.Notification;
21
+import android.app.Service;
22
+import android.content.ComponentName;
23
+import android.content.Context;
24
+import android.content.Intent;
25
+import android.content.pm.ServiceInfo;
26
+import android.os.Build;
27
+import android.os.IBinder;
28
+
29
+import org.jitsi.meet.sdk.log.JitsiMeetLogger;
30
+
31
+
32
+/**
33
+ * This class implements an Android {@link Service}, a foreground one specifically, and it's
34
+ * responsible for presenting an ongoing notification when a conference is in progress.
35
+ * The service will help keep the app running while in the background.
36
+ *
37
+ * See: https://developer.android.com/guide/components/services
38
+ */
39
+public class JitsiMeetMediaProjectionService extends Service {
40
+    private static final String TAG = JitsiMeetMediaProjectionService.class.getSimpleName();
41
+
42
+    public static void launch(Context context) {
43
+        OngoingNotification.createOngoingConferenceNotificationChannel();
44
+
45
+        Intent intent = new Intent(context, JitsiMeetMediaProjectionService.class);
46
+
47
+        ComponentName componentName;
48
+
49
+        try {
50
+            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
51
+                componentName = context.startForegroundService(intent);
52
+            } else {
53
+                componentName = context.startService(intent);
54
+            }
55
+        } catch (RuntimeException e) {
56
+            // Avoid crashing due to ForegroundServiceStartNotAllowedException (API level 31).
57
+            // See: https://developer.android.com/guide/components/foreground-services#background-start-restrictions
58
+            JitsiMeetLogger.w(TAG + " Ongoing conference service not started", e);
59
+            return;
60
+        }
61
+
62
+        if (componentName == null) {
63
+            JitsiMeetLogger.w(TAG + " Ongoing conference service not started");
64
+        }
65
+    }
66
+
67
+    public static void abort(Context context) {
68
+        Intent intent = new Intent(context, JitsiMeetMediaProjectionService.class);
69
+        context.stopService(intent);
70
+    }
71
+
72
+    @Override
73
+    public void onCreate() {
74
+        super.onCreate();
75
+
76
+        Notification notification = OngoingNotification.buildOngoingConferenceNotification(null);
77
+
78
+        if (notification == null) {
79
+            stopSelf();
80
+            JitsiMeetLogger.w(TAG + " Couldn't start service, notification is null");
81
+        }
82
+
83
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
84
+            startForeground(OngoingNotification.NOTIFICATION_ID, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION);
85
+        } else {
86
+            startForeground(OngoingNotification.NOTIFICATION_ID, notification);
87
+        }
88
+    }
89
+
90
+    @Override
91
+    public IBinder onBind(Intent intent) {
92
+        return null;
93
+    }
94
+
95
+    @Override
96
+    public int onStartCommand(Intent intent, int flags, int startId) {
97
+
98
+        return START_NOT_STICKY;
99
+    }
100
+}

+ 6
- 2
android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiMeetOngoingConferenceService.java View File

@@ -23,6 +23,7 @@ import android.content.ComponentName;
23 23
 import android.content.Context;
24 24
 import android.content.Intent;
25 25
 import android.content.IntentFilter;
26
+import android.content.pm.ServiceInfo;
26 27
 import android.os.Build;
27 28
 import android.os.Bundle;
28 29
 import android.os.IBinder;
@@ -94,8 +95,11 @@ public class JitsiMeetOngoingConferenceService extends Service
94 95
             stopSelf();
95 96
             JitsiMeetLogger.w(TAG + " Couldn't start service, notification is null");
96 97
         } else {
97
-            startForeground(OngoingNotification.NOTIFICATION_ID, notification);
98
-            JitsiMeetLogger.i(TAG + " Service started");
98
+            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
99
+                startForeground(OngoingNotification.NOTIFICATION_ID, notification, ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK);
100
+            } else {
101
+                startForeground(OngoingNotification.NOTIFICATION_ID, notification);
102
+            }
99 103
         }
100 104
 
101 105
         OngoingConferenceTracker.getInstance().addListener(this);

+ 6
- 2
android/sdk/src/main/java/org/jitsi/meet/sdk/OngoingNotification.java View File

@@ -73,7 +73,7 @@ class OngoingNotification {
73 73
         notificationManager.createNotificationChannel(channel);
74 74
     }
75 75
 
76
-    static Notification buildOngoingConferenceNotification(boolean isMuted) {
76
+    static Notification buildOngoingConferenceNotification(Boolean isMuted) {
77 77
         Context context = ReactInstanceManagerHolder.getCurrentActivity();
78 78
         if (context == null) {
79 79
             JitsiMeetLogger.w(TAG + " Cannot create notification: no current context");
@@ -92,7 +92,7 @@ class OngoingNotification {
92 92
         builder
93 93
             .setCategory(NotificationCompat.CATEGORY_CALL)
94 94
             .setContentTitle(context.getString(R.string.ongoing_notification_title))
95
-            .setContentText(context.getString(R.string.ongoing_notification_text))
95
+            .setContentText(isMuted != null ? context.getString(R.string.ongoing_notification_text) : context.getString(R.string.ongoing_notification_action_screenshare))
96 96
             .setPriority(NotificationCompat.PRIORITY_DEFAULT)
97 97
             .setContentIntent(pendingIntent)
98 98
             .setOngoing(true)
@@ -103,6 +103,10 @@ class OngoingNotification {
103 103
             .setOnlyAlertOnce(true)
104 104
             .setSmallIcon(context.getResources().getIdentifier("ic_notification", "drawable", context.getPackageName()));
105 105
 
106
+        if (isMuted == null) {
107
+            return builder.build();
108
+        }
109
+
106 110
         NotificationCompat.Action hangupAction = createAction(context, JitsiMeetOngoingConferenceService.Action.HANGUP, R.string.ongoing_notification_action_hang_up);
107 111
 
108 112
         JitsiMeetOngoingConferenceService.Action toggleAudioAction = isMuted

+ 1
- 0
android/sdk/src/main/java/org/jitsi/meet/sdk/ReactInstanceManagerHolder.java View File

@@ -67,6 +67,7 @@ class ReactInstanceManagerHolder {
67 67
                 new DropboxModule(reactContext),
68 68
                 new ExternalAPIModule(reactContext),
69 69
                 new JavaScriptSandboxModule(reactContext),
70
+                new JitsiMeetMediaProjectionModule(reactContext),
70 71
                 new LocaleDetector(reactContext),
71 72
                 new LogBridgeModule(reactContext),
72 73
                 new SplashScreenModule(reactContext),

+ 1
- 0
android/sdk/src/main/res/values/strings.xml View File

@@ -5,6 +5,7 @@
5 5
     <string name="ongoing_notification_text">You are currently in a meeting. Tap to return to it.</string>
6 6
     <string name="ongoing_notification_action_hang_up">Hang up</string>
7 7
     <string name="ongoing_notification_action_mute">Mute</string>
8
+    <string name="ongoing_notification_action_screenshare">You are currently screen-sharing. Tap to return to the meeting.</string>
8 9
     <string name="ongoing_notification_action_unmute">Unmute</string>
9 10
     <string name="ongoing_notification_channel_name">Ongoing Conference Notifications</string>
10 11
 </resources>

+ 10
- 56
package-lock.json View File

@@ -97,7 +97,7 @@
97 97
         "react-native-svg-transformer": "1.1.0",
98 98
         "react-native-tab-view": "3.5.2",
99 99
         "react-native-url-polyfill": "2.0.0",
100
-        "react-native-video": "6.0.0-alpha.7",
100
+        "react-native-video": "6.0.0-alpha.11",
101 101
         "react-native-watch-connectivity": "1.1.0",
102 102
         "react-native-webrtc": "118.0.0",
103 103
         "react-native-webview": "13.5.1",
@@ -5574,11 +5574,6 @@
5574 5574
         }
5575 5575
       }
5576 5576
     },
5577
-    "node_modules/@react-native/normalize-color": {
5578
-      "version": "2.1.0",
5579
-      "resolved": "https://registry.npmjs.org/@react-native/normalize-color/-/normalize-color-2.1.0.tgz",
5580
-      "integrity": "sha512-Z1jQI2NpdFJCVgpY+8Dq/Bt3d+YUi1928Q+/CZm/oh66fzM0RUl54vvuXlPJKybH4pdCZey1eDTPaLHkMPNgWA=="
5581
-    },
5582 5577
     "node_modules/@react-native/normalize-colors": {
5583 5578
       "version": "0.72.0",
5584 5579
       "resolved": "https://registry.npmjs.org/@react-native/normalize-colors/-/normalize-colors-0.72.0.tgz",
@@ -9335,16 +9330,6 @@
9335 9330
         "node": ">= 0.6"
9336 9331
       }
9337 9332
     },
9338
-    "node_modules/deprecated-react-native-prop-types": {
9339
-      "version": "2.3.0",
9340
-      "resolved": "https://registry.npmjs.org/deprecated-react-native-prop-types/-/deprecated-react-native-prop-types-2.3.0.tgz",
9341
-      "integrity": "sha512-pWD0voFtNYxrVqvBMYf5gq3NA2GCpfodS1yNynTPc93AYA/KEMGeWDqqeUB6R2Z9ZofVhks2aeJXiuQqKNpesA==",
9342
-      "dependencies": {
9343
-        "@react-native/normalize-color": "*",
9344
-        "invariant": "*",
9345
-        "prop-types": "*"
9346
-      }
9347
-    },
9348 9333
     "node_modules/destroy": {
9349 9334
       "version": "1.0.4",
9350 9335
       "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz",
@@ -12872,11 +12857,6 @@
12872 12857
         "rollup": ">= 1.0.0"
12873 12858
       }
12874 12859
     },
12875
-    "node_modules/keymirror": {
12876
-      "version": "0.1.1",
12877
-      "resolved": "https://registry.npmjs.org/keymirror/-/keymirror-0.1.1.tgz",
12878
-      "integrity": "sha512-vIkZAFWoDijgQT/Nvl2AHCMmnegN2ehgTPYuyy2hWQkQSntI0S7ESYqdLkoSe1HyEBFHHkCgSIvVdSEiWwKvCg=="
12879
-    },
12880 12860
     "node_modules/kind-of": {
12881 12861
       "version": "6.0.3",
12882 12862
       "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz",
@@ -16953,13 +16933,12 @@
16953 16933
       }
16954 16934
     },
16955 16935
     "node_modules/react-native-video": {
16956
-      "version": "6.0.0-alpha.7",
16957
-      "resolved": "https://registry.npmjs.org/react-native-video/-/react-native-video-6.0.0-alpha.7.tgz",
16958
-      "integrity": "sha512-X/siSaJf0V//IbnozjDm1jAjNaXlFy6Hbr6X8GNFl/ztLvN+Z8R/Quq9Q8o22XVwlPacPQ9VS/G0Stdktn0FEw==",
16959
-      "dependencies": {
16960
-        "deprecated-react-native-prop-types": "^2.2.0",
16961
-        "keymirror": "^0.1.1",
16962
-        "prop-types": "^15.7.2"
16936
+      "version": "6.0.0-alpha.11",
16937
+      "resolved": "https://registry.npmjs.org/react-native-video/-/react-native-video-6.0.0-alpha.11.tgz",
16938
+      "integrity": "sha512-Z1FqIkNBqQWdBVKoh5WlmM01LIVhxlOsddKVV9IzMJ3EDl8PAU4ln7hdo85RHCHhgWSHzathPDo0UK7gPB48MA==",
16939
+      "peerDependencies": {
16940
+        "react": "*",
16941
+        "react-native": "*"
16963 16942
       }
16964 16943
     },
16965 16944
     "node_modules/react-native-watch-connectivity": {
@@ -23970,11 +23949,6 @@
23970 23949
         }
23971 23950
       }
23972 23951
     },
23973
-    "@react-native/normalize-color": {
23974
-      "version": "2.1.0",
23975
-      "resolved": "https://registry.npmjs.org/@react-native/normalize-color/-/normalize-color-2.1.0.tgz",
23976
-      "integrity": "sha512-Z1jQI2NpdFJCVgpY+8Dq/Bt3d+YUi1928Q+/CZm/oh66fzM0RUl54vvuXlPJKybH4pdCZey1eDTPaLHkMPNgWA=="
23977
-    },
23978 23952
     "@react-native/normalize-colors": {
23979 23953
       "version": "0.72.0",
23980 23954
       "resolved": "https://registry.npmjs.org/@react-native/normalize-colors/-/normalize-colors-0.72.0.tgz",
@@ -26841,16 +26815,6 @@
26841 26815
       "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
26842 26816
       "integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak="
26843 26817
     },
26844
-    "deprecated-react-native-prop-types": {
26845
-      "version": "2.3.0",
26846
-      "resolved": "https://registry.npmjs.org/deprecated-react-native-prop-types/-/deprecated-react-native-prop-types-2.3.0.tgz",
26847
-      "integrity": "sha512-pWD0voFtNYxrVqvBMYf5gq3NA2GCpfodS1yNynTPc93AYA/KEMGeWDqqeUB6R2Z9ZofVhks2aeJXiuQqKNpesA==",
26848
-      "requires": {
26849
-        "@react-native/normalize-color": "*",
26850
-        "invariant": "*",
26851
-        "prop-types": "*"
26852
-      }
26853
-    },
26854 26818
     "destroy": {
26855 26819
       "version": "1.0.4",
26856 26820
       "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz",
@@ -29474,11 +29438,6 @@
29474 29438
         "debounce": "^1.2.0"
29475 29439
       }
29476 29440
     },
29477
-    "keymirror": {
29478
-      "version": "0.1.1",
29479
-      "resolved": "https://registry.npmjs.org/keymirror/-/keymirror-0.1.1.tgz",
29480
-      "integrity": "sha512-vIkZAFWoDijgQT/Nvl2AHCMmnegN2ehgTPYuyy2hWQkQSntI0S7ESYqdLkoSe1HyEBFHHkCgSIvVdSEiWwKvCg=="
29481
-    },
29482 29441
     "kind-of": {
29483 29442
       "version": "6.0.3",
29484 29443
       "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz",
@@ -32442,14 +32401,9 @@
32442 32401
       }
32443 32402
     },
32444 32403
     "react-native-video": {
32445
-      "version": "6.0.0-alpha.7",
32446
-      "resolved": "https://registry.npmjs.org/react-native-video/-/react-native-video-6.0.0-alpha.7.tgz",
32447
-      "integrity": "sha512-X/siSaJf0V//IbnozjDm1jAjNaXlFy6Hbr6X8GNFl/ztLvN+Z8R/Quq9Q8o22XVwlPacPQ9VS/G0Stdktn0FEw==",
32448
-      "requires": {
32449
-        "deprecated-react-native-prop-types": "^2.2.0",
32450
-        "keymirror": "^0.1.1",
32451
-        "prop-types": "^15.7.2"
32452
-      }
32404
+      "version": "6.0.0-alpha.11",
32405
+      "resolved": "https://registry.npmjs.org/react-native-video/-/react-native-video-6.0.0-alpha.11.tgz",
32406
+      "integrity": "sha512-Z1FqIkNBqQWdBVKoh5WlmM01LIVhxlOsddKVV9IzMJ3EDl8PAU4ln7hdo85RHCHhgWSHzathPDo0UK7gPB48MA=="
32453 32407
     },
32454 32408
     "react-native-watch-connectivity": {
32455 32409
       "version": "1.1.0",

+ 1
- 1
package.json View File

@@ -103,7 +103,7 @@
103 103
     "react-native-svg-transformer": "1.1.0",
104 104
     "react-native-tab-view": "3.5.2",
105 105
     "react-native-url-polyfill": "2.0.0",
106
-    "react-native-video": "6.0.0-alpha.7",
106
+    "react-native-video": "6.0.0-alpha.11",
107 107
     "react-native-watch-connectivity": "1.1.0",
108 108
     "react-native-webrtc": "118.0.0",
109 109
     "react-native-webview": "13.5.1",

+ 8
- 1
react/features/base/tracks/actions.native.ts View File

@@ -1,3 +1,5 @@
1
+import { NativeModules, Platform } from 'react-native';
2
+
1 3
 import { IReduxState, IStore } from '../../app/types';
2 4
 import { setPictureInPictureEnabled } from '../../mobile/picture-in-picture/functions';
3 5
 import { showNotification } from '../../notifications/actions';
@@ -12,6 +14,8 @@ import { VIDEO_MUTISM_AUTHORITY } from '../media/constants';
12 14
 import { addLocalTrack, replaceLocalTrack } from './actions.any';
13 15
 import { getLocalDesktopTrack, getTrackState, isLocalVideoTrackDesktop } from './functions.native';
14 16
 
17
+const { JitsiMeetMediaProjectionModule } = NativeModules;
18
+
15 19
 export * from './actions.any';
16 20
 
17 21
 /**
@@ -31,7 +35,10 @@ export function toggleScreensharing(enabled: boolean, _ignore1?: boolean, _ignor
31 35
 
32 36
             if (!isSharing) {
33 37
                 _startScreenSharing(dispatch, state);
38
+                Platform.OS === 'android' && JitsiMeetMediaProjectionModule.launch();
34 39
             }
40
+
41
+            Platform.OS === 'android' && JitsiMeetMediaProjectionModule.abort();
35 42
         } else {
36 43
             dispatch(setScreenshareMuted(true));
37 44
             dispatch(setVideoMuted(false, VIDEO_MUTISM_AUTHORITY.SCREEN_SHARE));
@@ -77,7 +84,7 @@ async function _startScreenSharing(dispatch: IStore['dispatch'], state: IReduxSt
77 84
             }, NOTIFICATION_TIMEOUT_TYPE.LONG));
78 85
         }
79 86
     } catch (error: any) {
80
-        console.log('ERROR creating ScreeSharing stream ', error);
87
+        console.log('ERROR creating screen-sharing stream ', error);
81 88
 
82 89
         setPictureInPictureEnabled(true);
83 90
     }

+ 3
- 1
react/features/shared-video/components/native/VideoManager.tsx View File

@@ -19,7 +19,7 @@ interface IState {
19 19
  * Manager of shared video.
20 20
  */
21 21
 class VideoManager extends AbstractVideoManager<IState> {
22
-    playerRef: RefObject<Video>;
22
+    playerRef: RefObject<typeof Video>;
23 23
 
24 24
     /**
25 25
      * Initializes a new VideoManager instance.
@@ -83,6 +83,8 @@ class VideoManager extends AbstractVideoManager<IState> {
83 83
      */
84 84
     seek(time: number) {
85 85
         if (this.player) {
86
+
87
+            // @ts-ignore
86 88
             this.player.seek(time);
87 89
         }
88 90
     }

Loading…
Cancel
Save