@100mslive/react-native-hms 0.9.1 → 0.9.4
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 +239 -26
- package/android/.gradle/6.9/fileHashes/fileHashes.bin +0 -0
- package/android/.gradle/6.9/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- 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/build.gradle +1 -1
- package/android/src/main/java/com/reactnativehmssdk/HmsDecoder.kt +22 -0
- package/android/src/main/java/com/reactnativehmssdk/HmsHelper.kt +197 -6
- package/android/src/main/java/com/reactnativehmssdk/HmsModule.kt +2 -2
- package/android/src/main/java/com/reactnativehmssdk/HmsSDK.kt +36 -77
- package/android/src/main/java/com/reactnativehmssdk/HmsScreenshareActivity.kt +16 -0
- package/android/src/main/java/com/reactnativehmssdk/HmsView.kt +24 -33
- package/android/src/main/java/com/reactnativehmssdk/HmssdkViewManager.kt +15 -2
- package/ios/HmsDecoder.swift +47 -4
- package/ios/HmsHelper.swift +14 -0
- package/ios/HmsSDK.swift +13 -7
- package/lib/commonjs/classes/HMSConfig.js +3 -0
- package/lib/commonjs/classes/HMSConfig.js.map +1 -1
- package/lib/commonjs/classes/HMSEncoder.js +33 -2
- package/lib/commonjs/classes/HMSEncoder.js.map +1 -1
- package/lib/commonjs/classes/HMSHLSConfig.js +3 -0
- package/lib/commonjs/classes/HMSHLSConfig.js.map +1 -1
- package/lib/commonjs/classes/HMSHLSRecordingConfig.js +23 -0
- package/lib/commonjs/classes/HMSHLSRecordingConfig.js.map +1 -0
- package/lib/commonjs/classes/HMSHLSRecordingState.js +29 -0
- package/lib/commonjs/classes/HMSHLSRecordingState.js.map +1 -0
- package/lib/commonjs/classes/HMSLocalPeer.js.map +1 -1
- package/lib/commonjs/classes/HMSLogger.js +21 -21
- package/lib/commonjs/classes/HMSLogger.js.map +1 -1
- package/lib/commonjs/classes/HMSMessage.js +4 -1
- package/lib/commonjs/classes/HMSMessage.js.map +1 -1
- package/lib/commonjs/classes/HMSMessageRecipient.js +26 -0
- package/lib/commonjs/classes/HMSMessageRecipient.js.map +1 -0
- package/lib/commonjs/classes/HMSMessageRecipientType.js +15 -0
- package/lib/commonjs/classes/HMSMessageRecipientType.js.map +1 -0
- package/lib/commonjs/classes/HMSNetworkQuality.js +20 -0
- package/lib/commonjs/classes/HMSNetworkQuality.js.map +1 -0
- package/lib/commonjs/classes/HMSPeer.js +3 -0
- package/lib/commonjs/classes/HMSPeer.js.map +1 -1
- package/lib/commonjs/classes/HMSPeerUpdate.js +1 -8
- package/lib/commonjs/classes/HMSPeerUpdate.js.map +1 -1
- package/lib/commonjs/classes/HMSRemotePeer.js.map +1 -1
- package/lib/commonjs/classes/HMSRoom.js +3 -0
- package/lib/commonjs/classes/HMSRoom.js.map +1 -1
- package/lib/commonjs/classes/HMSSDK.js +22 -7
- package/lib/commonjs/classes/HMSSDK.js.map +1 -1
- package/lib/commonjs/classes/HmsView.js +10 -6
- package/lib/commonjs/classes/HmsView.js.map +1 -1
- package/lib/commonjs/index.js +70 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/classes/HMSConfig.js +3 -0
- package/lib/module/classes/HMSConfig.js.map +1 -1
- package/lib/module/classes/HMSEncoder.js +31 -2
- package/lib/module/classes/HMSEncoder.js.map +1 -1
- package/lib/module/classes/HMSHLSConfig.js +3 -0
- package/lib/module/classes/HMSHLSConfig.js.map +1 -1
- package/lib/module/classes/HMSHLSRecordingConfig.js +14 -0
- package/lib/module/classes/HMSHLSRecordingConfig.js.map +1 -0
- package/lib/module/classes/HMSHLSRecordingState.js +20 -0
- package/lib/module/classes/HMSHLSRecordingState.js.map +1 -0
- package/lib/module/classes/HMSLocalPeer.js.map +1 -1
- package/lib/module/classes/HMSLogger.js +21 -21
- package/lib/module/classes/HMSLogger.js.map +1 -1
- package/lib/module/classes/HMSMessage.js +4 -1
- package/lib/module/classes/HMSMessage.js.map +1 -1
- package/lib/module/classes/HMSMessageRecipient.js +17 -0
- package/lib/module/classes/HMSMessageRecipient.js.map +1 -0
- package/lib/module/classes/HMSMessageRecipientType.js +8 -0
- package/lib/module/classes/HMSMessageRecipientType.js.map +1 -0
- package/lib/module/classes/HMSNetworkQuality.js +11 -0
- package/lib/module/classes/HMSNetworkQuality.js.map +1 -0
- package/lib/module/classes/HMSPeer.js +3 -0
- package/lib/module/classes/HMSPeer.js.map +1 -1
- package/lib/module/classes/HMSPeerUpdate.js +1 -8
- package/lib/module/classes/HMSPeerUpdate.js.map +1 -1
- package/lib/module/classes/HMSRemotePeer.js.map +1 -1
- package/lib/module/classes/HMSRoom.js +3 -0
- package/lib/module/classes/HMSRoom.js.map +1 -1
- package/lib/module/classes/HMSSDK.js +22 -6
- package/lib/module/classes/HMSSDK.js.map +1 -1
- package/lib/module/classes/HmsView.js +10 -6
- package/lib/module/classes/HmsView.js.map +1 -1
- package/lib/module/index.js +5 -0
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/classes/HMSConfig.d.ts +2 -0
- package/lib/typescript/classes/HMSEncoder.d.ts +4 -0
- package/lib/typescript/classes/HMSHLSConfig.d.ts +5 -2
- package/lib/typescript/classes/HMSHLSRecordingConfig.d.ts +8 -0
- package/lib/typescript/classes/HMSHLSRecordingState.d.ts +12 -0
- package/lib/typescript/classes/HMSLocalPeer.d.ts +2 -0
- package/lib/typescript/classes/HMSMessage.d.ts +8 -4
- package/lib/typescript/classes/HMSMessageRecipient.d.ts +13 -0
- package/lib/typescript/classes/HMSMessageRecipientType.d.ts +5 -0
- package/lib/typescript/classes/HMSNetworkQuality.d.ts +6 -0
- package/lib/typescript/classes/HMSPeer.d.ts +3 -0
- package/lib/typescript/classes/HMSPeerUpdate.d.ts +1 -8
- package/lib/typescript/classes/HMSRemotePeer.d.ts +2 -0
- package/lib/typescript/classes/HMSRoom.d.ts +3 -0
- package/lib/typescript/classes/HMSSDK.d.ts +299 -10
- package/lib/typescript/classes/HmsView.d.ts +4 -2
- package/lib/typescript/index.d.ts +5 -0
- package/package.json +1 -1
- package/react-native-hms.podspec +1 -1
- package/src/classes/HMSConfig.ts +3 -0
- package/src/classes/HMSEncoder.ts +62 -17
- package/src/classes/HMSHLSConfig.ts +8 -2
- package/src/classes/HMSHLSRecordingConfig.ts +9 -0
- package/src/classes/HMSHLSRecordingState.ts +18 -0
- package/src/classes/HMSLocalPeer.ts +2 -0
- package/src/classes/HMSLogger.ts +3 -3
- package/src/classes/HMSMessage.ts +11 -5
- package/src/classes/HMSMessageRecipient.ts +19 -0
- package/src/classes/HMSMessageRecipientType.ts +5 -0
- package/src/classes/HMSNetworkQuality.ts +7 -0
- package/src/classes/HMSPeer.ts +4 -2
- package/src/classes/HMSPeerUpdate.ts +1 -8
- package/src/classes/HMSRemotePeer.ts +2 -0
- package/src/classes/HMSRoom.ts +4 -0
- package/src/classes/HMSSDK.tsx +306 -11
- package/src/classes/HmsView.tsx +14 -6
- package/src/index.ts +5 -0
package/src/classes/HMSSDK.tsx
CHANGED
|
@@ -20,7 +20,7 @@ import type { HMSTrackType } from './HMSTrackType';
|
|
|
20
20
|
import type { HMSLogger } from './HMSLogger';
|
|
21
21
|
import type { HMSPeer } from './HMSPeer';
|
|
22
22
|
import { HmsView as HMSViewComponent } from './HmsView';
|
|
23
|
-
import { HMSVideoViewMode } from './HMSVideoViewMode';
|
|
23
|
+
import type { HMSVideoViewMode } from './HMSVideoViewMode';
|
|
24
24
|
import type { HMSTrackSettings } from './HMSTrackSettings';
|
|
25
25
|
import type { HMSRTMPConfig } from './HMSRTMPConfig';
|
|
26
26
|
import type { HMSHLSConfig } from './HMSHLSConfig';
|
|
@@ -34,8 +34,10 @@ interface HmsComponentProps {
|
|
|
34
34
|
sink: boolean;
|
|
35
35
|
style: ViewStyle;
|
|
36
36
|
mirror?: boolean;
|
|
37
|
-
scaleType
|
|
37
|
+
scaleType?: HMSVideoViewMode;
|
|
38
|
+
screenshot?: boolean;
|
|
38
39
|
id?: string | null;
|
|
40
|
+
setZOrderMediaOverlay?: boolean;
|
|
39
41
|
}
|
|
40
42
|
|
|
41
43
|
const {
|
|
@@ -85,7 +87,7 @@ export class HMSSDK {
|
|
|
85
87
|
|
|
86
88
|
/**
|
|
87
89
|
* - Returns an instance of [HMSSDK]{@link HMSSDK}
|
|
88
|
-
* - This function must be called to get an instance of HMSSDK class and only then user can interact with its methods
|
|
90
|
+
* - This function must be called to get an instance of HMSSDK class and only then user can interact with its methods.
|
|
89
91
|
*
|
|
90
92
|
* @static
|
|
91
93
|
* @returns
|
|
@@ -99,19 +101,40 @@ export class HMSSDK {
|
|
|
99
101
|
return HmsSdk;
|
|
100
102
|
}
|
|
101
103
|
|
|
104
|
+
/**
|
|
105
|
+
* - Returns the instance of logger which can be used to manipulate log levels.
|
|
106
|
+
* @returns @instance HMSLogger
|
|
107
|
+
* @memberof HMSSDK
|
|
108
|
+
*/
|
|
102
109
|
static getLogger() {
|
|
103
110
|
return logger;
|
|
104
111
|
}
|
|
105
112
|
|
|
113
|
+
/**
|
|
114
|
+
* - Updates the logger for this instance of HMSSDK
|
|
115
|
+
* @param {HMSLogger} hmsLogger
|
|
116
|
+
* @memberof HMSSDK
|
|
117
|
+
*/
|
|
106
118
|
setLogger = (hmsLogger: HMSLogger) => {
|
|
107
119
|
logger = hmsLogger;
|
|
108
120
|
hmsLogger.verbose('#Function setLogger', { id: this.id });
|
|
109
121
|
};
|
|
110
122
|
|
|
123
|
+
/**
|
|
124
|
+
* - Calls removeListeners that in turn breaks all connections with native listeners.
|
|
125
|
+
*
|
|
126
|
+
* @memberof HMSSDK
|
|
127
|
+
*/
|
|
111
128
|
destroy = () => {
|
|
112
129
|
this.removeListeners();
|
|
113
130
|
};
|
|
114
131
|
|
|
132
|
+
/**
|
|
133
|
+
* - Attaches preview listener for native callbacks.
|
|
134
|
+
* Note:this function connects sdk to native side and not app to sdk.
|
|
135
|
+
*
|
|
136
|
+
* @memberof HMSSDK
|
|
137
|
+
*/
|
|
115
138
|
attachPreviewListener = () => {
|
|
116
139
|
HmsEventEmitter.addListener(
|
|
117
140
|
HMSUpdateListenerActions.ON_PREVIEW,
|
|
@@ -119,6 +142,11 @@ export class HMSSDK {
|
|
|
119
142
|
);
|
|
120
143
|
};
|
|
121
144
|
|
|
145
|
+
/**
|
|
146
|
+
* - Attaches all the listeners to native callbacks.
|
|
147
|
+
* Note: this function connects sdk to native side and not app to sdk.
|
|
148
|
+
* @memberof HMSSDK
|
|
149
|
+
*/
|
|
122
150
|
attachListeners = () => {
|
|
123
151
|
HmsEventEmitter.addListener(
|
|
124
152
|
HMSUpdateListenerActions.ON_JOIN,
|
|
@@ -206,6 +234,11 @@ export class HMSSDK {
|
|
|
206
234
|
);
|
|
207
235
|
};
|
|
208
236
|
|
|
237
|
+
/**
|
|
238
|
+
* Disconnects all the listeners of this sdk from native listeners.
|
|
239
|
+
* Note: this function is only called from destroy function and should only be called when the current instance of {@link HMSSDK} is not required anymore.
|
|
240
|
+
* @memberof HMSSDK
|
|
241
|
+
*/
|
|
209
242
|
removeListeners = () => {
|
|
210
243
|
HmsEventEmitter.removeListener(
|
|
211
244
|
HMSUpdateListenerActions.ON_JOIN,
|
|
@@ -294,8 +327,10 @@ export class HMSSDK {
|
|
|
294
327
|
};
|
|
295
328
|
|
|
296
329
|
/**
|
|
297
|
-
* takes an instance of [HMSConfig]{@link HMSConfig} and joins the room
|
|
298
|
-
* after joining the room user will start receiving the events and updates of the room
|
|
330
|
+
* takes an instance of [HMSConfig]{@link HMSConfig} and joins the room.
|
|
331
|
+
* after joining the room user will start receiving the events and updates of the room.
|
|
332
|
+
*
|
|
333
|
+
* checkout {@link https://www.100ms.live/docs/react-native/v2/features/join} for more info
|
|
299
334
|
*
|
|
300
335
|
* @param {HMSConfig} config
|
|
301
336
|
* @memberof HMSSDK
|
|
@@ -306,11 +341,31 @@ export class HMSSDK {
|
|
|
306
341
|
await HmsManager.join({ ...config, id: this.id });
|
|
307
342
|
};
|
|
308
343
|
|
|
344
|
+
/**
|
|
345
|
+
* - preview function is used to initiate a preview for the localPeer.
|
|
346
|
+
* - We can call this function and wait for a response in previewListener, the response will contain previewTracks for local peer.
|
|
347
|
+
*
|
|
348
|
+
* checkout {@link https://www.100ms.live/docs/react-native/v2/features/preview} for more info
|
|
349
|
+
*
|
|
350
|
+
* @param {HMSConfig} config
|
|
351
|
+
* @memberof HMSSDK
|
|
352
|
+
*/
|
|
309
353
|
preview = (config: HMSConfig) => {
|
|
310
354
|
logger?.verbose('#Function preview', { config, id: this.id });
|
|
311
355
|
HmsManager.preview({ ...config, id: this.id });
|
|
312
356
|
};
|
|
313
357
|
|
|
358
|
+
/**
|
|
359
|
+
* - previewForRole can be used when there is role change request for current localPeer and we want
|
|
360
|
+
* to show the localPeer how the tracks look before publishing them to room.
|
|
361
|
+
*
|
|
362
|
+
* - It requires a role of type [HMSRole]{@link HMSRole} for which we want to preview the tracks.
|
|
363
|
+
*
|
|
364
|
+
* checkout {@link https://www.100ms.live/docs/react-native} for more info
|
|
365
|
+
*
|
|
366
|
+
* @param {HMSRole}
|
|
367
|
+
* @memberof HMSSDK
|
|
368
|
+
*/
|
|
314
369
|
previewForRole = async (role: HMSRole) => {
|
|
315
370
|
logger?.verbose('#Function previewForRole', {
|
|
316
371
|
role,
|
|
@@ -324,27 +379,44 @@ export class HMSSDK {
|
|
|
324
379
|
}
|
|
325
380
|
};
|
|
326
381
|
|
|
382
|
+
/**
|
|
383
|
+
* - HmsView is react component that takes one track and starts showing that track on a tile.
|
|
384
|
+
* - The appearance of tile is completely customizable with style prop.
|
|
385
|
+
* - setting sink true or false for a video tile will add or remove sink for a video.
|
|
386
|
+
* - scale type can determine how the incoming video will fit in the canvas check {@link HMSVideoViewMode} for more information.
|
|
387
|
+
*
|
|
388
|
+
* checkout {@link https://www.100ms.live/docs/react-native/v2/features/render-video} for more info
|
|
389
|
+
*
|
|
390
|
+
* @param {HmsComponentProps}
|
|
391
|
+
* @memberof HMSSDK
|
|
392
|
+
*/
|
|
327
393
|
HmsView = ({
|
|
328
394
|
sink,
|
|
329
395
|
trackId,
|
|
330
396
|
style,
|
|
331
397
|
mirror,
|
|
332
|
-
scaleType
|
|
398
|
+
scaleType,
|
|
399
|
+
screenshot,
|
|
400
|
+
setZOrderMediaOverlay,
|
|
333
401
|
}: HmsComponentProps) => {
|
|
334
402
|
return (
|
|
335
403
|
<HMSViewComponent
|
|
336
404
|
sink={sink}
|
|
337
405
|
trackId={trackId}
|
|
338
406
|
style={style}
|
|
407
|
+
setZOrderMediaOverlay={setZOrderMediaOverlay}
|
|
339
408
|
mirror={mirror}
|
|
340
409
|
scaleType={scaleType}
|
|
341
410
|
id={this.id}
|
|
411
|
+
screenshot={screenshot}
|
|
342
412
|
/>
|
|
343
413
|
);
|
|
344
414
|
};
|
|
345
415
|
|
|
346
416
|
/**
|
|
347
|
-
* Calls leave function of native sdk and session of current user is invalidated
|
|
417
|
+
* Calls leave function of native sdk and session of current user is invalidated.
|
|
418
|
+
*
|
|
419
|
+
* checkout {@link https://www.100ms.live/docs/react-native/v2/features/leave} for more info
|
|
348
420
|
*
|
|
349
421
|
* @memberof HMSSDK
|
|
350
422
|
*/
|
|
@@ -364,6 +436,14 @@ export class HMSSDK {
|
|
|
364
436
|
return op;
|
|
365
437
|
};
|
|
366
438
|
|
|
439
|
+
/**
|
|
440
|
+
* - This function sends message to all the peers in the room, the get the message in onMessage listener.
|
|
441
|
+
*
|
|
442
|
+
* checkout {@link https://www.100ms.live/docs/react-native/v2/features/chat} for more info
|
|
443
|
+
*
|
|
444
|
+
* @param {message: string} and @param {type: string}
|
|
445
|
+
* @memberof HMSSDK
|
|
446
|
+
*/
|
|
367
447
|
sendBroadcastMessage = async (message: string, type: string = 'chat') => {
|
|
368
448
|
logger?.verbose('#Function sendBroadcastMessage', {
|
|
369
449
|
message,
|
|
@@ -377,6 +457,14 @@ export class HMSSDK {
|
|
|
377
457
|
});
|
|
378
458
|
};
|
|
379
459
|
|
|
460
|
+
/**
|
|
461
|
+
* - sendGroupMessage sends a message to specific set of roles, whoever has any of those role in room
|
|
462
|
+
* will get the message in onMessage listener.
|
|
463
|
+
*
|
|
464
|
+
* checkout {@link https://www.100ms.live/docs/react-native/v2/features/chat} for more info
|
|
465
|
+
*
|
|
466
|
+
* @memberof HMSSDK
|
|
467
|
+
*/
|
|
380
468
|
sendGroupMessage = async (
|
|
381
469
|
message: string,
|
|
382
470
|
roles: HMSRole[],
|
|
@@ -396,6 +484,14 @@ export class HMSSDK {
|
|
|
396
484
|
});
|
|
397
485
|
};
|
|
398
486
|
|
|
487
|
+
/**
|
|
488
|
+
* - sendDirectMessage sends a private message to a single peer, only that peer will get the message
|
|
489
|
+
* in onMessage Listener.
|
|
490
|
+
*
|
|
491
|
+
* checkout {@link https://www.100ms.live/docs/react-native/v2/features/chat} for more info
|
|
492
|
+
*
|
|
493
|
+
* @memberof HMSSDK
|
|
494
|
+
*/
|
|
399
495
|
sendDirectMessage = async (
|
|
400
496
|
message: string,
|
|
401
497
|
peer: HMSPeer,
|
|
@@ -415,11 +511,32 @@ export class HMSSDK {
|
|
|
415
511
|
});
|
|
416
512
|
};
|
|
417
513
|
|
|
514
|
+
/**
|
|
515
|
+
* - changeMetadata changes a specific field in localPeer which is [metadata] it is a string that can
|
|
516
|
+
* be used for various functionalities like raiseHand, beRightBack and many more that explains the
|
|
517
|
+
* current status of the peer.
|
|
518
|
+
*
|
|
519
|
+
* - it is advised to use a json object in string format to store multiple dataPoints in metadata.
|
|
520
|
+
*
|
|
521
|
+
* checkout {@link https://www.100ms.live/docs/react-native/v2/features/change-metadata} for more info
|
|
522
|
+
*
|
|
523
|
+
* @param {string}
|
|
524
|
+
* @memberof HMSSDK
|
|
525
|
+
*/
|
|
418
526
|
changeMetadata = (metadata: string) => {
|
|
419
527
|
logger?.verbose('#Function changeMetadata', { metadata, id: this.id });
|
|
420
528
|
HmsManager.changeMetadata({ metadata, id: this.id });
|
|
421
529
|
};
|
|
422
530
|
|
|
531
|
+
/**
|
|
532
|
+
* - startRTMPOrRecording takes a configuration object {@link HMSRTMPConfig} and stats the RTMP recording
|
|
533
|
+
* - this object of {@link HMSRTMPConfig} sets the urls for streaming and weather to set recording on or not
|
|
534
|
+
* - we get the response of this function in onRoomUpdate as RTMP_STREAMING_STATE_UPDATED.
|
|
535
|
+
*
|
|
536
|
+
* checkout {@link https://www.100ms.live/docs/react-native/v2/features/recording} for more info
|
|
537
|
+
*
|
|
538
|
+
* @memberof HMSSDK
|
|
539
|
+
*/
|
|
423
540
|
startRTMPOrRecording = async (data: HMSRTMPConfig) => {
|
|
424
541
|
logger?.verbose('#Function startRTMPOrRecording', {
|
|
425
542
|
...data,
|
|
@@ -430,12 +547,29 @@ export class HMSSDK {
|
|
|
430
547
|
return op;
|
|
431
548
|
};
|
|
432
549
|
|
|
550
|
+
/**
|
|
551
|
+
* - this function stops all the ongoing RTMP streaming and recording.
|
|
552
|
+
* - we get the response of this function in onRoomUpdate as RTMP_STREAMING_STATE_UPDATED.
|
|
553
|
+
*
|
|
554
|
+
* checkout {@link https://www.100ms.live/docs/react-native/v2/features/recording} for more info
|
|
555
|
+
*
|
|
556
|
+
* @memberof HMSSDK
|
|
557
|
+
*/
|
|
433
558
|
stopRtmpAndRecording = async () => {
|
|
434
559
|
logger?.verbose('#Function stopRtmpAndRecording', {});
|
|
435
560
|
const op = await HmsManager.stopRtmpAndRecording({ id: this.id });
|
|
436
561
|
return op;
|
|
437
562
|
};
|
|
438
563
|
|
|
564
|
+
/**
|
|
565
|
+
* - This function starts HLSStreaming.
|
|
566
|
+
* - we get the response of this function in onRoomUpdate as HLS_STREAMING_STATE_UPDATED.
|
|
567
|
+
*
|
|
568
|
+
* checkout {@link https://www.100ms.live/docs/react-native/v2/features/hls-streaming} for more info
|
|
569
|
+
*
|
|
570
|
+
* @param {HMSHLSConfig}
|
|
571
|
+
* @memberof HMSSDK
|
|
572
|
+
*/
|
|
439
573
|
startHLSStreaming = async (data: HMSHLSConfig) => {
|
|
440
574
|
logger?.verbose('#Function startHLSStreaming', {
|
|
441
575
|
...data,
|
|
@@ -444,11 +578,33 @@ export class HMSSDK {
|
|
|
444
578
|
return await HmsManager.startHLSStreaming({ ...data, id: this.id });
|
|
445
579
|
};
|
|
446
580
|
|
|
581
|
+
/**
|
|
582
|
+
* - stopHLSStreaming function stops the ongoing HLSStreams.
|
|
583
|
+
* - we get the response of this function in onRoomUpdate as HLS_STREAMING_STATE_UPDATED.
|
|
584
|
+
*
|
|
585
|
+
* checkout {@link https://www.100ms.live/docs/react-native/v2/features/hls-streaming} for more info
|
|
586
|
+
*
|
|
587
|
+
* @memberof HMSSDK
|
|
588
|
+
*/
|
|
447
589
|
stopHLSStreaming = async () => {
|
|
448
590
|
logger?.verbose('#Function stopHLSStreaming', {});
|
|
449
591
|
return await HmsManager.stopHLSStreaming({ id: this.id });
|
|
450
592
|
};
|
|
451
593
|
|
|
594
|
+
/**
|
|
595
|
+
* - This function can be used in a situation when we want to change role hence manipulate their
|
|
596
|
+
* access and rights in the current room, it takes the peer {@link HMSPeer} whom role we want to change,
|
|
597
|
+
* role {@link HMSRole} which will be the new role for that peer and weather to forcefully change
|
|
598
|
+
* the role or ask the to accept the role change request using a boolean force.
|
|
599
|
+
*
|
|
600
|
+
* - if we change the role forcefully the peer's role will be updated without asking the peer
|
|
601
|
+
* otherwise the user will get the roleChangeRequest in roleChangeRequest listener.
|
|
602
|
+
* for more information on this checkout {@link onRoleChangeRequestListener}
|
|
603
|
+
*
|
|
604
|
+
* checkout {@link https://www.100ms.live/docs/react-native/v2/features/change-role} for more info
|
|
605
|
+
*
|
|
606
|
+
* @memberof HMSSDK
|
|
607
|
+
*/
|
|
452
608
|
changeRole = async (peer: HMSPeer, role: HMSRole, force: boolean = false) => {
|
|
453
609
|
const data = {
|
|
454
610
|
peerId: peer?.peerID,
|
|
@@ -460,6 +616,15 @@ export class HMSSDK {
|
|
|
460
616
|
return await HmsManager.changeRole(data);
|
|
461
617
|
};
|
|
462
618
|
|
|
619
|
+
/**
|
|
620
|
+
* - This function can be used to manipulate mute status of any track.
|
|
621
|
+
* - Targeted peer affected by this action will get a callback in {@link onChangeTrackStateRequestListener}.
|
|
622
|
+
*
|
|
623
|
+
* * checkout {@link https://www.100ms.live/docs/react-native/v2/features/change-track-state} for more info
|
|
624
|
+
*
|
|
625
|
+
* @param {HMSTrack}
|
|
626
|
+
* @memberof HMSSDK
|
|
627
|
+
*/
|
|
463
628
|
changeTrackState = async (track: HMSTrack, mute: boolean) => {
|
|
464
629
|
logger?.verbose('#Function changeTrackState', {
|
|
465
630
|
track,
|
|
@@ -475,6 +640,14 @@ export class HMSSDK {
|
|
|
475
640
|
return await HmsManager.changeTrackState(data);
|
|
476
641
|
};
|
|
477
642
|
|
|
643
|
+
/**
|
|
644
|
+
* - changeTrackStateForRoles is an enhancement on the functionality of {@link changeTrackState}.
|
|
645
|
+
* - We can change mute status for all the tracks of peers having a particular role.
|
|
646
|
+
* - @param source determines the source of the track ex. video, audio etc.
|
|
647
|
+
* - The peers affected by this action will get a callback in {@link onChangeTrackStateRequestListener}.
|
|
648
|
+
*
|
|
649
|
+
* @memberof HMSSDK
|
|
650
|
+
*/
|
|
478
651
|
changeTrackStateForRoles = async (
|
|
479
652
|
mute: boolean,
|
|
480
653
|
type?: HMSTrackType,
|
|
@@ -503,6 +676,14 @@ export class HMSSDK {
|
|
|
503
676
|
return await HmsManager.changeTrackStateForRoles(data);
|
|
504
677
|
};
|
|
505
678
|
|
|
679
|
+
/**
|
|
680
|
+
* - removePeer can forcefully disconnect a Peer from the room.
|
|
681
|
+
* - the user who's removed from this action will get a callback in {@link onRemovedFromRoomListener}.
|
|
682
|
+
*
|
|
683
|
+
* checkout {@link https://www.100ms.live/docs/react-native/v2/features/remove-peer} for more info
|
|
684
|
+
*
|
|
685
|
+
* @memberof HMSSDK
|
|
686
|
+
*/
|
|
506
687
|
removePeer = async (peer: HMSPeer, reason: string) => {
|
|
507
688
|
logger?.verbose('#Function removePeer', {
|
|
508
689
|
peerId: peer.peerID,
|
|
@@ -518,6 +699,15 @@ export class HMSSDK {
|
|
|
518
699
|
return await HmsManager.removePeer(data);
|
|
519
700
|
};
|
|
520
701
|
|
|
702
|
+
/**
|
|
703
|
+
* - endRoom can be used in a situation where we want to disconnect all the peers from current room
|
|
704
|
+
* and end the call.
|
|
705
|
+
* - everyone in the room will get an update of this action in {@link onRemovedFromRoomListener}.
|
|
706
|
+
*
|
|
707
|
+
* checkout {@link https://www.100ms.live/docs/react-native/v2/features/end-room} for more info
|
|
708
|
+
*
|
|
709
|
+
* @memberof HMSSDK
|
|
710
|
+
*/
|
|
521
711
|
endRoom = async (reason: string, lock: boolean = false) => {
|
|
522
712
|
logger?.verbose('#Function endRoom', { lock, reason, id: this.id });
|
|
523
713
|
const data = {
|
|
@@ -529,6 +719,13 @@ export class HMSSDK {
|
|
|
529
719
|
return await HmsManager.endRoom(data);
|
|
530
720
|
};
|
|
531
721
|
|
|
722
|
+
/**
|
|
723
|
+
* - This function can be used to change name of localPeer.
|
|
724
|
+
*
|
|
725
|
+
* checkout {@link https://www.100ms.live/docs/react-native/v2/features/change-name} for more info
|
|
726
|
+
*
|
|
727
|
+
* @memberof HMSSDK
|
|
728
|
+
*/
|
|
532
729
|
changeName = async (name: string) => {
|
|
533
730
|
logger?.verbose('#Function changeName', { name, id: this.id });
|
|
534
731
|
const data = {
|
|
@@ -539,22 +736,51 @@ export class HMSSDK {
|
|
|
539
736
|
return await HmsManager.changeName(data);
|
|
540
737
|
};
|
|
541
738
|
|
|
739
|
+
/**
|
|
740
|
+
* - Calling this function will accept the most recent roleChange request made by anyone in the room
|
|
741
|
+
*
|
|
742
|
+
* checkout {@link https://www.100ms.live/docs/react-native/v2/features/change-role} for more info
|
|
743
|
+
*
|
|
744
|
+
* @memberof HMSSDK
|
|
745
|
+
*/
|
|
542
746
|
acceptRoleChange = async () => {
|
|
543
747
|
logger?.verbose('#Function acceptRoleChange', { id: this.id });
|
|
544
748
|
return await HmsManager.acceptRoleChange({ id: this.id });
|
|
545
749
|
};
|
|
546
750
|
|
|
751
|
+
/**
|
|
752
|
+
* - setPlaybackForAllAudio is an extension of the abilities of {@link setPlaybackAllowed} in
|
|
753
|
+
* {@link HMSRemoteAudioTrack}, it sets mute status for all peers in the room
|
|
754
|
+
*
|
|
755
|
+
* checkout {@link https://www.100ms.live/docs/react-native/v2/features/playback-allowed} for more info
|
|
756
|
+
*
|
|
757
|
+
* @memberof HMSSDK
|
|
758
|
+
*/
|
|
547
759
|
setPlaybackForAllAudio = (mute: boolean) => {
|
|
548
760
|
logger?.verbose('#Function setPlaybackForAllAudio', { mute, id: this.id });
|
|
549
761
|
this.muteStatus = mute;
|
|
550
762
|
HmsManager.setPlaybackForAllAudio({ mute, id: this.id });
|
|
551
763
|
};
|
|
552
764
|
|
|
765
|
+
/**
|
|
766
|
+
* - This function mutes audio for all peers in the room.
|
|
767
|
+
*
|
|
768
|
+
* @memberof HMSSDK
|
|
769
|
+
*/
|
|
553
770
|
remoteMuteAllAudio = () => {
|
|
554
771
|
logger?.verbose('#Function remoteMuteAllAudio', { id: this.id });
|
|
555
772
|
HmsManager.remoteMuteAllAudio({ id: this.id });
|
|
556
773
|
};
|
|
557
774
|
|
|
775
|
+
/**
|
|
776
|
+
* - getRoom is a wrapper function on an existing native function also known as getRoom the returns
|
|
777
|
+
* current room object which is of type {@link HMSRoom}
|
|
778
|
+
*
|
|
779
|
+
* checkout {@link https://www.100ms.live/docs/react-native/v2/features/room} for more info
|
|
780
|
+
*
|
|
781
|
+
* @memberof HMSSDK
|
|
782
|
+
* @return HMSRoom
|
|
783
|
+
*/
|
|
558
784
|
getRoom = async () => {
|
|
559
785
|
logger?.verbose('#Function getRoom', {
|
|
560
786
|
roomID: this.room?.id,
|
|
@@ -566,6 +792,13 @@ export class HMSSDK {
|
|
|
566
792
|
return encodedHmsRoom;
|
|
567
793
|
};
|
|
568
794
|
|
|
795
|
+
/**
|
|
796
|
+
* - This function sets the volume of any peer in the room
|
|
797
|
+
*
|
|
798
|
+
* checkout {@link https://www.100ms.live/docs/react-native/v2/features/set-volume} for more info
|
|
799
|
+
*
|
|
800
|
+
* @memberof HMSSDK
|
|
801
|
+
*/
|
|
569
802
|
setVolume = (track: HMSTrack, volume: number) => {
|
|
570
803
|
logger?.verbose('#Function setVolume', {
|
|
571
804
|
track,
|
|
@@ -584,6 +817,13 @@ export class HMSSDK {
|
|
|
584
817
|
if (Platform.OS === 'android') HmsManager.resetVolume({ id: this.id });
|
|
585
818
|
};
|
|
586
819
|
|
|
820
|
+
/**
|
|
821
|
+
* - This is a temporary solution for the situation when mic access is taken from the app and
|
|
822
|
+
* user returns to the app with no mic access. It will re-acquire the mic by setting the volume
|
|
823
|
+
* from native side
|
|
824
|
+
*
|
|
825
|
+
* @memberof HMSSDK
|
|
826
|
+
*/
|
|
587
827
|
addAppStateListener = () => {
|
|
588
828
|
logger?.verbose('#Function addAppStateListener', { id: this.id });
|
|
589
829
|
this.appStateSubscription = AppState.addEventListener(
|
|
@@ -596,15 +836,30 @@ export class HMSSDK {
|
|
|
596
836
|
);
|
|
597
837
|
};
|
|
598
838
|
|
|
599
|
-
|
|
839
|
+
/**
|
|
840
|
+
* - This function is used to start screenshare, currently available only for android
|
|
841
|
+
*
|
|
842
|
+
* checkout {@link https://www.100ms.live/docs/react-native/v2/features/screenshare} for more info
|
|
843
|
+
*
|
|
844
|
+
* @memberof HMSSDK
|
|
845
|
+
*/
|
|
846
|
+
startScreenshare = async () => {
|
|
600
847
|
logger?.verbose('#Function startScreenshare', { id: this.id });
|
|
601
848
|
if (Platform.OS === 'android') {
|
|
602
|
-
HmsManager.startScreenshare({ id: this.id });
|
|
849
|
+
return await HmsManager.startScreenshare({ id: this.id });
|
|
603
850
|
} else {
|
|
604
851
|
console.log('API currently not available for iOS');
|
|
852
|
+
return 'API currently not available for iOS';
|
|
605
853
|
}
|
|
606
854
|
};
|
|
607
855
|
|
|
856
|
+
/**
|
|
857
|
+
* - Returns a boolean stating if the screen is currently shared or not
|
|
858
|
+
*
|
|
859
|
+
* checkout {@link https://www.100ms.live/docs/react-native/v2/features/screenshare} for more info
|
|
860
|
+
*
|
|
861
|
+
* @memberof HMSSDK
|
|
862
|
+
*/
|
|
608
863
|
isScreenShared = async () => {
|
|
609
864
|
logger?.verbose('#Function isScreenShared', { id: this.id });
|
|
610
865
|
if (Platform.OS === 'android') {
|
|
@@ -615,6 +870,13 @@ export class HMSSDK {
|
|
|
615
870
|
}
|
|
616
871
|
};
|
|
617
872
|
|
|
873
|
+
/**
|
|
874
|
+
* - stops the screenShare, currently available for android only.
|
|
875
|
+
*
|
|
876
|
+
* checkout {@link https://www.100ms.live/docs/react-native/v2/features/screenshare} for more info
|
|
877
|
+
*
|
|
878
|
+
* @memberof HMSSDK
|
|
879
|
+
*/
|
|
618
880
|
stopScreenshare = async () => {
|
|
619
881
|
logger?.verbose('#Function stopScreenshare', { id: this.id });
|
|
620
882
|
if (Platform.OS === 'android') {
|
|
@@ -625,6 +887,18 @@ export class HMSSDK {
|
|
|
625
887
|
}
|
|
626
888
|
};
|
|
627
889
|
|
|
890
|
+
/**
|
|
891
|
+
* - enableRTCStats sets a boolean in native side which in turn allows several events to be passed
|
|
892
|
+
* through the bridge these events are {@link RTCStatsListener}, {@link onRemoteVideoStatsListener},
|
|
893
|
+
* {@link onRemoteAudioStatsListener}, {@link onLocalAudioStatsListener} and {@link onLocalVideoStatsListener}
|
|
894
|
+
*
|
|
895
|
+
* - These listeners get various dataPoints for current peers and their connectivity to the room
|
|
896
|
+
* such as jitter, latency etc.
|
|
897
|
+
*
|
|
898
|
+
* - currently available for iOS only
|
|
899
|
+
*
|
|
900
|
+
* @memberof HMSSDK
|
|
901
|
+
*/
|
|
628
902
|
enableRTCStats = () => {
|
|
629
903
|
logger?.verbose('#Function enableRTCStats', { id: this.id });
|
|
630
904
|
if (Platform.OS === 'ios') {
|
|
@@ -634,6 +908,14 @@ export class HMSSDK {
|
|
|
634
908
|
}
|
|
635
909
|
};
|
|
636
910
|
|
|
911
|
+
/**
|
|
912
|
+
* - disable RTCStats sets the same boolean to false that was set true by enableRTCStats.
|
|
913
|
+
* that activates a check which filters out the events acquired in native listeners and don't
|
|
914
|
+
* let them pass through bridge
|
|
915
|
+
*
|
|
916
|
+
* - currently available for iOS only.
|
|
917
|
+
* @memberof HMSSDK
|
|
918
|
+
*/
|
|
637
919
|
disableRTCStats = () => {
|
|
638
920
|
logger?.verbose('#Function disableRTCStats', { id: this.id });
|
|
639
921
|
if (Platform.OS === 'ios') {
|
|
@@ -645,7 +927,6 @@ export class HMSSDK {
|
|
|
645
927
|
|
|
646
928
|
/**
|
|
647
929
|
* - This is a prototype event listener that takes action and listens for updates related to that particular action
|
|
648
|
-
* - This method will be @deprecated in future and event listener will be passed in join method
|
|
649
930
|
*
|
|
650
931
|
* @param {string} action
|
|
651
932
|
* @param {*} callback
|
|
@@ -717,7 +998,6 @@ export class HMSSDK {
|
|
|
717
998
|
|
|
718
999
|
/**
|
|
719
1000
|
* - This is a prototype event listener that takes action and listens for updates related to that particular action
|
|
720
|
-
* - This method will be @deprecated in future and event listener will be passed in join method
|
|
721
1001
|
*
|
|
722
1002
|
* @param {string} action
|
|
723
1003
|
* @param {*} callback
|
|
@@ -807,6 +1087,21 @@ export class HMSSDK {
|
|
|
807
1087
|
logger?.verbose('#Function REMOVE_ALL_LISTENER', { id: this.id });
|
|
808
1088
|
};
|
|
809
1089
|
|
|
1090
|
+
/**
|
|
1091
|
+
* - Below are all the listeners that are connected to native side.
|
|
1092
|
+
*
|
|
1093
|
+
* - All of the are connected when build function is called, we can connect them to the app by
|
|
1094
|
+
* calling {@link addEventListener} with corresponding event type.
|
|
1095
|
+
*
|
|
1096
|
+
* - Before passing the data to the eventListener of the app these listeners encode the data in
|
|
1097
|
+
* ts classes for a proper structuring of the data.
|
|
1098
|
+
*
|
|
1099
|
+
* - Even When event listeners of the app are disconnected using {@link removeEventListener} or
|
|
1100
|
+
* {@link removeAllListeners} or not even connected in first place, these functions still run to
|
|
1101
|
+
* maintain the current state of the instance of {@link HMSSDK}.
|
|
1102
|
+
*
|
|
1103
|
+
*/
|
|
1104
|
+
|
|
810
1105
|
onPreviewListener = (data: any) => {
|
|
811
1106
|
if (data.id !== this.id) {
|
|
812
1107
|
return;
|
package/src/classes/HmsView.tsx
CHANGED
|
@@ -7,9 +7,11 @@ interface HmsViewProps {
|
|
|
7
7
|
trackId: string;
|
|
8
8
|
sink: boolean;
|
|
9
9
|
id?: string | null;
|
|
10
|
-
mirror
|
|
10
|
+
mirror: boolean;
|
|
11
11
|
};
|
|
12
|
+
setZOrderMediaOverlay: boolean;
|
|
12
13
|
scaleType: HMSVideoViewMode;
|
|
14
|
+
screenshot: boolean;
|
|
13
15
|
style: ViewStyle;
|
|
14
16
|
onChange: Function;
|
|
15
17
|
}
|
|
@@ -21,7 +23,9 @@ interface HmsComponentProps {
|
|
|
21
23
|
sink: boolean;
|
|
22
24
|
style: ViewStyle;
|
|
23
25
|
mirror?: boolean;
|
|
24
|
-
scaleType
|
|
26
|
+
scaleType?: HMSVideoViewMode;
|
|
27
|
+
setZOrderMediaOverlay?: boolean;
|
|
28
|
+
screenshot?: boolean;
|
|
25
29
|
id?: string | null;
|
|
26
30
|
}
|
|
27
31
|
|
|
@@ -29,16 +33,18 @@ export const HmsView = ({
|
|
|
29
33
|
sink,
|
|
30
34
|
trackId,
|
|
31
35
|
style,
|
|
32
|
-
id,
|
|
33
|
-
mirror,
|
|
36
|
+
id = null,
|
|
37
|
+
mirror = false,
|
|
38
|
+
setZOrderMediaOverlay = false,
|
|
34
39
|
scaleType = HMSVideoViewMode.ASPECT_FILL,
|
|
40
|
+
screenshot = false,
|
|
35
41
|
}: HmsComponentProps) => {
|
|
36
42
|
const [tempVal, setTempVal] = useState(0);
|
|
37
43
|
const data = {
|
|
38
44
|
trackId,
|
|
39
45
|
sink,
|
|
40
|
-
id
|
|
41
|
-
mirror
|
|
46
|
+
id,
|
|
47
|
+
mirror,
|
|
42
48
|
};
|
|
43
49
|
|
|
44
50
|
const onChange = (values: any) => {
|
|
@@ -58,6 +64,8 @@ export const HmsView = ({
|
|
|
58
64
|
data={data}
|
|
59
65
|
style={tempVal === 0 ? style : temporaryStyles.customStyle}
|
|
60
66
|
scaleType={scaleType}
|
|
67
|
+
setZOrderMediaOverlay={setZOrderMediaOverlay}
|
|
68
|
+
screenshot={screenshot}
|
|
61
69
|
/>
|
|
62
70
|
);
|
|
63
71
|
};
|
package/src/index.ts
CHANGED
|
@@ -57,6 +57,11 @@ export * from './classes/HMSRTCStats';
|
|
|
57
57
|
export * from './classes/HMSRTCStatsReport';
|
|
58
58
|
export * from './classes/HMSRemoteAudioStats';
|
|
59
59
|
export * from './classes/HMSRemoteVideoStats';
|
|
60
|
+
export * from './classes/HMSHLSRecordingConfig';
|
|
61
|
+
export * from './classes/HMSHLSRecordingState';
|
|
62
|
+
export * from './classes/HMSMessageRecipient';
|
|
63
|
+
export * from './classes/HMSMessageRecipientType';
|
|
64
|
+
export * from './classes/HMSNetworkQuality';
|
|
60
65
|
|
|
61
66
|
import { HMSSDK as HmsManager } from './classes/HMSSDK';
|
|
62
67
|
export default HmsManager;
|