@100mslive/react-native-hms 1.9.1 → 1.9.3-beta.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/README.md +0 -1
- package/android/src/main/java/com/reactnativehmssdk/HMSHelper.kt +21 -11
- package/android/src/main/java/com/reactnativehmssdk/HMSManager.kt +72 -20
- package/android/src/main/java/com/reactnativehmssdk/HMSRNSDK.kt +63 -28
- package/ios/HMSDecoder.swift +1 -3
- package/ios/HMSHelper.swift +2 -2
- package/ios/HMSRNSDK.swift +23 -7
- package/lib/commonjs/classes/HMSCameraControl.js +2 -3
- 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 +17 -57
- 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/classes/HmsView.js +3 -4
- package/lib/commonjs/classes/HmsView.js.map +1 -1
- package/lib/commonjs/components/HMSHLSPlayer/HMSHLSPlayer.js +13 -16
- package/lib/commonjs/components/HMSHLSPlayer/HMSHLSPlayer.js.map +1 -1
- package/lib/commonjs/hooks/useHMSPeerUpdates.js +1 -2
- package/lib/commonjs/hooks/useHMSPeerUpdates.js.map +1 -1
- package/lib/commonjs/index.js +11 -2
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/stores/hms-store.js +4 -6
- package/lib/commonjs/stores/hms-store.js.map +1 -1
- package/lib/commonjs/utils/emitter/EventEmitter.js +1 -4
- package/lib/commonjs/utils/emitter/EventEmitter.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 +2 -3
- 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 +18 -58
- 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/classes/HmsView.js +3 -4
- package/lib/module/classes/HmsView.js.map +1 -1
- package/lib/module/components/HMSHLSPlayer/HMSHLSPlayer.js +13 -16
- package/lib/module/components/HMSHLSPlayer/HMSHLSPlayer.js.map +1 -1
- package/lib/module/hooks/useHMSPeerUpdates.js +1 -2
- package/lib/module/hooks/useHMSPeerUpdates.js.map +1 -1
- package/lib/module/index.js +5 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/stores/hms-store.js +4 -6
- package/lib/module/stores/hms-store.js.map +1 -1
- package/lib/module/utils/emitter/EventEmitter.js +1 -4
- package/lib/module/utils/emitter/EventEmitter.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 -11
- 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 +35 -61
- 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
|
@@ -2,14 +2,13 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
2
2
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
3
3
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
4
4
|
import React from 'react';
|
|
5
|
-
import {
|
|
5
|
+
import { Platform } from 'react-native';
|
|
6
6
|
import { HMSEncoder } from './HMSEncoder';
|
|
7
7
|
import { HMSHelper } from './HMSHelper';
|
|
8
8
|
import { getLogger, logger, setLogger } from './HMSLogger';
|
|
9
|
-
import { HMSTrackType } from './HMSTrackType';
|
|
10
9
|
import { HMSUpdateListenerActions } from './HMSUpdateListenerActions';
|
|
11
10
|
import { HmsViewComponent } from './HmsView';
|
|
12
|
-
import HMSManager from '
|
|
11
|
+
import HMSManager from '../modules/HMSManagerModule';
|
|
13
12
|
import { HMSPIPListenerActions } from './HMSPIPListenerActions';
|
|
14
13
|
import HMSNativeEventListener from './HMSNativeEventListener';
|
|
15
14
|
import { clearHmsPeersCache, getHmsPeersCache, HMSPeersCache, setHmsPeersCache } from './HMSPeersCache';
|
|
@@ -21,9 +20,7 @@ const ReactNativeVersion = require('react-native/Libraries/Core/ReactNativeVersi
|
|
|
21
20
|
let HmsSdk;
|
|
22
21
|
export class HMSSDK {
|
|
23
22
|
constructor(id) {
|
|
24
|
-
var _this = this;
|
|
25
23
|
_defineProperty(this, "id", void 0);
|
|
26
|
-
_defineProperty(this, "muteStatus", void 0);
|
|
27
24
|
_defineProperty(this, "appStateSubscription", void 0);
|
|
28
25
|
_defineProperty(this, "onPreviewDelegate", void 0);
|
|
29
26
|
_defineProperty(this, "onJoinDelegate", void 0);
|
|
@@ -100,7 +97,6 @@ export class HMSSDK {
|
|
|
100
97
|
config,
|
|
101
98
|
id: this.id
|
|
102
99
|
});
|
|
103
|
-
this.addAppStateListener();
|
|
104
100
|
setHmsPeersCache(new HMSPeersCache(this.id));
|
|
105
101
|
setHmsRoomCache(new HMSRoomCache(this.id));
|
|
106
102
|
await HMSManager.join({
|
|
@@ -161,7 +157,6 @@ export class HMSSDK {
|
|
|
161
157
|
}));
|
|
162
158
|
_defineProperty(this, "roomLeaveCleanup", () => {
|
|
163
159
|
var _this$appStateSubscri;
|
|
164
|
-
this.muteStatus = undefined;
|
|
165
160
|
this === null || this === void 0 || (_this$appStateSubscri = this.appStateSubscription) === null || _this$appStateSubscri === void 0 || _this$appStateSubscri.remove();
|
|
166
161
|
clearHmsPeersCache();
|
|
167
162
|
clearHmsRoomCache();
|
|
@@ -194,17 +189,16 @@ export class HMSSDK {
|
|
|
194
189
|
* @param message the message that is to be sent
|
|
195
190
|
* @param type the default type is set to CHAT. You can pass a custom type here for sending events like Emoji Reactions, Notifications, etc
|
|
196
191
|
*/
|
|
197
|
-
_defineProperty(this, "sendBroadcastMessage", async
|
|
198
|
-
let type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'chat';
|
|
192
|
+
_defineProperty(this, "sendBroadcastMessage", async (message, type = 'chat') => {
|
|
199
193
|
logger === null || logger === void 0 || logger.verbose('#Function sendBroadcastMessage', {
|
|
200
194
|
message,
|
|
201
195
|
type: type || null,
|
|
202
|
-
id:
|
|
196
|
+
id: this.id
|
|
203
197
|
});
|
|
204
198
|
const data = await HMSManager.sendBroadcastMessage({
|
|
205
199
|
message,
|
|
206
200
|
type: type || null,
|
|
207
|
-
id:
|
|
201
|
+
id: this.id
|
|
208
202
|
});
|
|
209
203
|
return data;
|
|
210
204
|
});
|
|
@@ -216,18 +210,17 @@ export class HMSSDK {
|
|
|
216
210
|
*
|
|
217
211
|
* @memberof HMSSDK
|
|
218
212
|
*/
|
|
219
|
-
_defineProperty(this, "sendGroupMessage", async
|
|
220
|
-
let type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'chat';
|
|
213
|
+
_defineProperty(this, "sendGroupMessage", async (message, roles, type = 'chat') => {
|
|
221
214
|
logger === null || logger === void 0 || logger.verbose('#Function sendGroupMessage', {
|
|
222
215
|
message,
|
|
223
216
|
roles,
|
|
224
|
-
id:
|
|
217
|
+
id: this.id,
|
|
225
218
|
type: type || null
|
|
226
219
|
});
|
|
227
220
|
const data = await HMSManager.sendGroupMessage({
|
|
228
221
|
message,
|
|
229
222
|
roles: HMSHelper.getRoleNames(roles),
|
|
230
|
-
id:
|
|
223
|
+
id: this.id,
|
|
231
224
|
type: type || null
|
|
232
225
|
});
|
|
233
226
|
return data;
|
|
@@ -240,18 +233,17 @@ export class HMSSDK {
|
|
|
240
233
|
*
|
|
241
234
|
* @memberof HMSSDK
|
|
242
235
|
*/
|
|
243
|
-
_defineProperty(this, "sendDirectMessage", async
|
|
244
|
-
let type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'chat';
|
|
236
|
+
_defineProperty(this, "sendDirectMessage", async (message, peer, type = 'chat') => {
|
|
245
237
|
logger === null || logger === void 0 || logger.verbose('#Function sendDirectMessage', {
|
|
246
238
|
message,
|
|
247
239
|
peerId: peer.peerID,
|
|
248
|
-
id:
|
|
240
|
+
id: this.id,
|
|
249
241
|
type: type || null
|
|
250
242
|
});
|
|
251
243
|
const data = await HMSManager.sendDirectMessage({
|
|
252
244
|
message,
|
|
253
245
|
peerId: peer.peerID,
|
|
254
|
-
id:
|
|
246
|
+
id: this.id,
|
|
255
247
|
type: type || null
|
|
256
248
|
});
|
|
257
249
|
return data;
|
|
@@ -362,13 +354,12 @@ export class HMSSDK {
|
|
|
362
354
|
*
|
|
363
355
|
* @memberof HMSSDK
|
|
364
356
|
*/
|
|
365
|
-
_defineProperty(this, "changeRole", async
|
|
366
|
-
let force = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
357
|
+
_defineProperty(this, "changeRole", async (peer, role, force = false) => {
|
|
367
358
|
const data = {
|
|
368
359
|
peerId: peer === null || peer === void 0 ? void 0 : peer.peerID,
|
|
369
360
|
role: role === null || role === void 0 ? void 0 : role.name,
|
|
370
361
|
force: force,
|
|
371
|
-
id:
|
|
362
|
+
id: this.id
|
|
372
363
|
};
|
|
373
364
|
logger === null || logger === void 0 || logger.verbose('#Function changeRole', data);
|
|
374
365
|
return await HMSManager.changeRole(data);
|
|
@@ -387,13 +378,12 @@ export class HMSSDK {
|
|
|
387
378
|
*
|
|
388
379
|
* @memberof HMSSDK
|
|
389
380
|
*/
|
|
390
|
-
_defineProperty(this, "changeRoleOfPeer", async
|
|
391
|
-
let force = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
381
|
+
_defineProperty(this, "changeRoleOfPeer", async (peer, role, force = false) => {
|
|
392
382
|
const data = {
|
|
393
383
|
peerId: peer.peerID,
|
|
394
384
|
role: role.name,
|
|
395
385
|
force: force,
|
|
396
|
-
id:
|
|
386
|
+
id: this.id
|
|
397
387
|
};
|
|
398
388
|
logger === null || logger === void 0 || logger.verbose('#Function changeRoleOfPeer', data);
|
|
399
389
|
return HMSManager.changeRoleOfPeer(data);
|
|
@@ -501,17 +491,16 @@ export class HMSSDK {
|
|
|
501
491
|
*
|
|
502
492
|
* @memberof HMSSDK
|
|
503
493
|
*/
|
|
504
|
-
_defineProperty(this, "endRoom", async
|
|
505
|
-
let lock = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
494
|
+
_defineProperty(this, "endRoom", async (reason, lock = false) => {
|
|
506
495
|
logger === null || logger === void 0 || logger.verbose('#Function endRoom', {
|
|
507
496
|
lock,
|
|
508
497
|
reason,
|
|
509
|
-
id:
|
|
498
|
+
id: this.id
|
|
510
499
|
});
|
|
511
500
|
const data = {
|
|
512
501
|
lock,
|
|
513
502
|
reason,
|
|
514
|
-
id:
|
|
503
|
+
id: this.id
|
|
515
504
|
};
|
|
516
505
|
return await HMSManager.endRoom(data);
|
|
517
506
|
});
|
|
@@ -601,7 +590,6 @@ export class HMSSDK {
|
|
|
601
590
|
mute,
|
|
602
591
|
id: this.id
|
|
603
592
|
});
|
|
604
|
-
this.muteStatus = mute;
|
|
605
593
|
HMSManager.setPlaybackForAllAudio({
|
|
606
594
|
mute,
|
|
607
595
|
id: this.id
|
|
@@ -711,31 +699,6 @@ export class HMSSDK {
|
|
|
711
699
|
volume
|
|
712
700
|
});
|
|
713
701
|
});
|
|
714
|
-
_defineProperty(this, "resetVolume", () => {
|
|
715
|
-
logger === null || logger === void 0 || logger.verbose('#Function resetVolume', {
|
|
716
|
-
id: this.id
|
|
717
|
-
});
|
|
718
|
-
if (Platform.OS === 'android') HMSManager.resetVolume({
|
|
719
|
-
id: this.id
|
|
720
|
-
});
|
|
721
|
-
});
|
|
722
|
-
/**
|
|
723
|
-
* - This is a temporary solution for the situation when mic access is taken from the app and
|
|
724
|
-
* user returns to the app with no mic access. It will re-acquire the mic by setting the volume
|
|
725
|
-
* from native side
|
|
726
|
-
*
|
|
727
|
-
* @memberof HMSSDK
|
|
728
|
-
*/
|
|
729
|
-
_defineProperty(this, "addAppStateListener", () => {
|
|
730
|
-
logger === null || logger === void 0 || logger.verbose('#Function addAppStateListener', {
|
|
731
|
-
id: this.id
|
|
732
|
-
});
|
|
733
|
-
this.appStateSubscription = AppState.addEventListener('change', nextAppState => {
|
|
734
|
-
if (nextAppState === 'active' && Platform.OS === 'android') {
|
|
735
|
-
this.resetVolume();
|
|
736
|
-
}
|
|
737
|
-
});
|
|
738
|
-
});
|
|
739
702
|
/**
|
|
740
703
|
* - This function is used to start screenshare, currently available only for android
|
|
741
704
|
*
|
|
@@ -1877,9 +1840,6 @@ export class HMSSDK {
|
|
|
1877
1840
|
(_getHmsPeersCache3 = getHmsPeersCache()) === null || _getHmsPeersCache3 === void 0 || _getHmsPeersCache3.updatePeerCache(data.peer.peerID, {
|
|
1878
1841
|
track
|
|
1879
1842
|
}, data.type);
|
|
1880
|
-
if (this.muteStatus && (data === null || data === void 0 ? void 0 : data.type) === 'TRACK_ADDED' && track.type === HMSTrackType.AUDIO) {
|
|
1881
|
-
this.setPlaybackForAllAudio(this.muteStatus);
|
|
1882
|
-
}
|
|
1883
1843
|
if (this.onTrackDelegate) {
|
|
1884
1844
|
logger === null || logger === void 0 || logger.verbose('#Listener ON_TRACK_LISTENER_CALL', {
|
|
1885
1845
|
peer,
|