@100mslive/react-native-hms 0.9.1 → 0.9.2

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