@100mslive/react-native-hms 1.9.2 → 1.9.3
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/README.md +5 -1
- package/android/local.properties +8 -1
- package/android/src/main/java/com/reactnativehmssdk/HMSHelper.kt +20 -9
- package/android/src/main/java/com/reactnativehmssdk/HMSManager.kt +72 -13
- package/android/src/main/java/com/reactnativehmssdk/HMSRNSDK.kt +63 -8
- package/ios/HMSDecoder.swift +1 -3
- package/ios/HMSHelper.swift +2 -2
- package/ios/HMSRNSDK.swift +23 -7
- 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/HMSCameraControl.js +1 -1
- package/lib/commonjs/classes/HMSCameraControl.js.map +1 -1
- package/lib/commonjs/classes/HMSEncoder.js +1 -1
- package/lib/commonjs/classes/HMSEncoder.js.map +1 -1
- package/lib/commonjs/classes/HMSNativeEventListener.js +1 -1
- package/lib/commonjs/classes/HMSNativeEventListener.js.map +1 -1
- package/lib/commonjs/classes/HMSPeerListIterator.js +1 -1
- package/lib/commonjs/classes/HMSPeerListIterator.js.map +1 -1
- package/lib/commonjs/classes/HMSPeersCache.js +1 -1
- package/lib/commonjs/classes/HMSPeersCache.js.map +1 -1
- package/lib/commonjs/classes/HMSRoomCache.js +1 -1
- package/lib/commonjs/classes/HMSRoomCache.js.map +1 -1
- package/lib/commonjs/classes/HMSSDK.js +1 -8
- package/lib/commonjs/classes/HMSSDK.js.map +1 -1
- package/lib/commonjs/classes/HMSSessionStore.js +1 -1
- package/lib/commonjs/classes/HMSSessionStore.js.map +1 -1
- package/lib/commonjs/index.js +11 -2
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/utils/notification.js +13 -0
- package/lib/commonjs/utils/notification.js.map +1 -0
- package/lib/module/classes/HMSCameraControl.js +1 -1
- package/lib/module/classes/HMSCameraControl.js.map +1 -1
- package/lib/module/classes/HMSEncoder.js +1 -1
- package/lib/module/classes/HMSEncoder.js.map +1 -1
- package/lib/module/classes/HMSNativeEventListener.js +1 -1
- package/lib/module/classes/HMSNativeEventListener.js.map +1 -1
- package/lib/module/classes/HMSPeerListIterator.js +1 -1
- package/lib/module/classes/HMSPeerListIterator.js.map +1 -1
- package/lib/module/classes/HMSPeersCache.js +1 -1
- package/lib/module/classes/HMSPeersCache.js.map +1 -1
- package/lib/module/classes/HMSRoomCache.js +1 -1
- package/lib/module/classes/HMSRoomCache.js.map +1 -1
- package/lib/module/classes/HMSSDK.js +1 -8
- package/lib/module/classes/HMSSDK.js.map +1 -1
- package/lib/module/classes/HMSSessionStore.js +1 -1
- package/lib/module/classes/HMSSessionStore.js.map +1 -1
- package/lib/module/index.js +5 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/utils/notification.js +5 -0
- package/lib/module/utils/notification.js.map +1 -0
- package/lib/typescript/classes/HMSSDK.d.ts +1 -2
- package/lib/typescript/index.d.ts +3 -1
- package/lib/typescript/utils/notification.d.ts +5 -0
- package/package.json +1 -1
- package/sdk-versions.json +2 -2
- package/src/classes/HMSCameraControl.ts +1 -1
- package/src/classes/HMSEncoder.ts +1 -1
- package/src/classes/HMSNativeEventListener.ts +1 -1
- package/src/classes/HMSPeerListIterator.ts +8 -6
- package/src/classes/HMSPeersCache.ts +1 -1
- package/src/classes/HMSRoomCache.ts +1 -1
- package/src/classes/HMSSDK.tsx +34 -35
- package/src/classes/HMSSessionStore.ts +1 -1
- package/src/index.ts +5 -1
- package/src/utils/notification.ts +10 -0
- /package/lib/commonjs/{classes → modules}/HMSManagerModule.js +0 -0
- /package/lib/commonjs/{classes → modules}/HMSManagerModule.js.map +0 -0
- /package/lib/module/{classes → modules}/HMSManagerModule.js +0 -0
- /package/lib/module/{classes → modules}/HMSManagerModule.js.map +0 -0
- /package/lib/typescript/{classes → modules}/HMSManagerModule.d.ts +0 -0
- /package/src/{classes → modules}/HMSManagerModule.ts +0 -0
package/README.md
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
[](https://www.npmjs.com/package/@100mslive/react-native-hms)
|
|
6
6
|
[](https://www.100ms.live/)
|
|
7
7
|
[](https://www.npmjs.com/package/@100mslive/react-native-hms)
|
|
8
|
-
[](https://www.npmjs.com/package/@100mslive/react-native-hms)
|
|
9
8
|
[](https://www.npmjs.com/package/@100mslive/react-native-hms)
|
|
10
9
|
[](https://docs.100ms.live/react-native/v2/foundation/basics)
|
|
11
10
|
[](https://100ms.live/discord)
|
|
@@ -22,6 +21,11 @@ With support for HLS and RTMP Live Streaming and Recording, Picture-in-Picture (
|
|
|
22
21
|
|
|
23
22
|
📖 Read the Complete Documentation here: https://www.100ms.live/docs/react-native/v2/foundation/basics
|
|
24
23
|
|
|
24
|
+
| Package | Version |
|
|
25
|
+
| -------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
|
|
26
|
+
| @100mslive/react-native-room-kit | [](https://www.npmjs.com/package/@100mslive/react-native-room-kit) |
|
|
27
|
+
| @100mslive/react-native-hms | [](https://www.npmjs.com/package/@100mslive/react-native-hms) |
|
|
28
|
+
|
|
25
29
|
## 🏃 Example App
|
|
26
30
|
|
|
27
31
|
📲 Download the Example iOS app here: https://testflight.apple.com/join/v4bSIPad
|
package/android/local.properties
CHANGED
|
@@ -1 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
## This file must *NOT* be checked into Version Control Systems,
|
|
2
|
+
# as it contains information specific to your local configuration.
|
|
3
|
+
#
|
|
4
|
+
# Location of the SDK. This is only used by Gradle.
|
|
5
|
+
# For customization when using a Version Control System, please read the
|
|
6
|
+
# header note.
|
|
7
|
+
#Mon Nov 14 20:51:00 IST 2022
|
|
8
|
+
sdk.dir=/Users/jatinnagar/Library/Android/sdk
|
|
@@ -15,6 +15,7 @@ import live.hms.video.audio.HMSAudioManager
|
|
|
15
15
|
import live.hms.video.error.HMSException
|
|
16
16
|
import live.hms.video.events.AgentType
|
|
17
17
|
import live.hms.video.media.settings.*
|
|
18
|
+
import live.hms.video.media.tracks.HMSAudioTrack
|
|
18
19
|
import live.hms.video.media.tracks.HMSRemoteAudioTrack
|
|
19
20
|
import live.hms.video.media.tracks.HMSRemoteVideoTrack
|
|
20
21
|
import live.hms.video.media.tracks.HMSTrack
|
|
@@ -126,15 +127,18 @@ object HMSHelper {
|
|
|
126
127
|
val limit = 1
|
|
127
128
|
val peerIds = arrayListOf(peerId)
|
|
128
129
|
val peerListIterator = hmsSDK.getPeerListIterator(PeerListIteratorOptions(limit = limit, byPeerIds = peerIds))
|
|
129
|
-
peerListIterator.next(
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
130
|
+
peerListIterator.next(
|
|
131
|
+
object : PeerListResultListener {
|
|
132
|
+
override fun onError(error: HMSException) {
|
|
133
|
+
it.resumeWithException(error)
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
override fun onSuccess(result: ArrayList<HMSPeer>) {
|
|
137
|
+
val peerFromIterator = result[0]
|
|
138
|
+
it.resume(peerFromIterator as? HMSRemotePeer)
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
)
|
|
138
142
|
}
|
|
139
143
|
} else {
|
|
140
144
|
it.resume(null)
|
|
@@ -184,6 +188,13 @@ object HMSHelper {
|
|
|
184
188
|
return null
|
|
185
189
|
}
|
|
186
190
|
|
|
191
|
+
fun getAllAudioTracks(room: HMSRoom?): ArrayList<HMSAudioTrack>? {
|
|
192
|
+
if (room != null) {
|
|
193
|
+
return HmsUtilities.getAllAudioTracks(room)
|
|
194
|
+
}
|
|
195
|
+
return null
|
|
196
|
+
}
|
|
197
|
+
|
|
187
198
|
fun getRemoteVideoTrackFromTrackId(
|
|
188
199
|
trackId: String?,
|
|
189
200
|
room: HMSRoom?,
|
|
@@ -9,7 +9,9 @@ import android.content.res.Configuration
|
|
|
9
9
|
import android.os.Build
|
|
10
10
|
import android.os.Bundle
|
|
11
11
|
import android.util.Rational
|
|
12
|
+
import android.view.WindowManager
|
|
12
13
|
import androidx.annotation.RequiresApi
|
|
14
|
+
import androidx.core.app.NotificationManagerCompat
|
|
13
15
|
import com.facebook.react.bridge.*
|
|
14
16
|
import com.facebook.react.module.annotations.ReactModule
|
|
15
17
|
import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
@@ -24,12 +26,13 @@ class HMSManager(reactContext: ReactApplicationContext) :
|
|
|
24
26
|
const val REACT_CLASS = "HMSManager"
|
|
25
27
|
var hmsCollection = mutableMapOf<String, HMSRNSDK>()
|
|
26
28
|
|
|
29
|
+
private var isInPIPMode = false
|
|
27
30
|
var reactAppContext: ReactApplicationContext? = null
|
|
28
|
-
var pipParamConfig: PipParamConfig? = null
|
|
29
|
-
var pipParamsUntyped: Any? = null
|
|
31
|
+
var pipParamConfig: PipParamConfig? = null
|
|
32
|
+
var pipParamsUntyped: Any? = null
|
|
30
33
|
var emitter: DeviceEventManagerModule.RCTDeviceEventEmitter? = null
|
|
31
34
|
|
|
32
|
-
fun
|
|
35
|
+
private fun emitPipEvent(isInPictureInPictureMode: Boolean) {
|
|
33
36
|
emitter?.let {
|
|
34
37
|
val data = Arguments.createMap()
|
|
35
38
|
data.putBoolean("isInPictureInPictureMode", isInPictureInPictureMode)
|
|
@@ -38,14 +41,32 @@ class HMSManager(reactContext: ReactApplicationContext) :
|
|
|
38
41
|
}
|
|
39
42
|
}
|
|
40
43
|
|
|
44
|
+
fun onPictureInPictureModeChanged(
|
|
45
|
+
isInPictureInPictureMode: Boolean,
|
|
46
|
+
newConfig: Configuration,
|
|
47
|
+
) {
|
|
48
|
+
if (isInPictureInPictureMode) {
|
|
49
|
+
isInPIPMode = true
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
fun onResume() {
|
|
54
|
+
if (isInPIPMode) {
|
|
55
|
+
isInPIPMode = false
|
|
56
|
+
reactAppContext?.currentActivity?.window?.clearFlags(WindowManager.LayoutParams.FLAG_SECURE)
|
|
57
|
+
emitPipEvent(false)
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
41
61
|
fun onUserLeaveHint() {
|
|
42
62
|
val pipParams = pipParamsUntyped
|
|
43
63
|
if (
|
|
44
64
|
Build.VERSION.SDK_INT >= Build.VERSION_CODES.O &&
|
|
45
|
-
Build.VERSION.SDK_INT < Build.VERSION_CODES.S &&
|
|
46
65
|
pipParamConfig?.autoEnterPipMode == true &&
|
|
47
66
|
pipParams is android.app.PictureInPictureParams
|
|
48
67
|
) {
|
|
68
|
+
reactAppContext?.currentActivity?.window?.addFlags(WindowManager.LayoutParams.FLAG_SECURE)
|
|
69
|
+
emitPipEvent(true)
|
|
49
70
|
reactAppContext?.currentActivity?.enterPictureInPictureMode(pipParams)
|
|
50
71
|
}
|
|
51
72
|
}
|
|
@@ -65,12 +86,13 @@ class HMSManager(reactContext: ReactApplicationContext) :
|
|
|
65
86
|
|
|
66
87
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
67
88
|
currentActivity?.let {
|
|
68
|
-
|
|
89
|
+
pipReceiver?.register(it)
|
|
69
90
|
}
|
|
70
91
|
}
|
|
71
92
|
|
|
72
|
-
emitter =
|
|
73
|
-
|
|
93
|
+
emitter =
|
|
94
|
+
reactApplicationContext
|
|
95
|
+
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
|
|
74
96
|
}
|
|
75
97
|
}
|
|
76
98
|
|
|
@@ -301,7 +323,10 @@ class HMSManager(reactContext: ReactApplicationContext) :
|
|
|
301
323
|
}
|
|
302
324
|
|
|
303
325
|
@ReactMethod
|
|
304
|
-
fun setPlaybackAllowed(
|
|
326
|
+
fun setPlaybackAllowed(
|
|
327
|
+
data: ReadableMap,
|
|
328
|
+
callback: Promise?,
|
|
329
|
+
) {
|
|
305
330
|
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
306
331
|
|
|
307
332
|
hms?.setPlaybackAllowed(data, callback)
|
|
@@ -348,7 +373,10 @@ class HMSManager(reactContext: ReactApplicationContext) :
|
|
|
348
373
|
}
|
|
349
374
|
|
|
350
375
|
@ReactMethod
|
|
351
|
-
fun setVolume(
|
|
376
|
+
fun setVolume(
|
|
377
|
+
data: ReadableMap,
|
|
378
|
+
callback: Promise?,
|
|
379
|
+
) {
|
|
352
380
|
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
353
381
|
|
|
354
382
|
hms?.setVolume(data, callback)
|
|
@@ -365,7 +393,10 @@ class HMSManager(reactContext: ReactApplicationContext) :
|
|
|
365
393
|
}
|
|
366
394
|
|
|
367
395
|
@ReactMethod
|
|
368
|
-
fun setPlaybackForAllAudio(
|
|
396
|
+
fun setPlaybackForAllAudio(
|
|
397
|
+
data: ReadableMap,
|
|
398
|
+
callback: Promise?,
|
|
399
|
+
) {
|
|
369
400
|
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
370
401
|
|
|
371
402
|
hms?.setPlaybackForAllAudio(data, callback)
|
|
@@ -573,14 +604,20 @@ class HMSManager(reactContext: ReactApplicationContext) :
|
|
|
573
604
|
}
|
|
574
605
|
|
|
575
606
|
@ReactMethod
|
|
576
|
-
fun switchAudioOutput(
|
|
607
|
+
fun switchAudioOutput(
|
|
608
|
+
data: ReadableMap,
|
|
609
|
+
callback: Promise?,
|
|
610
|
+
) {
|
|
577
611
|
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
578
612
|
|
|
579
613
|
hms?.switchAudioOutput(data, callback)
|
|
580
614
|
}
|
|
581
615
|
|
|
582
616
|
@ReactMethod
|
|
583
|
-
fun setAudioMode(
|
|
617
|
+
fun setAudioMode(
|
|
618
|
+
data: ReadableMap,
|
|
619
|
+
callback: Promise?,
|
|
620
|
+
) {
|
|
584
621
|
val hms = HMSHelper.getHms(data, hmsCollection)
|
|
585
622
|
|
|
586
623
|
hms?.setAudioMode(data, callback)
|
|
@@ -851,9 +888,13 @@ class HMSManager(reactContext: ReactApplicationContext) :
|
|
|
851
888
|
}
|
|
852
889
|
|
|
853
890
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
|
854
|
-
it.
|
|
891
|
+
it.setSeamlessResizeEnabled(false)
|
|
855
892
|
}
|
|
856
893
|
|
|
894
|
+
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
|
895
|
+
// it.setAutoEnterEnabled(config.autoEnterPipMode)
|
|
896
|
+
// }
|
|
897
|
+
|
|
857
898
|
// region Setting RemoteActions on PictureInPictureParams
|
|
858
899
|
val hmssdk = getHmsInstance()[PipActionReceiver.sdkIdForPIP!!]?.hmsSDK
|
|
859
900
|
|
|
@@ -1221,6 +1262,24 @@ class HMSManager(reactContext: ReactApplicationContext) :
|
|
|
1221
1262
|
hms?.peerListIteratorNext(data, promise)
|
|
1222
1263
|
}
|
|
1223
1264
|
|
|
1265
|
+
@ReactMethod
|
|
1266
|
+
fun checkNotifications(promise: Promise?) {
|
|
1267
|
+
val reactAppContext = reactAppContext
|
|
1268
|
+
|
|
1269
|
+
if (reactAppContext == null) {
|
|
1270
|
+
promise?.reject(Throwable("`reactAppContext` is not available!"))
|
|
1271
|
+
return
|
|
1272
|
+
}
|
|
1273
|
+
val enabled = NotificationManagerCompat.from(reactAppContext).areNotificationsEnabled()
|
|
1274
|
+
val data: WritableMap = Arguments.createMap()
|
|
1275
|
+
|
|
1276
|
+
data.putString("status", if (enabled) "granted" else "blocked")
|
|
1277
|
+
val settings: WritableMap = Arguments.createMap()
|
|
1278
|
+
data.putMap("settings", settings)
|
|
1279
|
+
|
|
1280
|
+
promise?.resolve(data)
|
|
1281
|
+
}
|
|
1282
|
+
|
|
1224
1283
|
fun emitEvent(
|
|
1225
1284
|
event: String,
|
|
1226
1285
|
data: WritableMap,
|
|
@@ -2,6 +2,7 @@ package com.reactnativehmssdk
|
|
|
2
2
|
|
|
3
3
|
import android.content.Intent
|
|
4
4
|
import android.content.Intent.FLAG_ACTIVITY_NEW_TASK
|
|
5
|
+
import android.os.Build
|
|
5
6
|
import com.facebook.react.bridge.*
|
|
6
7
|
import com.facebook.react.bridge.UiThreadUtil.runOnUiThread
|
|
7
8
|
import com.google.gson.JsonElement
|
|
@@ -52,6 +53,7 @@ class HMSRNSDK(
|
|
|
52
53
|
private var sessionStore: HmsSessionStore? = null
|
|
53
54
|
private val keyChangeObservers = mutableMapOf<String, HMSKeyChangeListener?>()
|
|
54
55
|
private val peerListIterators = mutableMapOf<String, PeerListIterator>()
|
|
56
|
+
private var roomMutedLocally = false
|
|
55
57
|
|
|
56
58
|
init {
|
|
57
59
|
val builder = HMSSDK.Builder(reactApplicationContext)
|
|
@@ -136,6 +138,7 @@ class HMSRNSDK(
|
|
|
136
138
|
sessionStore = null
|
|
137
139
|
keyChangeObservers.clear()
|
|
138
140
|
peerListIterators.clear()
|
|
141
|
+
roomMutedLocally = false
|
|
139
142
|
HMSDecoder.clearRestrictDataStates()
|
|
140
143
|
}
|
|
141
144
|
|
|
@@ -314,6 +317,13 @@ class HMSRNSDK(
|
|
|
314
317
|
|
|
315
318
|
override fun onRemovedFromRoom(notification: HMSRemovedFromRoom) {
|
|
316
319
|
super.onRemovedFromRoom(notification)
|
|
320
|
+
|
|
321
|
+
context.currentActivity?.let {
|
|
322
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && it.isInPictureInPictureMode) {
|
|
323
|
+
it.moveTaskToBack(false)
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
|
|
317
327
|
if (eventsEnableStatus["ON_REMOVED_FROM_ROOM"] != true) {
|
|
318
328
|
cleanup() // resetting states and doing data cleanup
|
|
319
329
|
return
|
|
@@ -378,6 +388,19 @@ class HMSRNSDK(
|
|
|
378
388
|
type: HMSRoomUpdate,
|
|
379
389
|
hmsRoom: HMSRoom,
|
|
380
390
|
) {
|
|
391
|
+
val peerCount = hmsRoom.peerCount
|
|
392
|
+
if (
|
|
393
|
+
type == HMSRoomUpdate.ROOM_PEER_COUNT_UPDATED &&
|
|
394
|
+
peerCount != null &&
|
|
395
|
+
peerCount <= 1 // `peerCount` includes local peer
|
|
396
|
+
) {
|
|
397
|
+
context.currentActivity?.let {
|
|
398
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && it.isInPictureInPictureMode) {
|
|
399
|
+
it.moveTaskToBack(false)
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
|
|
381
404
|
if (eventsEnableStatus["ON_ROOM_UPDATE"] != true) {
|
|
382
405
|
return
|
|
383
406
|
}
|
|
@@ -398,6 +421,19 @@ class HMSRNSDK(
|
|
|
398
421
|
track: HMSTrack,
|
|
399
422
|
peer: HMSPeer,
|
|
400
423
|
) {
|
|
424
|
+
if (
|
|
425
|
+
roomMutedLocally &&
|
|
426
|
+
type == HMSTrackUpdate.TRACK_ADDED &&
|
|
427
|
+
track.type == HMSTrackType.AUDIO &&
|
|
428
|
+
!peer.isLocal
|
|
429
|
+
) {
|
|
430
|
+
val room = hmsSDK?.getRoom()
|
|
431
|
+
val remoteAudioTrack = HMSHelper.getRemoteAudioTrackFromTrackId(track.trackId, room)
|
|
432
|
+
remoteAudioTrack?.let {
|
|
433
|
+
it.isPlaybackAllowed = !roomMutedLocally
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
|
|
401
437
|
if (eventsEnableStatus["ON_TRACK_UPDATE"] != true) {
|
|
402
438
|
return
|
|
403
439
|
}
|
|
@@ -1262,14 +1298,21 @@ class HMSRNSDK(
|
|
|
1262
1298
|
rejectCallback(callback, "Audio tracks not found")
|
|
1263
1299
|
}
|
|
1264
1300
|
|
|
1265
|
-
fun setPlaybackForAllAudio(
|
|
1301
|
+
fun setPlaybackForAllAudio(
|
|
1302
|
+
data: ReadableMap,
|
|
1303
|
+
callback: Promise?,
|
|
1304
|
+
) {
|
|
1266
1305
|
val requiredKeys = HMSHelper.getUnavailableRequiredKey(data, arrayOf(Pair("mute", "Boolean")))
|
|
1267
1306
|
if (requiredKeys === null) {
|
|
1268
1307
|
val mute = data.getBoolean("mute")
|
|
1269
|
-
|
|
1308
|
+
self.roomMutedLocally = mute
|
|
1309
|
+
|
|
1310
|
+
val allAudioTracks = HMSHelper.getAllAudioTracks(hmsSDK?.getRoom())
|
|
1270
1311
|
|
|
1271
|
-
|
|
1272
|
-
it
|
|
1312
|
+
allAudioTracks?.forEach {
|
|
1313
|
+
if (it is HMSRemoteAudioTrack) {
|
|
1314
|
+
it.isPlaybackAllowed = !mute
|
|
1315
|
+
}
|
|
1273
1316
|
}
|
|
1274
1317
|
callback?.resolve(true)
|
|
1275
1318
|
} else {
|
|
@@ -1278,7 +1321,10 @@ class HMSRNSDK(
|
|
|
1278
1321
|
}
|
|
1279
1322
|
}
|
|
1280
1323
|
|
|
1281
|
-
fun setPlaybackAllowed(
|
|
1324
|
+
fun setPlaybackAllowed(
|
|
1325
|
+
data: ReadableMap,
|
|
1326
|
+
callback: Promise?,
|
|
1327
|
+
) {
|
|
1282
1328
|
val requiredKeys =
|
|
1283
1329
|
HMSHelper.getUnavailableRequiredKey(
|
|
1284
1330
|
data,
|
|
@@ -1352,7 +1398,10 @@ class HMSRNSDK(
|
|
|
1352
1398
|
callback?.resolve(roles)
|
|
1353
1399
|
}
|
|
1354
1400
|
|
|
1355
|
-
fun setVolume(
|
|
1401
|
+
fun setVolume(
|
|
1402
|
+
data: ReadableMap,
|
|
1403
|
+
callback: Promise?,
|
|
1404
|
+
) {
|
|
1356
1405
|
val requiredKeys =
|
|
1357
1406
|
HMSHelper.getUnavailableRequiredKey(
|
|
1358
1407
|
data,
|
|
@@ -1603,7 +1652,10 @@ class HMSRNSDK(
|
|
|
1603
1652
|
callback?.resolve(hmsSDK?.getAudioOutputRouteType()?.name)
|
|
1604
1653
|
}
|
|
1605
1654
|
|
|
1606
|
-
fun switchAudioOutput(
|
|
1655
|
+
fun switchAudioOutput(
|
|
1656
|
+
data: ReadableMap,
|
|
1657
|
+
callback: Promise?,
|
|
1658
|
+
) {
|
|
1607
1659
|
val requiredKeys =
|
|
1608
1660
|
HMSHelper.getUnavailableRequiredKey(data, arrayOf(Pair("audioDevice", "String")))
|
|
1609
1661
|
if (requiredKeys === null) {
|
|
@@ -1618,7 +1670,10 @@ class HMSRNSDK(
|
|
|
1618
1670
|
}
|
|
1619
1671
|
}
|
|
1620
1672
|
|
|
1621
|
-
fun setAudioMode(
|
|
1673
|
+
fun setAudioMode(
|
|
1674
|
+
data: ReadableMap,
|
|
1675
|
+
callback: Promise?,
|
|
1676
|
+
) {
|
|
1622
1677
|
val requiredKeys = HMSHelper.getUnavailableRequiredKey(data, arrayOf(Pair("audioMode", "Int")))
|
|
1623
1678
|
if (requiredKeys === null) {
|
|
1624
1679
|
val audioMode = data.getInt("audioMode")
|
package/ios/HMSDecoder.swift
CHANGED
|
@@ -749,8 +749,6 @@ class HMSDecoder: NSObject {
|
|
|
749
749
|
|
|
750
750
|
if let recordingState = data {
|
|
751
751
|
state["running"] = recordingState.running
|
|
752
|
-
state["singleFilePerLayer"] = recordingState.singleFilePerLayer
|
|
753
|
-
state["videoOnDemand"] = recordingState.enableVOD
|
|
754
752
|
if let startedAt = recordingState.startedAt?.timeIntervalSince1970 {
|
|
755
753
|
state["startedAt"] = startedAt * 1000
|
|
756
754
|
}
|
|
@@ -766,7 +764,7 @@ class HMSDecoder: NSObject {
|
|
|
766
764
|
var decodedVariant = [String: Any]()
|
|
767
765
|
decodedVariant["meetingUrl"] = variant.meetingURL.absoluteString
|
|
768
766
|
decodedVariant["metadata"] = variant.metadata
|
|
769
|
-
decodedVariant["hlsStreamUrl"] = variant.url
|
|
767
|
+
decodedVariant["hlsStreamUrl"] = variant.url?.absoluteString
|
|
770
768
|
if let startedAt = variant.startedAt?.timeIntervalSince1970 {
|
|
771
769
|
decodedVariant["startedAt"] = startedAt * 1000
|
|
772
770
|
}
|
package/ios/HMSHelper.swift
CHANGED
|
@@ -26,7 +26,7 @@ class HMSHelper: NSObject {
|
|
|
26
26
|
return peers.first { $0.peerID == peerID }
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
static func getRemotePeerFromPeerId(_ peerID: String?, hmsSDK: HMSSDK?,
|
|
29
|
+
static func getRemotePeerFromPeerId(_ peerID: String?, hmsSDK: HMSSDK?, completion: @escaping (_ peer: HMSPeer?) -> Void) {
|
|
30
30
|
guard let peerID = peerID, let hms = hmsSDK, let peers = hms.remotePeers else {
|
|
31
31
|
completion(nil)
|
|
32
32
|
return
|
|
@@ -38,7 +38,7 @@ class HMSHelper: NSObject {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
let peerListIterator = hms.getPeerListIterator(options: HMSPeerListIteratorOptions(filterByPeerIds: [peerID], limit: 1))
|
|
41
|
-
peerListIterator.next
|
|
41
|
+
peerListIterator.next { peers, _ in
|
|
42
42
|
guard let nonnilPeers = peers, let firstPeer = nonnilPeers.first else {
|
|
43
43
|
completion(nil)
|
|
44
44
|
return
|
package/ios/HMSRNSDK.swift
CHANGED
|
@@ -30,6 +30,7 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
|
|
|
30
30
|
private var sessionStore: HMSSessionStore?
|
|
31
31
|
private var sessionStoreChangeObservers = [String: NSObjectProtocol]()
|
|
32
32
|
private var peerListIterators = [String: HMSPeerListIterator]()
|
|
33
|
+
private var roomMutedLocally = false
|
|
33
34
|
|
|
34
35
|
// MARK: - Setup
|
|
35
36
|
init(data: NSDictionary?, delegate manager: HMSManager?, uid id: String) {
|
|
@@ -61,7 +62,7 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
|
|
|
61
62
|
DispatchQueue.main.async { [weak self] in
|
|
62
63
|
guard let strongSelf = self else { return }
|
|
63
64
|
|
|
64
|
-
if let endPoint = data["endpoint"] as? String,
|
|
65
|
+
if let endPoint = data["endpoint"] as? String, endPoint.contains("mockable") || endPoint.contains("nonprod") {
|
|
65
66
|
UserDefaults.standard.set(endPoint, forKey: "HMSRoomLayoutEndpointOverride")
|
|
66
67
|
} else {
|
|
67
68
|
UserDefaults.standard.removeObject(forKey: "HMSRoomLayoutEndpointOverride")
|
|
@@ -553,10 +554,10 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
|
|
|
553
554
|
|
|
554
555
|
DispatchQueue.main.async { [weak self] in
|
|
555
556
|
guard let strongSelf = self else { return }
|
|
556
|
-
guard let localPeer =
|
|
557
|
+
guard let localPeer = strongSelf.hms?.localPeer,
|
|
557
558
|
let localTrack = HMSHelper.getLocalTrackFromTrackId(trackId, localPeer: localPeer)
|
|
558
559
|
else {
|
|
559
|
-
guard let remotePeers =
|
|
560
|
+
guard let remotePeers = strongSelf.hms?.remotePeers,
|
|
560
561
|
let track = HMSHelper.getTrackFromTrackId(trackId, remotePeers)
|
|
561
562
|
else {
|
|
562
563
|
reject?("Track not found", "Track not found", nil)
|
|
@@ -853,13 +854,19 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
|
|
|
853
854
|
}
|
|
854
855
|
|
|
855
856
|
DispatchQueue.main.async { [weak self] in
|
|
856
|
-
if let
|
|
857
|
-
|
|
858
|
-
|
|
857
|
+
if let self = self, let room = hms?.room {
|
|
858
|
+
self.roomMutedLocally = mute
|
|
859
|
+
|
|
860
|
+
let audioTracks = HMSUtilities.getAllAudioTracks(in: room)
|
|
861
|
+
|
|
862
|
+
audioTracks.forEach { audioTrack in
|
|
863
|
+
if audioTrack is HMSRemoteAudioTrack {
|
|
864
|
+
(audioTrack as! HMSRemoteAudioTrack).setPlaybackAllowed(!mute)
|
|
865
|
+
}
|
|
859
866
|
}
|
|
860
867
|
resolve?(true)
|
|
861
868
|
} else {
|
|
862
|
-
let errorMessage = "setPlaybackForAllAudio:
|
|
869
|
+
let errorMessage = "setPlaybackForAllAudio: HMSSDK instance not available"
|
|
863
870
|
reject?(errorMessage, errorMessage, nil)
|
|
864
871
|
}
|
|
865
872
|
}
|
|
@@ -1403,6 +1410,14 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
|
|
|
1403
1410
|
}
|
|
1404
1411
|
}
|
|
1405
1412
|
|
|
1413
|
+
if roomMutedLocally && update == .trackAdded && track.kind == .audio && !peer.isLocal, let room = self.hms?.room {
|
|
1414
|
+
if let audioTrack = HMSUtilities.getAudioTrack(for: track.trackId, in: room) {
|
|
1415
|
+
if audioTrack is HMSRemoteAudioTrack {
|
|
1416
|
+
(audioTrack as! HMSRemoteAudioTrack).setPlaybackAllowed(!roomMutedLocally)
|
|
1417
|
+
}
|
|
1418
|
+
}
|
|
1419
|
+
}
|
|
1420
|
+
|
|
1406
1421
|
if eventsEnableStatus[HMSConstants.ON_TRACK_UPDATE] != true {
|
|
1407
1422
|
return
|
|
1408
1423
|
}
|
|
@@ -1989,6 +2004,7 @@ class HMSRNSDK: HMSUpdateListener, HMSPreviewListener {
|
|
|
1989
2004
|
self.sessionStore = nil
|
|
1990
2005
|
self.sessionStoreChangeObservers.removeAll()
|
|
1991
2006
|
self.peerListIterators.removeAll()
|
|
2007
|
+
self.roomMutedLocally = false
|
|
1992
2008
|
HMSDecoder.clearRestrictDataStates()
|
|
1993
2009
|
}
|
|
1994
2010
|
|
|
Binary file
|
package/ios/Hmssdk.xcodeproj/xcuserdata/jatinnagar.xcuserdatad/xcschemes/xcschememanagement.plist
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<plist version="1.0">
|
|
4
|
+
<dict>
|
|
5
|
+
<key>SchemeUserState</key>
|
|
6
|
+
<dict>
|
|
7
|
+
<key>Hmssdk.xcscheme_^#shared#^_</key>
|
|
8
|
+
<dict>
|
|
9
|
+
<key>orderHint</key>
|
|
10
|
+
<integer>0</integer>
|
|
11
|
+
</dict>
|
|
12
|
+
</dict>
|
|
13
|
+
</dict>
|
|
14
|
+
</plist>
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.HMSCameraControl = void 0;
|
|
7
7
|
var _HMSConstants = require("./HMSConstants");
|
|
8
|
-
var _HMSManagerModule = _interopRequireDefault(require("
|
|
8
|
+
var _HMSManagerModule = _interopRequireDefault(require("../modules/HMSManagerModule"));
|
|
9
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
10
|
class HMSCameraControl {
|
|
11
11
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_HMSConstants","require","_HMSManagerModule","_interopRequireDefault","obj","__esModule","default","HMSCameraControl","captureImageAtMaxSupportedResolution","flash","HMSManager","id","HMSConstants","DEFAULT_SDK_ID","exports"],"sources":["HMSCameraControl.ts"],"sourcesContent":["import { HMSConstants } from './HMSConstants';\n\nimport HMSManager from '
|
|
1
|
+
{"version":3,"names":["_HMSConstants","require","_HMSManagerModule","_interopRequireDefault","obj","__esModule","default","HMSCameraControl","captureImageAtMaxSupportedResolution","flash","HMSManager","id","HMSConstants","DEFAULT_SDK_ID","exports"],"sources":["HMSCameraControl.ts"],"sourcesContent":["import { HMSConstants } from './HMSConstants';\n\nimport HMSManager from '../modules/HMSManagerModule';\n\nexport class HMSCameraControl {\n /**\n * It captures the image from the device camera at max possible resolution.\n *\n * @param {boolean} [flash=false] flash - value indicating whether to use flash while capturing image or not\n * @returns Promise - which is resolved with the file path of the captured image saved on the disk\n */\n static captureImageAtMaxSupportedResolution(\n flash: boolean = false\n ): Promise<string> {\n return HMSManager.captureImageAtMaxSupportedResolution({\n id: HMSConstants.DEFAULT_SDK_ID,\n flash,\n });\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AAEA,IAAAC,iBAAA,GAAAC,sBAAA,CAAAF,OAAA;AAAqD,SAAAE,uBAAAC,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAE9C,MAAMG,gBAAgB,CAAC;EAC5B;AACF;AACA;AACA;AACA;AACA;EACE,OAAOC,oCAAoCA,CACzCC,KAAc,GAAG,KAAK,EACL;IACjB,OAAOC,yBAAU,CAACF,oCAAoC,CAAC;MACrDG,EAAE,EAAEC,0BAAY,CAACC,cAAc;MAC/BJ;IACF,CAAC,CAAC;EACJ;AACF;AAACK,OAAA,CAAAP,gBAAA,GAAAA,gBAAA"}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.HMSEncoder = void 0;
|
|
7
|
-
var _HMSManagerModule = _interopRequireDefault(require("
|
|
7
|
+
var _HMSManagerModule = _interopRequireDefault(require("../modules/HMSManagerModule"));
|
|
8
8
|
var _HMSTrack = require("./HMSTrack");
|
|
9
9
|
var _HMSAudioTrack = require("./HMSAudioTrack");
|
|
10
10
|
var _HMSVideoTrack = require("./HMSVideoTrack");
|