@100mslive/hms-video-store 0.12.25 → 0.12.26

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.
@@ -11,9 +11,9 @@ import { HMSStats } from './webrtc-stats';
11
11
  * It talks to our 100ms backend and handles error reconnections, state managements
12
12
  * and lots of other things so you don't have to. You can use this gateway with any
13
13
  * sort of UI to make connecting to our backend easier.
14
- * In case you use react, we also provide a HMSProvider class with very powerful hooks
15
- * and out of box components which you can use to setup your website in minutes. Our
16
- * components have in built integration with this interface and you won't have to worry
14
+ * In case you use React, we also provide a HMSProvider class with very powerful hooks
15
+ * and out of box components which you can use to set up your website in minutes. Our
16
+ * components have in built integration with this interface, and you won't have to worry
17
17
  * about passing props if you use them.
18
18
  *
19
19
  * @remarks
@@ -25,6 +25,12 @@ import { HMSStats } from './webrtc-stats';
25
25
  export interface IHMSActions<T extends HMSGenericTypes = {
26
26
  sessionStore: Record<string, any>;
27
27
  }> {
28
+ /**
29
+ * Preview function can be used to preview the camera and microphone before joining the room.
30
+ * This function is useful when you want to check and/or modify the camera and microphone settings before joining the Room.
31
+ * @param config preview config with camera and microphone devices
32
+ * @returns Promise<void> - resolves when the preview is successful
33
+ */
28
34
  preview(config: HMSMidCallPreviewConfig | HMSPreviewConfig): Promise<void>;
29
35
  /**
30
36
  * join function can be used to join the room, if the room join is successful,
@@ -35,22 +41,27 @@ export interface IHMSActions<T extends HMSGenericTypes = {
35
41
  * is ignored
36
42
  *
37
43
  * @param config join config with room id, required for joining the room
44
+ * @returns Promise<void> - resolves when the room is joined
38
45
  */
39
46
  join(config: HMSConfig): Promise<void>;
40
47
  /**
41
48
  * This function can be used to leave the room, if the call is repeated it's ignored.
49
+ * This function also cleans up the store and removes all the tracks and participants.
50
+ * @returns Promise<void> - resolves when the room is left
42
51
  */
43
52
  leave(): Promise<void>;
44
53
  /**
45
54
  * stop tracks fetched during midcall preview and general cleanup
55
+ * @returns Promise<void> - resolves when the tracks are stopped
46
56
  */
47
57
  cancelMidCallPreview(): Promise<void>;
48
58
  /**
49
59
  * If you want to enable screenshare for the local peer this class can be called.
50
60
  * The store will be populated with the incoming track, and the subscriber(or
51
61
  * react component if our hook is used) will be notified/rerendered
52
- * @param enabled boolean
62
+ * @param enabled boolean - true to enable screenshare, false to disable
53
63
  * @param config check the config object for details about the fields
64
+ * @returns Promise<void> - resolves when the screenshare is enabled
54
65
  */
55
66
  setScreenShareEnabled(enabled: boolean, config?: HMSScreenShareConfig): Promise<void>;
56
67
  /**
@@ -58,12 +69,14 @@ export interface IHMSActions<T extends HMSGenericTypes = {
58
69
  * This method adds the track to the local peer's list of auxiliary tracks and publishes it to make it available to remote peers.
59
70
  * @param track MediaStreamTrack - Track to be added
60
71
  * @param type HMSTrackSource - 'regular' | 'screen' | 'plugin' - Source of track - default: 'regular'
72
+ * @returns Promise<void> - resolves when the track is added
61
73
  */
62
74
  addTrack(track: MediaStreamTrack, type: HMSTrackSource): Promise<void>;
63
75
  /**
64
76
  * You can use the removeTrack method to remove an auxiliary track.
65
77
  * This method removes the track from the local peer's list of auxiliary tracks and unpublishes it.
66
78
  * @param trackId string - ID of the track to be removed
79
+ * @returns Promise<void> - resolves when the track is removed
67
80
  */
68
81
  removeTrack(trackId: HMSTrackID): Promise<void>;
69
82
  /**
@@ -77,6 +90,7 @@ export interface IHMSActions<T extends HMSGenericTypes = {
77
90
  * Send a plain text message to all the other participants in the room.
78
91
  * @param message - string message to broadcast
79
92
  * @param type - type of message. For example: image, video etc. - optional defaults to chat
93
+ * @returns Promise<void> - resolves when the message is sent
80
94
  */
81
95
  sendBroadcastMessage(message: string, type?: string): Promise<void>;
82
96
  /**
@@ -84,6 +98,7 @@ export interface IHMSActions<T extends HMSGenericTypes = {
84
98
  * @param message - string message to send
85
99
  * @param roles - roles to which to send the message
86
100
  * @param type - type of message. For example: image, video etc. - optional defaults to chat
101
+ * @returns Promise<void> - resolves when the message is sent
87
102
  */
88
103
  sendGroupMessage(message: string, roles: HMSRoleName[], type?: string): Promise<void>;
89
104
  /**
@@ -91,6 +106,7 @@ export interface IHMSActions<T extends HMSGenericTypes = {
91
106
  * @param message
92
107
  * @param peerID - id of the peer to which message has to be sent
93
108
  * @param type - type of message. For example: image, video etc. - optional defaults to chat
109
+ * @returns Promise<void> - resolves when the message is sent
94
110
  */
95
111
  sendDirectMessage(message: string, peerID: HMSPeerID, type?: string): Promise<void>;
96
112
  /**
@@ -107,16 +123,19 @@ export interface IHMSActions<T extends HMSGenericTypes = {
107
123
  /**
108
124
  * This function can be used to enable/disable(unmute/mute) local audio track
109
125
  * @param enabled boolean - true to unmute, false to mute
126
+ * @returns Promise<void> - resolves when the audio is enabled
110
127
  */
111
128
  setLocalAudioEnabled(enabled: boolean): Promise<void>;
112
129
  /**
113
130
  * This function can be used to enable/disable(unmute/mute) local video track
114
131
  * @param enabled boolean - true to unmute, false to mute
132
+ * @returns Promise<void> - resolves when the video is enabled
115
133
  */
116
134
  setLocalVideoEnabled(enabled: boolean): Promise<void>;
117
135
  /**
118
136
  * @param trackId string - ID of the track whose mute status needs to be set
119
137
  * @param enabled boolean - true when we want to unmute the track and false when we want to unmute it
138
+ * @returns Promise<void> - resolves when the track is enabled
120
139
  */
121
140
  setEnabledTrack(trackId: HMSTrackID, enabled: boolean): Promise<void>;
122
141
  /**
@@ -133,6 +152,7 @@ export interface IHMSActions<T extends HMSGenericTypes = {
133
152
  setVideoSettings(settings: Partial<HMSVideoTrackSettings>): Promise<void>;
134
153
  /**
135
154
  * Toggle the camera between front and back if the both the camera's exist
155
+ * @returns Promise<void> - resolves when the camera is toggled
136
156
  */
137
157
  switchCamera(): Promise<void>;
138
158
  /**
@@ -142,6 +162,7 @@ export interface IHMSActions<T extends HMSGenericTypes = {
142
162
  * the stream coming from server saving significant bandwidth for the user.
143
163
  * @param localTrackID trackID as stored in the store for the peer
144
164
  * @param videoElement HTML native element where the video has to be shown
165
+ * @returns Promise<void> - resolves when the video is attached
145
166
  */
146
167
  attachVideo(localTrackID: HMSTrackID, videoElement: HTMLVideoElement): Promise<void>;
147
168
  /**
@@ -152,18 +173,21 @@ export interface IHMSActions<T extends HMSGenericTypes = {
152
173
  * Set the output volume of audio tracks(overall/particular audio track)
153
174
  * @param value number between 0-100
154
175
  * @param trackId string If undefined sets the overall volume(of every audio track in the room); If valid - set the volume of particular audio track
155
- *
176
+ * @returns Promise<void> - resolves when the volume is set
156
177
  */
157
178
  setVolume(value: number, trackId?: HMSTrackID): Promise<void>;
158
179
  /**
159
180
  * Set the audio output(speaker) device
160
181
  * @param deviceId string deviceId of the audio output device
182
+ * @returns Promise<void> - resolves when the audio output device is set
161
183
  */
162
184
  setAudioOutputDevice(deviceId: string): Promise<void>;
163
185
  refreshDevices(): Promise<void>;
164
186
  /**
165
187
  * set the quality of the selected videoTrack for simulcast.
166
- * @alpha
188
+ * @param trackId HMSTrackID - trackId of the video track
189
+ * @param layer HMSSimulcastLayer - layer to be set
190
+ * @returns Promise<void> - resolves when the layer is set
167
191
  */
168
192
  setPreferredLayer(trackId: HMSTrackID, layer: HMSPreferredSimulcastLayer): Promise<void>;
169
193
  /**
@@ -229,17 +253,20 @@ export interface IHMSActions<T extends HMSGenericTypes = {
229
253
  * @param forPeerId The remote peer id whose role needs to be changed
230
254
  * @param toRole The name of the new role.
231
255
  * @param [force] this being true would mean that user won't get a request to accept role change
256
+ * @returns Promise<void> - resolves when the role is changed
232
257
  */
233
258
  changeRoleOfPeer(forPeerId: HMSPeerID, toRole: HMSRoleName, force?: boolean): Promise<void>;
234
259
  /**
235
260
  * Request for a role change of a remote peer. Can be forced.
236
261
  * @param roles List of roles whose role needs to be changed
237
262
  * @param toRole The name of the new role.
263
+ * @returns Promise<void> - resolves when the role is changed
238
264
  */
239
265
  changeRoleOfPeersWithRoles(roles: HMSRoleName[], toRole: HMSRoleName): Promise<void>;
240
266
  /**
241
267
  * Accept the role change request received
242
268
  * @param {HMSRoleChangeRequest} request The original request that was received
269
+ * @returns Promise<void> - resolves when the role is accepted
243
270
  */
244
271
  acceptChangeRole(request: HMSRoleChangeRequest): Promise<void>;
245
272
  /**
@@ -252,11 +279,13 @@ export interface IHMSActions<T extends HMSGenericTypes = {
252
279
  * This can be used to mute/unmute a remote peer's track
253
280
  * @param forRemoteTrackID The track ID or array of track IDs for which you want to change the state
254
281
  * @param enabled `true` if you wish to enable(unmute permission is required) the track, `false` if you wish to disable(mute permission is required) the track
282
+ * @returns Promise<void> - resolves when the track state is changed
255
283
  */
256
284
  setRemoteTrackEnabled(forRemoteTrackID: HMSTrackID | HMSTrackID[], enabled: boolean): Promise<void>;
257
285
  /**
258
286
  * Use this to mute/unmute multiple tracks by source, role or type
259
287
  * @param {HMSChangeMultiTrackStateParams} params
288
+ * @returns Promise<void> - resolves when the track state is changed
260
289
  */
261
290
  setRemoteTracksEnabled(params: HMSChangeMultiTrackStateParams): Promise<void>;
262
291
  /**
@@ -264,17 +293,22 @@ export interface IHMSActions<T extends HMSGenericTypes = {
264
293
  * Most browsers have limitations where an audio can not be played if there was no user interaction.
265
294
  * SDK throws an autoplay error in this case, this method can be called after an UI interaction
266
295
  * to resolve the autoplay error
296
+ * @returns Promise<void> - resolves when the autoplay error is resolved
267
297
  */
268
298
  unblockAudio: () => Promise<void>;
269
299
  /**
270
300
  * If you have the **endRoom** permission, you can end the room. That means everyone will be kicked out.
271
301
  * If lock is passed as true, the room cannot be used further.
302
+ * @param lock boolean - true to lock the room
303
+ * @param reason string - reason for ending the room
304
+ * @returns Promise<void> - resolves when the room is ended
272
305
  */
273
306
  endRoom: (lock: boolean, reason: string) => Promise<void>;
274
307
  /**
275
308
  * After leave send feedback to backend for call quality purpose.
276
- * @param feedback
277
- * @param eventEndpoint
309
+ * @param feedback HMSSessionFeedback - feedback object
310
+ * @param eventEndpoint string - endpoint to send feedback
311
+ * @returns Promise<void> - resolves when the feedback is submitted
278
312
  */
279
313
  submitSessionFeedback(feedback: HMSSessionFeedback, eventEndpoint?: string): Promise<void>;
280
314
  /**
@@ -283,6 +317,7 @@ export interface IHMSActions<T extends HMSGenericTypes = {
283
317
  * @param reason a string explaining why the peer is removed from the room.
284
318
  * This string could be used to notify the user before they're removed from the room
285
319
  * using the `REMOVED_FROM_ROOM` type of notification
320
+ * @returns Promise<void> - resolves when the peer is removed
286
321
  */
287
322
  removePeer(peerID: HMSPeerID, reason: string): Promise<void>;
288
323
  /**
@@ -292,10 +327,12 @@ export interface IHMSActions<T extends HMSGenericTypes = {
292
327
  * @param params.RTMPURLs The list of ingest URLs where the call as visible in the meeting url should be streamed.
293
328
  * Optional, when not specified the method is used to just start the recording.
294
329
  * @param params.record If you want to start the recording or not.
330
+ * @returns Promise<void> - resolves when the RTMP streaming and recording is started
295
331
  */
296
332
  startRTMPOrRecording(params: RTMPRecordingConfig): Promise<void>;
297
333
  /**
298
334
  * If you want to stop both RTMP streaming and recording.
335
+ * @returns Promise<void> - resolves when the RTMP streaming and recording is stopped
299
336
  */
300
337
  stopRTMPAndRecording(): Promise<void>;
301
338
  /**
@@ -303,10 +340,14 @@ export interface IHMSActions<T extends HMSGenericTypes = {
303
340
  * otherwise @param params.variants.meetingURL This is the meeting url which is opened in a headless chrome instance for generating the HLS feed.
304
341
  * Make sure this url leads the joiner straight to the room without any preview screen or requiring additional clicks.
305
342
  * Note that streaming of only one url is currently supported and only the first variant passed will be honored.
343
+ * @param params HLSConfig - HLSConfig object with the required fields
344
+ * @returns Promise<void> - resolves when the HLS streaming is started
306
345
  */
307
346
  startHLSStreaming(params?: HLSConfig): Promise<void>;
308
347
  /**
309
348
  * If you want to stop HLS streaming. The passed in arguments is not considered at the moment, and everything related to HLS is stopped.
349
+ * @param params HLSConfig - HLSConfig object with the required fields
350
+ * @returns Promise<void> - resolves when the HLS streaming is stopped
310
351
  */
311
352
  stopHLSStreaming(params?: HLSConfig): Promise<void>;
312
353
  /**
@@ -320,21 +361,21 @@ export interface IHMSActions<T extends HMSGenericTypes = {
320
361
  */
321
362
  stopTranscription(params: TranscriptionConfig): Promise<void>;
322
363
  /**
323
- * @alpha
324
364
  * Used to define date range metadata in a media playlist.
325
365
  * This api adds EXT-X-DATERANGE tags to the media playlist.
326
366
  * It is useful for defining timed metadata for interstitial regions such as advertisements,
327
367
  * but can be used to define any timed metadata needed by your stream.
328
- * usage (e.g)
368
+ * ```js
329
369
  * const metadataList = `[{
330
- * payload: "some string 1",
331
- * duration: 2
332
- * },
333
- * {
334
- * payload: "some string 2",
335
- * duration: 3
370
+ * payload: "some string 1",
371
+ * duration: 2
372
+ * },
373
+ * {
374
+ * payload: "some string 2",
375
+ * duration: 3
336
376
  * }]`
337
377
  * sendHLSTimedMetadata(metadataList);
378
+ * ```
338
379
  */
339
380
  sendHLSTimedMetadata(metadataList: HLSTimedMetadata[]): Promise<void>;
340
381
  /**
@@ -460,11 +501,21 @@ export interface IHMSActions<T extends HMSGenericTypes = {
460
501
  * We recommend using our plugins for the same instead
461
502
  */
462
503
  getNativeTrackById(trackId: string): MediaStreamTrack | undefined;
504
+ /**
505
+ * Get the track object by trackId
506
+ * @param trackId string - ID of the track
507
+ * @returns HMSTrack | undefined - track object
508
+ */
463
509
  getTrackById(trackId: string): HMSTrack | undefined;
510
+ /**
511
+ * Get the auth token for the room code. This is useful when you want to join a room using a room code.
512
+ * @param tokenRequest - token request object
513
+ * @param tokenRequestOptions - token request options
514
+ */
464
515
  getAuthTokenByRoomCode(tokenRequest: TokenRequest, tokenRequestOptions?: TokenRequestOptions): Promise<string>;
465
516
  /**
466
517
  * enable sending audio speaker data to beam
467
- * @alpha
518
+ * @returns Promise<void> - resolves when the speaker data is enabled
468
519
  */
469
520
  enableBeamSpeakerLabelsLogging(): Promise<void>;
470
521
  /**
@@ -474,12 +525,45 @@ export interface IHMSActions<T extends HMSGenericTypes = {
474
525
  * is persisted throughout a session till the last peer leaves a room(cleared after the last peer leaves the room)
475
526
  */
476
527
  sessionStore: IHMSSessionStoreActions<T['sessionStore']>;
528
+ /**
529
+ * interactivityCenter contains all actions that can be performed on the interactivity center
530
+ * This will be available after joining the room
531
+ */
477
532
  interactivityCenter: IHMSInteractivityCenter;
533
+ /**
534
+ * raise hand for local peer
535
+ * @returns Promise<void> - resolves when the hand is raised
536
+ */
478
537
  raiseLocalPeerHand(): Promise<void>;
538
+ /**
539
+ * lower hand for local peer
540
+ * @returns Promise<void> - resolves when the hand is lowered
541
+ */
479
542
  lowerLocalPeerHand(): Promise<void>;
543
+ /**
544
+ * raise hand for remote peer
545
+ * @param peerId string - ID of the peer
546
+ * @returns Promise<void> - resolves when the hand is raised
547
+ */
480
548
  raiseRemotePeerHand(peerId: string): Promise<void>;
549
+ /**
550
+ * lower hand for remote peer
551
+ * @param peerId string - ID of the peer
552
+ * @returns Promise<void> - resolves when the hand is lowered
553
+ */
481
554
  lowerRemotePeerHand(peerId: string): Promise<void>;
555
+ /**
556
+ * get the list of peers in the room
557
+ * @see https://www.100ms.live/docs/react-native/v2/how-to-guides/interact-with-room/peer/large-room
558
+ * @param options HMSPeerListIteratorOptions - options for the peer list iterator
559
+ * @returns HMSPeerListIterator - iterator for the peer list
560
+ */
482
561
  getPeerListIterator(options?: HMSPeerListIteratorOptions): HMSPeerListIterator;
562
+ /**
563
+ * get the peer object by peerId
564
+ * @param peerId string - ID of the peer
565
+ * @returns Promise<HMSPeer | undefined> - resolves with the peer object
566
+ */
483
567
  getPeer(peerId: string): Promise<HMSPeer | undefined>;
484
568
  findPeerByName(options: FindPeerByNameRequestParams): Promise<{
485
569
  offset: number;
@@ -491,6 +575,9 @@ export interface IHMSActions<T extends HMSGenericTypes = {
491
575
  * @param {HMSPlaylistSettings} settings
492
576
  */
493
577
  setPlaylistSettings(settings: HMSPlaylistSettings): void;
578
+ /**
579
+ * Method to initialize diagnostics. Should only be called after joining.
580
+ */
494
581
  initDiagnostics(): HMSDiagnosticsInterface;
495
582
  /**
496
583
  * @internal
@@ -71,7 +71,7 @@ export declare class DeviceManager implements HMSDeviceManager {
71
71
  /**
72
72
  * Mweb is not able to play via call channel by default, this is to switch from media channel to call channel
73
73
  */
74
- private autoSelectAudioOutput;
74
+ autoSelectAudioOutput: () => Promise<void>;
75
75
  private getAudioOutputDeviceMatchingInput;
76
76
  private logDevices;
77
77
  }
@@ -72,4 +72,5 @@ export interface DiagnosticsRTCStats {
72
72
  bitrateSent: number;
73
73
  bitrateReceived: number;
74
74
  roundTripTime: number;
75
+ jitter: number;
75
76
  }