@100mslive/react-native-hms 1.7.2 → 2.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/.gradle/6.7.1/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/6.7.1/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/6.9/executionHistory/executionHistory.bin +0 -0
- package/android/.gradle/6.9/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/6.9/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/6.9/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/{6.7.1/fileHashes/fileHashes.bin → 6.9/fileHashes/resourceHashesCache.bin} +0 -0
- package/android/.gradle/6.9/javaCompile/classAnalysis.bin +0 -0
- package/android/.gradle/6.9/javaCompile/jarAnalysis.bin +0 -0
- package/android/.gradle/6.9/javaCompile/javaCompile.lock +0 -0
- package/android/.gradle/6.9/javaCompile/taskHistory.bin +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +1 -1
- package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
- package/android/.gradle/checksums/checksums.lock +0 -0
- package/android/.gradle/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/checksums/sha1-checksums.bin +0 -0
- package/android/.idea/compiler.xml +6 -0
- package/android/.idea/gradle.xml +18 -0
- package/android/.idea/jarRepositories.xml +45 -0
- package/android/.idea/misc.xml +10 -0
- package/android/.idea/vcs.xml +6 -0
- package/android/build.gradle +3 -3
- package/android/local.properties +8 -1
- package/android/src/main/java/com/reactnativehmssdk/HMSAudioshareActivity.kt +1 -0
- package/android/src/main/java/com/reactnativehmssdk/HMSDecoder.kt +42 -14
- package/android/src/main/java/com/reactnativehmssdk/HMSHLSPlayer.kt +113 -68
- package/android/src/main/java/com/reactnativehmssdk/HMSHLSPlayerManager.kt +17 -4
- package/android/src/main/java/com/reactnativehmssdk/HMSHelper.kt +46 -18
- package/android/src/main/java/com/reactnativehmssdk/HMSManager.kt +483 -184
- package/android/src/main/java/com/reactnativehmssdk/HMSRNSDK.kt +551 -151
- package/android/src/main/java/com/reactnativehmssdk/HMSSDKViewManager.kt +26 -7
- package/android/src/main/java/com/reactnativehmssdk/HMSView.kt +32 -12
- package/android/src/main/java/com/reactnativehmssdk/HmsScreenshareActivity.kt +1 -0
- package/android/src/main/java/com/reactnativehmssdk/PipActionReceiver.kt +10 -6
- package/android/src/main/res/layout/player_view.xml +3 -2
- package/ios/HMSConstants.swift +1 -0
- package/ios/HMSDecoder.swift +18 -7
- package/ios/HMSHLSPlayerManager.swift +18 -2
- package/ios/HMSManager.m +239 -70
- package/ios/HMSManager.swift +24 -3
- package/ios/HMSRNSDK.swift +129 -126
- package/ios/HMSView.swift +17 -3
- package/ios/Hmssdk.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/ios/Hmssdk.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/ios/Hmssdk.xcodeproj/project.xcworkspace/xcuserdata/jatinnagar.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/Hmssdk.xcodeproj/xcuserdata/jatinnagar.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
- package/lib/commonjs/classes/HMSEncoder.js +6 -0
- package/lib/commonjs/classes/HMSEncoder.js.map +1 -1
- package/lib/commonjs/classes/HMSPIPListenerActions.js +1 -0
- package/lib/commonjs/classes/HMSPIPListenerActions.js.map +1 -1
- package/lib/commonjs/classes/HMSPeer.js +15 -0
- package/lib/commonjs/classes/HMSPeer.js.map +1 -1
- package/lib/commonjs/classes/HMSPeerListIterator.js +46 -0
- package/lib/commonjs/classes/HMSPeerListIterator.js.map +1 -0
- package/lib/commonjs/classes/HMSPeerListIteratorOptions.js +2 -0
- package/lib/commonjs/classes/HMSPeerListIteratorOptions.js.map +1 -0
- package/lib/commonjs/classes/HMSPeerUpdate.js +2 -1
- package/lib/commonjs/classes/HMSPeerUpdate.js.map +1 -1
- package/lib/commonjs/classes/HMSPeersCache.js +7 -0
- package/lib/commonjs/classes/HMSPeersCache.js.map +1 -1
- package/lib/commonjs/classes/HMSSDK.js +162 -29
- package/lib/commonjs/classes/HMSSDK.js.map +1 -1
- package/lib/commonjs/classes/HMSUpdateListenerActions.js +1 -0
- package/lib/commonjs/classes/HMSUpdateListenerActions.js.map +1 -1
- package/lib/commonjs/components/HMSHLSPlayer/HMSHLSPlayer.js +10 -5
- package/lib/commonjs/components/HMSHLSPlayer/HMSHLSPlayer.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/types.js +1 -0
- package/lib/commonjs/types.js.map +1 -1
- package/lib/module/classes/HMSEncoder.js +6 -0
- package/lib/module/classes/HMSEncoder.js.map +1 -1
- package/lib/module/classes/HMSPIPListenerActions.js +1 -0
- package/lib/module/classes/HMSPIPListenerActions.js.map +1 -1
- package/lib/module/classes/HMSPeer.js +15 -0
- package/lib/module/classes/HMSPeer.js.map +1 -1
- package/lib/module/classes/HMSPeerListIterator.js +40 -0
- package/lib/module/classes/HMSPeerListIterator.js.map +1 -0
- package/lib/module/classes/HMSPeerListIteratorOptions.js +2 -0
- package/lib/module/classes/HMSPeerListIteratorOptions.js.map +1 -0
- package/lib/module/classes/HMSPeerUpdate.js +2 -1
- package/lib/module/classes/HMSPeerUpdate.js.map +1 -1
- package/lib/module/classes/HMSPeersCache.js +7 -0
- package/lib/module/classes/HMSPeersCache.js.map +1 -1
- package/lib/module/classes/HMSSDK.js +162 -30
- package/lib/module/classes/HMSSDK.js.map +1 -1
- package/lib/module/classes/HMSUpdateListenerActions.js +1 -0
- package/lib/module/classes/HMSUpdateListenerActions.js.map +1 -1
- package/lib/module/components/HMSHLSPlayer/HMSHLSPlayer.js +11 -6
- package/lib/module/components/HMSHLSPlayer/HMSHLSPlayer.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/types.js +1 -0
- package/lib/module/types.js.map +1 -1
- package/lib/typescript/classes/HMSEncoder.d.ts +1 -0
- package/lib/typescript/classes/HMSPIPListenerActions.d.ts +1 -0
- package/lib/typescript/classes/HMSPeer.d.ts +3 -0
- package/lib/typescript/classes/HMSPeerListIterator.d.ts +7 -0
- package/lib/typescript/classes/HMSPeerListIteratorOptions.d.ts +5 -0
- package/lib/typescript/classes/HMSPeerUpdate.d.ts +2 -1
- package/lib/typescript/classes/HMSPeersCache.d.ts +1 -0
- package/lib/typescript/classes/HMSSDK.d.ts +46 -13
- package/lib/typescript/classes/HMSUpdateListenerActions.d.ts +2 -1
- package/lib/typescript/index.d.ts +1 -1
- package/lib/typescript/types.d.ts +3 -1
- package/package.json +1 -1
- package/sdk-versions.json +2 -2
- package/src/classes/HMSEncoder.ts +9 -0
- package/src/classes/HMSPIPListenerActions.ts +1 -0
- package/src/classes/HMSPeer.ts +25 -0
- package/src/classes/HMSPeerListIterator.ts +40 -0
- package/src/classes/HMSPeerListIteratorOptions.ts +5 -0
- package/src/classes/HMSPeerUpdate.ts +2 -0
- package/src/classes/HMSPeersCache.ts +7 -0
- package/src/classes/HMSSDK.tsx +202 -26
- package/src/classes/HMSUpdateListenerActions.ts +1 -0
- package/src/components/HMSHLSPlayer/HMSHLSPlayer.tsx +15 -13
- package/src/index.ts +4 -1
- package/src/types.ts +2 -0
- package/android/.gradle/6.7.1/executionHistory/executionHistory.bin +0 -0
|
@@ -5,6 +5,7 @@ import android.app.Application
|
|
|
5
5
|
import android.app.PendingIntent
|
|
6
6
|
import android.content.Intent
|
|
7
7
|
import android.content.pm.PackageManager
|
|
8
|
+
import android.content.res.Configuration
|
|
8
9
|
import android.os.Build
|
|
9
10
|
import android.os.Bundle
|
|
10
11
|
import android.util.Rational
|
|
@@ -21,6 +22,32 @@ class HMSManager(reactContext: ReactApplicationContext) :
|
|
|
21
22
|
companion object {
|
|
22
23
|
const val REACT_CLASS = "HMSManager"
|
|
23
24
|
var hmsCollection = mutableMapOf<String, HMSRNSDK>()
|
|
25
|
+
|
|
26
|
+
var reactAppContext: ReactApplicationContext? = null
|
|
27
|
+
var pipParamConfig: PipParamConfig? = null;
|
|
28
|
+
var pipParamsUntyped: Any? = null;
|
|
29
|
+
var emitter: DeviceEventManagerModule.RCTDeviceEventEmitter? = null
|
|
30
|
+
|
|
31
|
+
fun onPictureInPictureModeChanged(isInPictureInPictureMode: Boolean, newConfig: Configuration) {
|
|
32
|
+
emitter?.let {
|
|
33
|
+
val data = Arguments.createMap()
|
|
34
|
+
data.putBoolean("isInPictureInPictureMode", isInPictureInPictureMode)
|
|
35
|
+
|
|
36
|
+
it.emit("ON_PIP_MODE_CHANGED", data)
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
fun onUserLeaveHint() {
|
|
41
|
+
val pipParams = pipParamsUntyped
|
|
42
|
+
if (
|
|
43
|
+
Build.VERSION.SDK_INT >= Build.VERSION_CODES.O &&
|
|
44
|
+
Build.VERSION.SDK_INT < Build.VERSION_CODES.S &&
|
|
45
|
+
pipParamConfig?.autoEnterPipMode == true &&
|
|
46
|
+
pipParams is android.app.PictureInPictureParams
|
|
47
|
+
) {
|
|
48
|
+
reactAppContext?.currentActivity?.enterPictureInPictureMode(pipParams)
|
|
49
|
+
}
|
|
50
|
+
}
|
|
24
51
|
}
|
|
25
52
|
|
|
26
53
|
override fun getName(): String {
|
|
@@ -31,10 +58,28 @@ class HMSManager(reactContext: ReactApplicationContext) :
|
|
|
31
58
|
return hmsCollection
|
|
32
59
|
}
|
|
33
60
|
|
|
61
|
+
private fun setupPip() {
|
|
62
|
+
if (emitter == null) {
|
|
63
|
+
reactAppContext = reactApplicationContext
|
|
64
|
+
|
|
65
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
66
|
+
currentActivity?.let {
|
|
67
|
+
pipReceiver?.register(it)
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
emitter = reactApplicationContext
|
|
72
|
+
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
34
76
|
// Example method
|
|
35
77
|
// See https://reactnative.dev/docs/native-modules-android
|
|
36
78
|
@ReactMethod
|
|
37
|
-
fun build(
|
|
79
|
+
fun build(
|
|
80
|
+
data: ReadableMap?,
|
|
81
|
+
callback: Promise?,
|
|
82
|
+
) {
|
|
38
83
|
val hasItem = hmsCollection.containsKey("12345")
|
|
39
84
|
if (hasItem) {
|
|
40
85
|
val uuid = UUID.randomUUID()
|
|
@@ -90,28 +135,40 @@ class HMSManager(reactContext: ReactApplicationContext) :
|
|
|
90
135
|
}
|
|
91
136
|
|
|
92
137
|
@ReactMethod
|
|
93
|
-
fun leave(
|
|
138
|
+
fun leave(
|
|
139
|
+
data: ReadableMap,
|
|
140
|
+
callback: Promise?,
|
|
141
|
+
) {
|
|
94
142
|
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
95
143
|
|
|
96
144
|
hms?.leave(callback)
|
|
97
145
|
}
|
|
98
146
|
|
|
99
147
|
@ReactMethod
|
|
100
|
-
fun sendBroadcastMessage(
|
|
148
|
+
fun sendBroadcastMessage(
|
|
149
|
+
data: ReadableMap,
|
|
150
|
+
callback: Promise?,
|
|
151
|
+
) {
|
|
101
152
|
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
102
153
|
|
|
103
154
|
hms?.sendBroadcastMessage(data, callback)
|
|
104
155
|
}
|
|
105
156
|
|
|
106
157
|
@ReactMethod
|
|
107
|
-
fun sendGroupMessage(
|
|
158
|
+
fun sendGroupMessage(
|
|
159
|
+
data: ReadableMap,
|
|
160
|
+
callback: Promise?,
|
|
161
|
+
) {
|
|
108
162
|
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
109
163
|
|
|
110
164
|
hms?.sendGroupMessage(data, callback)
|
|
111
165
|
}
|
|
112
166
|
|
|
113
167
|
@ReactMethod
|
|
114
|
-
fun sendDirectMessage(
|
|
168
|
+
fun sendDirectMessage(
|
|
169
|
+
data: ReadableMap,
|
|
170
|
+
callback: Promise?,
|
|
171
|
+
) {
|
|
115
172
|
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
116
173
|
|
|
117
174
|
hms?.sendDirectMessage(data, callback)
|
|
@@ -119,84 +176,120 @@ class HMSManager(reactContext: ReactApplicationContext) :
|
|
|
119
176
|
|
|
120
177
|
@kotlin.Deprecated("Use #Function changeRoleOfPeer instead")
|
|
121
178
|
@ReactMethod
|
|
122
|
-
fun changeRole(
|
|
179
|
+
fun changeRole(
|
|
180
|
+
data: ReadableMap,
|
|
181
|
+
callback: Promise?,
|
|
182
|
+
) {
|
|
123
183
|
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
124
184
|
|
|
125
185
|
hms?.changeRole(data, callback)
|
|
126
186
|
}
|
|
127
187
|
|
|
128
188
|
@ReactMethod
|
|
129
|
-
fun changeRoleOfPeer(
|
|
189
|
+
fun changeRoleOfPeer(
|
|
190
|
+
data: ReadableMap,
|
|
191
|
+
promise: Promise?,
|
|
192
|
+
) {
|
|
130
193
|
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
131
194
|
|
|
132
195
|
hms?.changeRoleOfPeer(data, promise)
|
|
133
196
|
}
|
|
134
197
|
|
|
135
198
|
@ReactMethod
|
|
136
|
-
fun changeRoleOfPeersWithRoles(
|
|
199
|
+
fun changeRoleOfPeersWithRoles(
|
|
200
|
+
data: ReadableMap,
|
|
201
|
+
promise: Promise?,
|
|
202
|
+
) {
|
|
137
203
|
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
138
204
|
|
|
139
205
|
hms?.changeRoleOfPeersWithRoles(data, promise)
|
|
140
206
|
}
|
|
141
207
|
|
|
142
208
|
@ReactMethod
|
|
143
|
-
fun changeTrackState(
|
|
209
|
+
fun changeTrackState(
|
|
210
|
+
data: ReadableMap,
|
|
211
|
+
callback: Promise?,
|
|
212
|
+
) {
|
|
144
213
|
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
145
214
|
|
|
146
215
|
hms?.changeTrackState(data, callback)
|
|
147
216
|
}
|
|
148
217
|
|
|
149
218
|
@ReactMethod
|
|
150
|
-
fun changeTrackStateForRoles(
|
|
219
|
+
fun changeTrackStateForRoles(
|
|
220
|
+
data: ReadableMap,
|
|
221
|
+
callback: Promise?,
|
|
222
|
+
) {
|
|
151
223
|
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
152
224
|
|
|
153
225
|
hms?.changeTrackStateForRoles(data, callback)
|
|
154
226
|
}
|
|
155
227
|
|
|
156
228
|
@ReactMethod
|
|
157
|
-
fun isMute(
|
|
229
|
+
fun isMute(
|
|
230
|
+
data: ReadableMap,
|
|
231
|
+
callback: Promise?,
|
|
232
|
+
) {
|
|
158
233
|
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
159
234
|
|
|
160
235
|
hms?.isMute(data, callback)
|
|
161
236
|
}
|
|
162
237
|
|
|
163
238
|
@ReactMethod
|
|
164
|
-
fun removePeer(
|
|
239
|
+
fun removePeer(
|
|
240
|
+
data: ReadableMap,
|
|
241
|
+
callback: Promise?,
|
|
242
|
+
) {
|
|
165
243
|
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
166
244
|
|
|
167
245
|
hms?.removePeer(data, callback)
|
|
168
246
|
}
|
|
169
247
|
|
|
170
248
|
@ReactMethod
|
|
171
|
-
fun isPlaybackAllowed(
|
|
249
|
+
fun isPlaybackAllowed(
|
|
250
|
+
data: ReadableMap,
|
|
251
|
+
callback: Promise?,
|
|
252
|
+
) {
|
|
172
253
|
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
173
254
|
|
|
174
255
|
hms?.isPlaybackAllowed(data, callback)
|
|
175
256
|
}
|
|
176
257
|
|
|
177
258
|
@ReactMethod
|
|
178
|
-
fun getRoom(
|
|
259
|
+
fun getRoom(
|
|
260
|
+
data: ReadableMap,
|
|
261
|
+
callback: Promise?,
|
|
262
|
+
) {
|
|
179
263
|
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
180
264
|
|
|
181
265
|
hms?.getRoom(callback)
|
|
182
266
|
}
|
|
183
267
|
|
|
184
268
|
@ReactMethod
|
|
185
|
-
fun getLocalPeer(
|
|
269
|
+
fun getLocalPeer(
|
|
270
|
+
data: ReadableMap,
|
|
271
|
+
callback: Promise?,
|
|
272
|
+
) {
|
|
186
273
|
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
187
274
|
|
|
188
275
|
hms?.getLocalPeer(callback)
|
|
189
276
|
}
|
|
190
277
|
|
|
191
278
|
@ReactMethod
|
|
192
|
-
fun getRemotePeers(
|
|
279
|
+
fun getRemotePeers(
|
|
280
|
+
data: ReadableMap,
|
|
281
|
+
callback: Promise?,
|
|
282
|
+
) {
|
|
193
283
|
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
194
284
|
|
|
195
285
|
hms?.getRemotePeers(callback)
|
|
196
286
|
}
|
|
197
287
|
|
|
198
288
|
@ReactMethod
|
|
199
|
-
fun getRoles(
|
|
289
|
+
fun getRoles(
|
|
290
|
+
data: ReadableMap,
|
|
291
|
+
callback: Promise?,
|
|
292
|
+
) {
|
|
200
293
|
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
201
294
|
|
|
202
295
|
hms?.getRoles(callback)
|
|
@@ -210,14 +303,40 @@ class HMSManager(reactContext: ReactApplicationContext) :
|
|
|
210
303
|
}
|
|
211
304
|
|
|
212
305
|
@ReactMethod
|
|
213
|
-
fun endRoom(
|
|
306
|
+
fun endRoom(
|
|
307
|
+
data: ReadableMap,
|
|
308
|
+
callback: Promise?,
|
|
309
|
+
) {
|
|
214
310
|
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
215
311
|
|
|
216
312
|
hms?.endRoom(data, callback)
|
|
217
313
|
}
|
|
218
314
|
|
|
219
315
|
@ReactMethod
|
|
220
|
-
fun
|
|
316
|
+
fun previewForRole(
|
|
317
|
+
data: ReadableMap,
|
|
318
|
+
callback: Promise?,
|
|
319
|
+
) {
|
|
320
|
+
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
321
|
+
|
|
322
|
+
hms?.previewForRole(data, callback)
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
@ReactMethod
|
|
326
|
+
fun cancelPreview(
|
|
327
|
+
data: ReadableMap,
|
|
328
|
+
callback: Promise?,
|
|
329
|
+
) {
|
|
330
|
+
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
331
|
+
|
|
332
|
+
hms?.cancelPreview(callback)
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
@ReactMethod
|
|
336
|
+
fun acceptRoleChange(
|
|
337
|
+
data: ReadableMap,
|
|
338
|
+
callback: Promise?,
|
|
339
|
+
) {
|
|
221
340
|
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
222
341
|
|
|
223
342
|
hms?.acceptRoleChange(callback)
|
|
@@ -231,7 +350,10 @@ class HMSManager(reactContext: ReactApplicationContext) :
|
|
|
231
350
|
}
|
|
232
351
|
|
|
233
352
|
@ReactMethod
|
|
234
|
-
fun getVolume(
|
|
353
|
+
fun getVolume(
|
|
354
|
+
data: ReadableMap,
|
|
355
|
+
callback: Promise?,
|
|
356
|
+
) {
|
|
235
357
|
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
236
358
|
|
|
237
359
|
hms?.getVolume(data, callback)
|
|
@@ -245,21 +367,30 @@ class HMSManager(reactContext: ReactApplicationContext) :
|
|
|
245
367
|
}
|
|
246
368
|
|
|
247
369
|
@ReactMethod
|
|
248
|
-
fun remoteMuteAllAudio(
|
|
370
|
+
fun remoteMuteAllAudio(
|
|
371
|
+
data: ReadableMap,
|
|
372
|
+
callback: Promise?,
|
|
373
|
+
) {
|
|
249
374
|
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
250
375
|
|
|
251
376
|
hms?.remoteMuteAllAudio(callback)
|
|
252
377
|
}
|
|
253
378
|
|
|
254
379
|
@ReactMethod
|
|
255
|
-
fun changeMetadata(
|
|
380
|
+
fun changeMetadata(
|
|
381
|
+
data: ReadableMap,
|
|
382
|
+
callback: Promise?,
|
|
383
|
+
) {
|
|
256
384
|
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
257
385
|
|
|
258
386
|
hms?.changeMetadata(data, callback)
|
|
259
387
|
}
|
|
260
388
|
|
|
261
389
|
@ReactMethod
|
|
262
|
-
fun startScreenshare(
|
|
390
|
+
fun startScreenshare(
|
|
391
|
+
data: ReadableMap,
|
|
392
|
+
callback: Promise?,
|
|
393
|
+
) {
|
|
263
394
|
currentActivity?.application?.registerActivityLifecycleCallbacks(this)
|
|
264
395
|
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
265
396
|
|
|
@@ -267,14 +398,20 @@ class HMSManager(reactContext: ReactApplicationContext) :
|
|
|
267
398
|
}
|
|
268
399
|
|
|
269
400
|
@ReactMethod
|
|
270
|
-
fun isScreenShared(
|
|
401
|
+
fun isScreenShared(
|
|
402
|
+
data: ReadableMap,
|
|
403
|
+
callback: Promise?,
|
|
404
|
+
) {
|
|
271
405
|
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
272
406
|
|
|
273
407
|
hms?.isScreenShared(callback)
|
|
274
408
|
}
|
|
275
409
|
|
|
276
410
|
@ReactMethod
|
|
277
|
-
fun stopScreenshare(
|
|
411
|
+
fun stopScreenshare(
|
|
412
|
+
data: ReadableMap,
|
|
413
|
+
callback: Promise?,
|
|
414
|
+
) {
|
|
278
415
|
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
279
416
|
|
|
280
417
|
currentActivity?.application?.unregisterActivityLifecycleCallbacks(this)
|
|
@@ -282,7 +419,10 @@ class HMSManager(reactContext: ReactApplicationContext) :
|
|
|
282
419
|
}
|
|
283
420
|
|
|
284
421
|
@ReactMethod
|
|
285
|
-
fun startAudioshare(
|
|
422
|
+
fun startAudioshare(
|
|
423
|
+
data: ReadableMap,
|
|
424
|
+
callback: Promise?,
|
|
425
|
+
) {
|
|
286
426
|
currentActivity?.application?.registerActivityLifecycleCallbacks(this)
|
|
287
427
|
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
288
428
|
|
|
@@ -290,14 +430,20 @@ class HMSManager(reactContext: ReactApplicationContext) :
|
|
|
290
430
|
}
|
|
291
431
|
|
|
292
432
|
@ReactMethod
|
|
293
|
-
fun isAudioShared(
|
|
433
|
+
fun isAudioShared(
|
|
434
|
+
data: ReadableMap,
|
|
435
|
+
callback: Promise?,
|
|
436
|
+
) {
|
|
294
437
|
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
295
438
|
|
|
296
439
|
hms?.isAudioShared(callback)
|
|
297
440
|
}
|
|
298
441
|
|
|
299
442
|
@ReactMethod
|
|
300
|
-
fun stopAudioshare(
|
|
443
|
+
fun stopAudioshare(
|
|
444
|
+
data: ReadableMap,
|
|
445
|
+
callback: Promise?,
|
|
446
|
+
) {
|
|
301
447
|
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
302
448
|
|
|
303
449
|
currentActivity?.application?.unregisterActivityLifecycleCallbacks(this)
|
|
@@ -305,42 +451,60 @@ class HMSManager(reactContext: ReactApplicationContext) :
|
|
|
305
451
|
}
|
|
306
452
|
|
|
307
453
|
@ReactMethod
|
|
308
|
-
fun getAudioMixingMode(
|
|
454
|
+
fun getAudioMixingMode(
|
|
455
|
+
data: ReadableMap,
|
|
456
|
+
callback: Promise?,
|
|
457
|
+
) {
|
|
309
458
|
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
310
459
|
|
|
311
460
|
callback?.resolve(hms?.getAudioMixingMode()?.name)
|
|
312
461
|
}
|
|
313
462
|
|
|
314
463
|
@ReactMethod
|
|
315
|
-
fun setAudioMixingMode(
|
|
464
|
+
fun setAudioMixingMode(
|
|
465
|
+
data: ReadableMap,
|
|
466
|
+
callback: Promise?,
|
|
467
|
+
) {
|
|
316
468
|
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
317
469
|
|
|
318
470
|
hms?.setAudioMixingMode(data, callback)
|
|
319
471
|
}
|
|
320
472
|
|
|
321
473
|
@ReactMethod
|
|
322
|
-
fun startRTMPOrRecording(
|
|
474
|
+
fun startRTMPOrRecording(
|
|
475
|
+
data: ReadableMap,
|
|
476
|
+
callback: Promise?,
|
|
477
|
+
) {
|
|
323
478
|
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
324
479
|
|
|
325
480
|
hms?.startRTMPOrRecording(data, callback)
|
|
326
481
|
}
|
|
327
482
|
|
|
328
483
|
@ReactMethod
|
|
329
|
-
fun stopRtmpAndRecording(
|
|
484
|
+
fun stopRtmpAndRecording(
|
|
485
|
+
data: ReadableMap,
|
|
486
|
+
callback: Promise?,
|
|
487
|
+
) {
|
|
330
488
|
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
331
489
|
|
|
332
490
|
hms?.stopRtmpAndRecording(callback)
|
|
333
491
|
}
|
|
334
492
|
|
|
335
493
|
@ReactMethod
|
|
336
|
-
fun startHLSStreaming(
|
|
494
|
+
fun startHLSStreaming(
|
|
495
|
+
data: ReadableMap,
|
|
496
|
+
callback: Promise?,
|
|
497
|
+
) {
|
|
337
498
|
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
338
499
|
|
|
339
500
|
hms?.startHLSStreaming(data, callback)
|
|
340
501
|
}
|
|
341
502
|
|
|
342
503
|
@ReactMethod
|
|
343
|
-
fun stopHLSStreaming(
|
|
504
|
+
fun stopHLSStreaming(
|
|
505
|
+
data: ReadableMap,
|
|
506
|
+
callback: Promise?,
|
|
507
|
+
) {
|
|
344
508
|
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
345
509
|
|
|
346
510
|
hms?.stopHLSStreaming(callback)
|
|
@@ -354,14 +518,20 @@ class HMSManager(reactContext: ReactApplicationContext) :
|
|
|
354
518
|
}
|
|
355
519
|
|
|
356
520
|
@ReactMethod
|
|
357
|
-
fun changeName(
|
|
521
|
+
fun changeName(
|
|
522
|
+
data: ReadableMap,
|
|
523
|
+
callback: Promise?,
|
|
524
|
+
) {
|
|
358
525
|
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
359
526
|
|
|
360
527
|
hms?.changeName(data, callback)
|
|
361
528
|
}
|
|
362
529
|
|
|
363
530
|
@ReactMethod
|
|
364
|
-
fun destroy(
|
|
531
|
+
fun destroy(
|
|
532
|
+
data: ReadableMap,
|
|
533
|
+
callback: Promise?,
|
|
534
|
+
) {
|
|
365
535
|
val id = data.getString("id")
|
|
366
536
|
hmsCollection.remove(id)
|
|
367
537
|
val result: WritableMap = Arguments.createMap()
|
|
@@ -385,14 +555,20 @@ class HMSManager(reactContext: ReactApplicationContext) :
|
|
|
385
555
|
}
|
|
386
556
|
|
|
387
557
|
@ReactMethod
|
|
388
|
-
fun getAudioDevicesList(
|
|
558
|
+
fun getAudioDevicesList(
|
|
559
|
+
data: ReadableMap,
|
|
560
|
+
callback: Promise?,
|
|
561
|
+
) {
|
|
389
562
|
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
390
563
|
|
|
391
564
|
hms?.getAudioDevicesList(callback)
|
|
392
565
|
}
|
|
393
566
|
|
|
394
567
|
@ReactMethod
|
|
395
|
-
fun getAudioOutputRouteType(
|
|
568
|
+
fun getAudioOutputRouteType(
|
|
569
|
+
data: ReadableMap,
|
|
570
|
+
callback: Promise?,
|
|
571
|
+
) {
|
|
396
572
|
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
397
573
|
|
|
398
574
|
hms?.getAudioOutputRouteType(callback)
|
|
@@ -434,28 +610,40 @@ class HMSManager(reactContext: ReactApplicationContext) :
|
|
|
434
610
|
}
|
|
435
611
|
|
|
436
612
|
@ReactMethod
|
|
437
|
-
fun enableEvent(
|
|
613
|
+
fun enableEvent(
|
|
614
|
+
data: ReadableMap,
|
|
615
|
+
promise: Promise?,
|
|
616
|
+
) {
|
|
438
617
|
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
439
618
|
|
|
440
619
|
hms?.enableEvent(data, promise)
|
|
441
620
|
}
|
|
442
621
|
|
|
443
622
|
@ReactMethod
|
|
444
|
-
fun disableEvent(
|
|
623
|
+
fun disableEvent(
|
|
624
|
+
data: ReadableMap,
|
|
625
|
+
promise: Promise?,
|
|
626
|
+
) {
|
|
445
627
|
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
446
628
|
|
|
447
629
|
hms?.disableEvent(data, promise)
|
|
448
630
|
}
|
|
449
631
|
|
|
450
632
|
@ReactMethod()
|
|
451
|
-
fun restrictData(
|
|
633
|
+
fun restrictData(
|
|
634
|
+
data: ReadableMap,
|
|
635
|
+
promise: Promise?,
|
|
636
|
+
) {
|
|
452
637
|
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
453
638
|
|
|
454
639
|
hms?.restrictData(data, promise)
|
|
455
640
|
}
|
|
456
641
|
|
|
457
642
|
@ReactMethod()
|
|
458
|
-
fun getAuthTokenByRoomCode(
|
|
643
|
+
fun getAuthTokenByRoomCode(
|
|
644
|
+
data: ReadableMap,
|
|
645
|
+
promise: Promise,
|
|
646
|
+
) {
|
|
459
647
|
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
460
648
|
|
|
461
649
|
hms?.getAuthTokenByRoomCode(data, promise)
|
|
@@ -537,58 +725,68 @@ class HMSManager(reactContext: ReactApplicationContext) :
|
|
|
537
725
|
|
|
538
726
|
when (code) {
|
|
539
727
|
PipActionReceiver.PIPActions.localAudio.requestCode -> {
|
|
540
|
-
val audioActionIdx =
|
|
728
|
+
val audioActionIdx =
|
|
729
|
+
pipRemoteActionsList.indexOfFirst {
|
|
730
|
+
it is android.app.RemoteAction && it.title == PipActionReceiver.PIPActions.localAudio.title
|
|
731
|
+
}
|
|
541
732
|
if (audioActionIdx >= 0) {
|
|
542
|
-
pipRemoteActionsList[audioActionIdx] =
|
|
543
|
-
android.
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
733
|
+
pipRemoteActionsList[audioActionIdx] =
|
|
734
|
+
android.app.RemoteAction(
|
|
735
|
+
android.graphics.drawable.Icon.createWithResource(
|
|
736
|
+
reactApplicationContext,
|
|
737
|
+
if (hmssdk?.getLocalPeer()?.audioTrack?.isMute === true) R.drawable.ic_mic_off_24 else R.drawable.ic_mic_24,
|
|
738
|
+
),
|
|
739
|
+
PipActionReceiver.PIPActions.localAudio.title,
|
|
740
|
+
PipActionReceiver.PIPActions.localAudio.description,
|
|
741
|
+
PendingIntent.getBroadcast(
|
|
742
|
+
reactApplicationContext,
|
|
743
|
+
PipActionReceiver.PIPActions.localAudio.requestCode,
|
|
744
|
+
Intent(PipActionReceiver.PIP_INTENT_ACTION).putExtra(PipActionReceiver.PIPActions.localAudio.title, PipActionReceiver.PIPActions.localAudio.requestCode),
|
|
745
|
+
PendingIntent.FLAG_IMMUTABLE,
|
|
746
|
+
),
|
|
747
|
+
)
|
|
556
748
|
}
|
|
557
749
|
}
|
|
558
750
|
PipActionReceiver.PIPActions.localVideo.requestCode -> {
|
|
559
|
-
val videoActionIdx =
|
|
751
|
+
val videoActionIdx =
|
|
752
|
+
pipRemoteActionsList.indexOfFirst {
|
|
753
|
+
it is android.app.RemoteAction && it.title == PipActionReceiver.PIPActions.localVideo.title
|
|
754
|
+
}
|
|
560
755
|
if (videoActionIdx >= 0) {
|
|
561
756
|
val isVideoMute = hmssdk?.getLocalPeer()?.videoTrack?.isMute
|
|
562
757
|
val updatedIcon = if (isVideoMute === true) R.drawable.ic_camera_toggle_off else R.drawable.ic_camera_toggle_on
|
|
563
|
-
pipRemoteActionsList[videoActionIdx] =
|
|
564
|
-
android.
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
758
|
+
pipRemoteActionsList[videoActionIdx] =
|
|
759
|
+
android.app.RemoteAction(
|
|
760
|
+
android.graphics.drawable.Icon.createWithResource(
|
|
761
|
+
reactApplicationContext,
|
|
762
|
+
updatedIcon,
|
|
763
|
+
),
|
|
764
|
+
PipActionReceiver.PIPActions.localVideo.title,
|
|
765
|
+
PipActionReceiver.PIPActions.localVideo.description,
|
|
766
|
+
PendingIntent.getBroadcast(
|
|
767
|
+
reactApplicationContext,
|
|
768
|
+
PipActionReceiver.PIPActions.localVideo.requestCode,
|
|
769
|
+
Intent(PipActionReceiver.PIP_INTENT_ACTION).putExtra(PipActionReceiver.PIPActions.localVideo.title, PipActionReceiver.PIPActions.localVideo.requestCode),
|
|
770
|
+
PendingIntent.FLAG_IMMUTABLE,
|
|
771
|
+
),
|
|
772
|
+
)
|
|
577
773
|
}
|
|
578
774
|
}
|
|
579
775
|
}
|
|
580
776
|
|
|
581
|
-
val pipParams =
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
777
|
+
val pipParams =
|
|
778
|
+
android.app.PictureInPictureParams.Builder().let {
|
|
779
|
+
it.setActions(pipRemoteActionsList.filterIsInstance<android.app.RemoteAction>())
|
|
780
|
+
it.build()
|
|
781
|
+
}
|
|
585
782
|
|
|
586
783
|
activity.setPictureInPictureParams(pipParams)
|
|
587
784
|
}
|
|
588
785
|
}
|
|
589
786
|
// endregion
|
|
590
787
|
|
|
591
|
-
|
|
788
|
+
data class PipParamConfig(
|
|
789
|
+
val autoEnterPipMode: Boolean,
|
|
592
790
|
val aspectRatio: Pair<Int, Int>?,
|
|
593
791
|
val showEndButton: Boolean,
|
|
594
792
|
val showVideoButton: Boolean,
|
|
@@ -596,7 +794,11 @@ class HMSManager(reactContext: ReactApplicationContext) :
|
|
|
596
794
|
)
|
|
597
795
|
|
|
598
796
|
@ReactMethod
|
|
599
|
-
fun handlePipActions(
|
|
797
|
+
fun handlePipActions(
|
|
798
|
+
action: String,
|
|
799
|
+
data: ReadableMap,
|
|
800
|
+
promise: Promise?,
|
|
801
|
+
) {
|
|
600
802
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
|
|
601
803
|
promise?.reject(Throwable("PIP mode is not supported!"))
|
|
602
804
|
return
|
|
@@ -608,6 +810,8 @@ class HMSManager(reactContext: ReactApplicationContext) :
|
|
|
608
810
|
}
|
|
609
811
|
|
|
610
812
|
try {
|
|
813
|
+
setupPip()
|
|
814
|
+
|
|
611
815
|
PipActionReceiver.sdkIdForPIP = data.getString("id")
|
|
612
816
|
|
|
613
817
|
when (action) {
|
|
@@ -615,8 +819,8 @@ class HMSManager(reactContext: ReactApplicationContext) :
|
|
|
615
819
|
val result = isPipModeSupported()
|
|
616
820
|
promise?.resolve(result)
|
|
617
821
|
}
|
|
618
|
-
"
|
|
619
|
-
val result =
|
|
822
|
+
"enterPipMode" -> {
|
|
823
|
+
val result = enterPipMode(data)
|
|
620
824
|
promise?.resolve(result)
|
|
621
825
|
}
|
|
622
826
|
"setPictureInPictureParams" -> {
|
|
@@ -637,94 +841,96 @@ class HMSManager(reactContext: ReactApplicationContext) :
|
|
|
637
841
|
return null
|
|
638
842
|
}
|
|
639
843
|
|
|
640
|
-
val pipParams =
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
844
|
+
val pipParams =
|
|
845
|
+
android.app.PictureInPictureParams.Builder().let {
|
|
846
|
+
if (config.aspectRatio !== null) {
|
|
847
|
+
it.setAspectRatio(
|
|
848
|
+
Rational(
|
|
849
|
+
config.aspectRatio.first,
|
|
850
|
+
config.aspectRatio.second,
|
|
851
|
+
),
|
|
852
|
+
)
|
|
853
|
+
}
|
|
649
854
|
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
// }
|
|
855
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
|
856
|
+
it.setAutoEnterEnabled(config.autoEnterPipMode)
|
|
857
|
+
}
|
|
654
858
|
|
|
655
|
-
|
|
656
|
-
|
|
859
|
+
// region Setting RemoteActions on PictureInPictureParams
|
|
860
|
+
val hmssdk = getHmsInstance()[PipActionReceiver.sdkIdForPIP!!]?.hmsSDK
|
|
657
861
|
|
|
658
|
-
|
|
862
|
+
pipRemoteActionsList.clear()
|
|
659
863
|
|
|
660
|
-
|
|
661
|
-
|
|
864
|
+
val localPeer = hmssdk?.getLocalPeer()
|
|
865
|
+
val allowedPublishing = localPeer?.hmsRole?.publishParams?.allowed
|
|
662
866
|
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
867
|
+
if (config.showAudioButton && allowedPublishing?.contains("audio") === true) {
|
|
868
|
+
pipRemoteActionsList.add(
|
|
869
|
+
android.app.RemoteAction(
|
|
870
|
+
android.graphics.drawable.Icon.createWithResource(
|
|
871
|
+
reactApplicationContext,
|
|
872
|
+
if (localPeer?.audioTrack?.isMute === true) R.drawable.ic_mic_off_24 else R.drawable.ic_mic_24,
|
|
873
|
+
),
|
|
874
|
+
PipActionReceiver.PIPActions.localAudio.title,
|
|
875
|
+
PipActionReceiver.PIPActions.localAudio.description,
|
|
876
|
+
PendingIntent.getBroadcast(
|
|
877
|
+
reactApplicationContext,
|
|
878
|
+
PipActionReceiver.PIPActions.localAudio.requestCode,
|
|
879
|
+
Intent(
|
|
880
|
+
PipActionReceiver.PIP_INTENT_ACTION,
|
|
881
|
+
).putExtra(PipActionReceiver.PIPActions.localAudio.title, PipActionReceiver.PIPActions.localAudio.requestCode),
|
|
882
|
+
PendingIntent.FLAG_IMMUTABLE,
|
|
883
|
+
),
|
|
677
884
|
),
|
|
678
|
-
)
|
|
679
|
-
|
|
680
|
-
}
|
|
885
|
+
)
|
|
886
|
+
}
|
|
681
887
|
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
PipActionReceiver.PIPActions.endMeet.requestCode,
|
|
691
|
-
Intent(PipActionReceiver.PIP_INTENT_ACTION).putExtra(
|
|
692
|
-
PipActionReceiver.PIPActions.endMeet.title,
|
|
888
|
+
if (config.showEndButton) {
|
|
889
|
+
pipRemoteActionsList.add(
|
|
890
|
+
android.app.RemoteAction(
|
|
891
|
+
android.graphics.drawable.Icon.createWithResource(reactApplicationContext, R.drawable.ic_call_end_24),
|
|
892
|
+
PipActionReceiver.PIPActions.endMeet.title,
|
|
893
|
+
PipActionReceiver.PIPActions.endMeet.description,
|
|
894
|
+
PendingIntent.getBroadcast(
|
|
895
|
+
reactApplicationContext,
|
|
693
896
|
PipActionReceiver.PIPActions.endMeet.requestCode,
|
|
897
|
+
Intent(PipActionReceiver.PIP_INTENT_ACTION).putExtra(
|
|
898
|
+
PipActionReceiver.PIPActions.endMeet.title,
|
|
899
|
+
PipActionReceiver.PIPActions.endMeet.requestCode,
|
|
900
|
+
),
|
|
901
|
+
PendingIntent.FLAG_IMMUTABLE,
|
|
694
902
|
),
|
|
695
|
-
PendingIntent.FLAG_IMMUTABLE,
|
|
696
903
|
),
|
|
697
|
-
)
|
|
698
|
-
|
|
699
|
-
}
|
|
904
|
+
)
|
|
905
|
+
}
|
|
700
906
|
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
PipActionReceiver.PIPActions.localVideo.requestCode,
|
|
713
|
-
Intent(PipActionReceiver.PIP_INTENT_ACTION).putExtra(
|
|
714
|
-
PipActionReceiver.PIPActions.localVideo.title,
|
|
907
|
+
if (config.showVideoButton && allowedPublishing?.contains("video") === true) {
|
|
908
|
+
pipRemoteActionsList.add(
|
|
909
|
+
android.app.RemoteAction(
|
|
910
|
+
android.graphics.drawable.Icon.createWithResource(
|
|
911
|
+
reactApplicationContext,
|
|
912
|
+
if (localPeer?.videoTrack?.isMute === true) R.drawable.ic_camera_toggle_off else R.drawable.ic_camera_toggle_on,
|
|
913
|
+
),
|
|
914
|
+
PipActionReceiver.PIPActions.localVideo.title,
|
|
915
|
+
PipActionReceiver.PIPActions.localVideo.description,
|
|
916
|
+
PendingIntent.getBroadcast(
|
|
917
|
+
reactApplicationContext,
|
|
715
918
|
PipActionReceiver.PIPActions.localVideo.requestCode,
|
|
919
|
+
Intent(PipActionReceiver.PIP_INTENT_ACTION).putExtra(
|
|
920
|
+
PipActionReceiver.PIPActions.localVideo.title,
|
|
921
|
+
PipActionReceiver.PIPActions.localVideo.requestCode,
|
|
922
|
+
),
|
|
923
|
+
PendingIntent.FLAG_IMMUTABLE,
|
|
716
924
|
),
|
|
717
|
-
PendingIntent.FLAG_IMMUTABLE,
|
|
718
925
|
),
|
|
719
|
-
)
|
|
720
|
-
|
|
721
|
-
}
|
|
926
|
+
)
|
|
927
|
+
}
|
|
722
928
|
|
|
723
|
-
|
|
724
|
-
|
|
929
|
+
it.setActions(pipRemoteActionsList.filterIsInstance<android.app.RemoteAction>())
|
|
930
|
+
// endregion
|
|
725
931
|
|
|
726
|
-
|
|
727
|
-
|
|
932
|
+
it.build()
|
|
933
|
+
}
|
|
728
934
|
|
|
729
935
|
return pipParams
|
|
730
936
|
}
|
|
@@ -735,14 +941,12 @@ class HMSManager(reactContext: ReactApplicationContext) :
|
|
|
735
941
|
return null
|
|
736
942
|
}
|
|
737
943
|
|
|
944
|
+
var autoEnterPipMode = false
|
|
738
945
|
var aspectRatio: Pair<Int, Int> = Pair(16, 9)
|
|
739
946
|
var showEndButton = false
|
|
740
947
|
var showAudioButton = false
|
|
741
948
|
var showVideoButton = false
|
|
742
949
|
|
|
743
|
-
// TODO:= We need compileSdkVersion >= 31 for autoEnterEnabled
|
|
744
|
-
// var autoEnterEnabled: Boolean? = null;
|
|
745
|
-
|
|
746
950
|
if (data !== null) {
|
|
747
951
|
if (data.hasKey("aspectRatio")) {
|
|
748
952
|
val aspectRatioArray = data.getArray("aspectRatio")
|
|
@@ -778,17 +982,17 @@ class HMSManager(reactContext: ReactApplicationContext) :
|
|
|
778
982
|
showVideoButton = data.getBoolean("videoButton")
|
|
779
983
|
}
|
|
780
984
|
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
// }
|
|
985
|
+
if (data.hasKey("autoEnterPipMode")) {
|
|
986
|
+
val autoEnterPipModeType = data.getType("autoEnterPipMode")
|
|
987
|
+
|
|
988
|
+
if (autoEnterPipModeType === ReadableType.Boolean) {
|
|
989
|
+
autoEnterPipMode = data.getBoolean("autoEnterPipMode")
|
|
990
|
+
}
|
|
991
|
+
}
|
|
789
992
|
}
|
|
790
993
|
|
|
791
994
|
return PipParamConfig(
|
|
995
|
+
autoEnterPipMode = autoEnterPipMode,
|
|
792
996
|
aspectRatio = aspectRatio,
|
|
793
997
|
showEndButton = showEndButton,
|
|
794
998
|
showAudioButton = showAudioButton,
|
|
@@ -813,6 +1017,10 @@ class HMSManager(reactContext: ReactApplicationContext) :
|
|
|
813
1017
|
if (pipParams !is android.app.PictureInPictureParams) {
|
|
814
1018
|
return false
|
|
815
1019
|
}
|
|
1020
|
+
|
|
1021
|
+
HMSManager.pipParamConfig = pipParamConfig
|
|
1022
|
+
HMSManager.pipParamsUntyped = pipParams
|
|
1023
|
+
|
|
816
1024
|
activity.setPictureInPictureParams(pipParams)
|
|
817
1025
|
return true
|
|
818
1026
|
} catch (e: Exception) {
|
|
@@ -829,7 +1037,7 @@ class HMSManager(reactContext: ReactApplicationContext) :
|
|
|
829
1037
|
}
|
|
830
1038
|
|
|
831
1039
|
@RequiresApi(Build.VERSION_CODES.O)
|
|
832
|
-
private fun
|
|
1040
|
+
private fun enterPipMode(data: ReadableMap): Boolean {
|
|
833
1041
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
|
|
834
1042
|
return false
|
|
835
1043
|
}
|
|
@@ -845,101 +1053,189 @@ class HMSManager(reactContext: ReactApplicationContext) :
|
|
|
845
1053
|
if (pipParams !is android.app.PictureInPictureParams) {
|
|
846
1054
|
return false
|
|
847
1055
|
}
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
return entered
|
|
1056
|
+
|
|
1057
|
+
HMSManager.pipParamConfig = pipParamConfig
|
|
1058
|
+
HMSManager.pipParamsUntyped = pipParams
|
|
1059
|
+
|
|
1060
|
+
return activity.enterPictureInPictureMode(pipParams)
|
|
854
1061
|
} catch (e: Exception) {
|
|
855
1062
|
throw e
|
|
856
1063
|
}
|
|
857
1064
|
}
|
|
858
1065
|
|
|
859
1066
|
@ReactMethod
|
|
860
|
-
fun getRemoteVideoTrackFromTrackId(
|
|
1067
|
+
fun getRemoteVideoTrackFromTrackId(
|
|
1068
|
+
data: ReadableMap,
|
|
1069
|
+
promise: Promise,
|
|
1070
|
+
) {
|
|
861
1071
|
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
862
1072
|
|
|
863
1073
|
hms?.getRemoteVideoTrackFromTrackId(data, promise)
|
|
864
1074
|
}
|
|
865
1075
|
|
|
866
1076
|
@ReactMethod
|
|
867
|
-
fun getRemoteAudioTrackFromTrackId(
|
|
1077
|
+
fun getRemoteAudioTrackFromTrackId(
|
|
1078
|
+
data: ReadableMap,
|
|
1079
|
+
promise: Promise,
|
|
1080
|
+
) {
|
|
868
1081
|
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
869
1082
|
|
|
870
1083
|
hms?.getRemoteAudioTrackFromTrackId(data, promise)
|
|
871
1084
|
}
|
|
872
1085
|
|
|
873
1086
|
@ReactMethod
|
|
874
|
-
fun getVideoTrackLayer(
|
|
1087
|
+
fun getVideoTrackLayer(
|
|
1088
|
+
data: ReadableMap,
|
|
1089
|
+
promise: Promise,
|
|
1090
|
+
) {
|
|
875
1091
|
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
876
1092
|
|
|
877
1093
|
hms?.getVideoTrackLayer(data, promise)
|
|
878
1094
|
}
|
|
879
1095
|
|
|
880
1096
|
@ReactMethod
|
|
881
|
-
fun getVideoTrackLayerDefinition(
|
|
1097
|
+
fun getVideoTrackLayerDefinition(
|
|
1098
|
+
data: ReadableMap,
|
|
1099
|
+
promise: Promise,
|
|
1100
|
+
) {
|
|
882
1101
|
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
883
1102
|
|
|
884
1103
|
hms?.getVideoTrackLayerDefinition(data, promise)
|
|
885
1104
|
}
|
|
886
1105
|
|
|
887
1106
|
@ReactMethod
|
|
888
|
-
fun setVideoTrackLayer(
|
|
1107
|
+
fun setVideoTrackLayer(
|
|
1108
|
+
data: ReadableMap,
|
|
1109
|
+
promise: Promise?,
|
|
1110
|
+
) {
|
|
889
1111
|
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
890
1112
|
|
|
891
1113
|
hms?.setVideoTrackLayer(data, promise)
|
|
892
1114
|
}
|
|
893
1115
|
|
|
894
1116
|
@ReactMethod
|
|
895
|
-
fun captureImageAtMaxSupportedResolution(
|
|
1117
|
+
fun captureImageAtMaxSupportedResolution(
|
|
1118
|
+
data: ReadableMap,
|
|
1119
|
+
promise: Promise?,
|
|
1120
|
+
) {
|
|
896
1121
|
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
897
1122
|
|
|
898
1123
|
hms?.captureImageAtMaxSupportedResolution(data, promise)
|
|
899
1124
|
}
|
|
900
1125
|
|
|
901
1126
|
@ReactMethod
|
|
902
|
-
fun setSessionMetadataForKey(
|
|
1127
|
+
fun setSessionMetadataForKey(
|
|
1128
|
+
data: ReadableMap,
|
|
1129
|
+
promise: Promise?,
|
|
1130
|
+
) {
|
|
903
1131
|
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
904
1132
|
|
|
905
1133
|
hms?.setSessionMetadataForKey(data, promise)
|
|
906
1134
|
}
|
|
907
1135
|
|
|
908
1136
|
@ReactMethod
|
|
909
|
-
fun getSessionMetadataForKey(
|
|
1137
|
+
fun getSessionMetadataForKey(
|
|
1138
|
+
data: ReadableMap,
|
|
1139
|
+
promise: Promise?,
|
|
1140
|
+
) {
|
|
910
1141
|
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
911
1142
|
|
|
912
1143
|
hms?.getSessionMetadataForKey(data, promise)
|
|
913
1144
|
}
|
|
914
1145
|
|
|
915
1146
|
@ReactMethod
|
|
916
|
-
fun addKeyChangeListener(
|
|
1147
|
+
fun addKeyChangeListener(
|
|
1148
|
+
data: ReadableMap,
|
|
1149
|
+
promise: Promise?,
|
|
1150
|
+
) {
|
|
917
1151
|
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
918
1152
|
|
|
919
1153
|
hms?.addKeyChangeListener(data, promise)
|
|
920
1154
|
}
|
|
921
1155
|
|
|
922
1156
|
@ReactMethod
|
|
923
|
-
fun removeKeyChangeListener(
|
|
1157
|
+
fun removeKeyChangeListener(
|
|
1158
|
+
data: ReadableMap,
|
|
1159
|
+
promise: Promise?,
|
|
1160
|
+
) {
|
|
924
1161
|
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
925
1162
|
|
|
926
1163
|
hms?.removeKeyChangeListener(data, promise)
|
|
927
1164
|
}
|
|
928
1165
|
|
|
929
1166
|
@ReactMethod
|
|
930
|
-
fun getRoomLayout(
|
|
1167
|
+
fun getRoomLayout(
|
|
1168
|
+
data: ReadableMap,
|
|
1169
|
+
promise: Promise?,
|
|
1170
|
+
) {
|
|
931
1171
|
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
932
1172
|
|
|
933
1173
|
hms?.getRoomLayout(data, promise)
|
|
934
1174
|
}
|
|
935
1175
|
|
|
936
|
-
|
|
1176
|
+
@ReactMethod
|
|
1177
|
+
fun raiseLocalPeerHand(
|
|
1178
|
+
data: ReadableMap,
|
|
1179
|
+
promise: Promise?,
|
|
1180
|
+
) {
|
|
1181
|
+
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
1182
|
+
hms?.raiseLocalPeerHand(data, promise)
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1185
|
+
@ReactMethod
|
|
1186
|
+
fun lowerLocalPeerHand(
|
|
1187
|
+
data: ReadableMap,
|
|
1188
|
+
promise: Promise?,
|
|
1189
|
+
) {
|
|
1190
|
+
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
1191
|
+
hms?.lowerLocalPeerHand(data, promise)
|
|
1192
|
+
}
|
|
1193
|
+
|
|
1194
|
+
fun lowerRemotePeerHand(
|
|
1195
|
+
data: ReadableMap,
|
|
1196
|
+
promise: Promise?,
|
|
1197
|
+
) {
|
|
1198
|
+
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
1199
|
+
hms?.lowerRemotePeerHand(data, promise)
|
|
1200
|
+
}
|
|
1201
|
+
|
|
1202
|
+
@ReactMethod(isBlockingSynchronousMethod = true)
|
|
1203
|
+
fun getPeerListIterator(data: ReadableMap): WritableMap? {
|
|
1204
|
+
val hms = HMSHelper.getHms(data, hmsCollection) ?: return null
|
|
1205
|
+
return hms.getPeerListIterator(data)
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1208
|
+
@ReactMethod
|
|
1209
|
+
fun peerListIteratorHasNext(
|
|
1210
|
+
data: ReadableMap,
|
|
1211
|
+
promise: Promise?,
|
|
1212
|
+
) {
|
|
1213
|
+
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
1214
|
+
hms?.peerListIteratorHasNext(data, promise)
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
@ReactMethod
|
|
1218
|
+
fun peerListIteratorNext(
|
|
1219
|
+
data: ReadableMap,
|
|
1220
|
+
promise: Promise?,
|
|
1221
|
+
) {
|
|
1222
|
+
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
1223
|
+
hms?.peerListIteratorNext(data, promise)
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
fun emitEvent(
|
|
1227
|
+
event: String,
|
|
1228
|
+
data: WritableMap,
|
|
1229
|
+
) {
|
|
937
1230
|
reactApplicationContext
|
|
938
1231
|
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
|
|
939
1232
|
.emit(event, data)
|
|
940
1233
|
}
|
|
941
1234
|
|
|
942
|
-
override fun onActivityCreated(
|
|
1235
|
+
override fun onActivityCreated(
|
|
1236
|
+
activity: Activity,
|
|
1237
|
+
savedInstanceState: Bundle?,
|
|
1238
|
+
) {}
|
|
943
1239
|
|
|
944
1240
|
override fun onActivityStarted(activity: Activity) {}
|
|
945
1241
|
|
|
@@ -949,7 +1245,10 @@ class HMSManager(reactContext: ReactApplicationContext) :
|
|
|
949
1245
|
|
|
950
1246
|
override fun onActivityStopped(activity: Activity) {}
|
|
951
1247
|
|
|
952
|
-
override fun onActivitySaveInstanceState(
|
|
1248
|
+
override fun onActivitySaveInstanceState(
|
|
1249
|
+
activity: Activity,
|
|
1250
|
+
outState: Bundle,
|
|
1251
|
+
) {}
|
|
953
1252
|
|
|
954
1253
|
override fun onActivityDestroyed(activity: Activity) {
|
|
955
1254
|
try {
|