@videosdk.live/react-sdk 0.4.5 → 0.4.6

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.
@@ -0,0 +1,604 @@
1
+ export class Meeting {
2
+ /**
3
+ * @description
4
+ * This represents the meetingId
5
+ */
6
+ id: string;
7
+ /**
8
+ * @description
9
+ * This represents the `participantId` of the active speaker in the meeting
10
+ */
11
+ activeSpeakerId?: string;
12
+ /**
13
+ * @description
14
+ * This represents the `participantId` of the active presenter in the meeting
15
+ */
16
+ activePresenterId?: string;
17
+ /**
18
+ * @description
19
+ * This represents the `participantId` of the main participant in the meeting
20
+ */
21
+ mainParticipantId: string;
22
+ /**
23
+ * @deprecated
24
+ */
25
+ connections: Map<string, Connection>;
26
+ /**
27
+ * @description
28
+ * These represents the `Participant` object for the local participant
29
+ */
30
+ localParticipant: Participant;
31
+ /**
32
+ * @description
33
+ * These represents the Map of all the Participant objects except local participant
34
+ */
35
+ participants: Map<string, Participant>;
36
+ /**
37
+ * @description These represents the current state of the meeting Livestream
38
+ */
39
+ livestreamState:
40
+ | 'LIVESTREAM_STOPPED'
41
+ | 'LIVESTREAM_STARTING'
42
+ | 'LIVESTREAM_STARTED'
43
+ | 'LIVESTREAM_STOPPING';
44
+ /**
45
+ * @description These represents the current state of the meeting recording
46
+ */
47
+ recordingState:
48
+ | 'RECORDING_STOPPED'
49
+ | 'RECORDING_STARTING'
50
+ | 'RECORDING_STARTED'
51
+ | 'RECORDING_STOPPING';
52
+ /**
53
+ * @description These represents the current state of the meeting HLS
54
+ *
55
+ */
56
+ hlsState: 'HLS_STOPPED' | 'HLS_STARTING' | 'HLS_STARTED' | 'HLS_STOPPING';
57
+ /**
58
+ * @description These object will provide the URLs to play the HLS streams
59
+ */
60
+ hlsUrls: {
61
+ downstreamUrl?: string;
62
+ playbackHlsUrl?: string;
63
+ livestreamUrl?: string;
64
+ };
65
+ /**
66
+ * @description These represents the current state of the meeting transcription
67
+ */
68
+ transcriptionState:
69
+ | 'TRANSCRIPTION_STOPPED'
70
+ | 'TRANSCRIPTION_STARTING'
71
+ | 'TRANSCRIPTION_STARTED'
72
+ | 'TRANSCRIPTION_STOPPING';
73
+
74
+ /**
75
+ * @description These object will contain all the messages send using the `send` method
76
+ */
77
+ messages: Array<{
78
+ from: string;
79
+ timestamp: string;
80
+ payload: string | Uint8Array;
81
+ reliability: string;
82
+ }>;
83
+
84
+ /**
85
+ * @description These method is used to join the meeting
86
+ */
87
+ join(): void;
88
+
89
+ /**
90
+ * @description This method is used to change the participant mode between SEND_AND_RECV, RECV_ONLY and SIGNALLING_ONLY
91
+ */
92
+ changeMode(mode: 'SEND_AND_RECV' | 'SIGNALLING_ONLY' | 'RECV_ONLY'): void;
93
+
94
+ /**
95
+ * @description These method is used to leave the meeting for local participant
96
+ */
97
+ leave(): void;
98
+
99
+ /**
100
+ * @description These method is used to end the meeting for all participants
101
+ */
102
+ end(): void;
103
+
104
+ /**
105
+ * @param participantId `participantId` for which entry is to be responed
106
+ * @param decision `true` if the participant is allowed to join the meeting else `false`
107
+ */
108
+ respondEntry(participantId: string, decision: boolean): void;
109
+ /**
110
+ * @description returns all the pinned participants in the meeting
111
+ */
112
+ get pinnedParticipants(): Map<string, Participant>;
113
+
114
+ /**
115
+ * @description Mute the mic of local participant and stop broadcasting audio
116
+ */
117
+ muteMic(): void;
118
+
119
+ /**
120
+ * @param customAudioTrack You can pass your own custom audio track here.
121
+ * To learn more checkour this [reference](https://docs.videosdk.live/javascript/guide/video-and-audio-calling-api-sdk/features/custom-track/custom-audio-track)
122
+ * @description unmute the mic of local participant and start broadcasting audio
123
+ */
124
+ unmuteMic(customAudioTrack?: MediaStream): void;
125
+
126
+ /**
127
+ *
128
+ * @description This method is used to stop boradcasting the video to other participants
129
+ */
130
+ disableWebcam(): void;
131
+
132
+ /**
133
+ * @param customVideoTrack You can pass your own custom video track here.
134
+ * To learn more checkour this [reference](https://docs.videosdk.live/javascript/guide/video-and-audio-calling-api-sdk/features/custom-track/custom-video-track)
135
+ * @description This method will turn on the webcam of local participant and start broadcasting video
136
+ */
137
+ enableWebcam(customVideoTrack?: MediaStream): void;
138
+ /**
139
+ * @description This method is used to stop boradcasting the screenshare to other participants
140
+ */
141
+ disableScreenShare(): void;
142
+ /**
143
+ * @param customScreenSharingTrack You can pass your own custom screen share track here.
144
+ * To learn more checkour this [reference](https://docs.videosdk.live/javascript/guide/video-and-audio-calling-api-sdk/features/custom-track/custom-screen-share-track)
145
+ * @description This method will start broadcasting participants screen share
146
+ *
147
+ */
148
+ enableScreenShare(customScreenSharingTrack?: MediaStream): void;
149
+
150
+ /**
151
+ * Send a message over the DataChannel with chunking.
152
+ *
153
+ * @param {string | Blob | ArrayBuffer | ArrayBufferView} payload - The message to send.
154
+ * @param {object} [options={}] - Additional send options.
155
+ * @param {"RELIABLE" | "UNRELIABLE"} [options.reliability="RELIABLE"] - Reliability mode.
156
+ * @returns {Promise<boolean>} Resolves `true` if the message was sent, rejects if an error occurred.
157
+ */
158
+ send(
159
+ payload: string | Blob | ArrayBuffer | ArrayBufferView,
160
+ options?: {
161
+ reliability?: "RELIABLE" | "UNRELIABLE";
162
+ }
163
+ ): Promise<boolean>;
164
+
165
+ /**
166
+ * @param kind
167
+ * Kind of stream that will be paused
168
+ */
169
+ pauseAllStreams(
170
+ kind?: "audio" | "video" | "share" | "shareAudio" | "all"
171
+ ): void;
172
+
173
+ /**
174
+ * @param kind
175
+ * Kind of stream that will be resumed
176
+ */
177
+ resumeAllStreams(
178
+ kind?: "audio" | "video" | "share" | "shareAudio" | "all"
179
+ ): void;
180
+
181
+ /**
182
+ * @param webhookUrl
183
+ * Webhook URL which will be called by VideoSDK when the recording state gets changed
184
+ * @param awsDirPath?
185
+ * awsDirPath represents the Directory you want to store your recording if you have configured your own S3 storage
186
+ *
187
+ * @param config Config can be used to configure the Recording
188
+ * @param config.layout.type This represents the layout which is to used in the Recording
189
+ * @param config.layout.priority This defines the priority of participants to be considered while composing Recording
190
+ * @param config.layout.gridSize This defines the maximum number of participants in the grid
191
+ * @param config.theme This defines the color theme of the Recording
192
+ * @param config.mode This defines the mode of the Recording as only audio or vidoe and audio both
193
+ * @param config.quality This defines the quality of the Recording
194
+ *
195
+ * @param transcription Configuration of post-meeting transcription and summary generation.
196
+ * @param transcription.enabled Enables or disables post transcription.
197
+ * @param transcription.summary.enabled Enables or disables summary generation from post transcriptions.
198
+ * @param transcription.summary.prompt Guides summary generation (optional).
199
+ */
200
+ startRecording(
201
+ webhookUrl: string,
202
+ awsDirPath: string,
203
+ config: {
204
+ layout: {
205
+ type: 'GRID' | 'SPOTLIGHT' | 'SIDEBAR';
206
+ priority: 'SPEAKER' | 'PIN';
207
+ gridSize: number;
208
+ };
209
+ theme: 'DARK' | 'LIGHT' | 'DEFAULT';
210
+ mode: 'video-and-audio' | 'audio';
211
+ quality: 'low' | 'med' | 'high';
212
+ },
213
+ transcription?: {
214
+ enabled: boolean;
215
+ summary?: {
216
+ enabled: boolean;
217
+ prompt?: string;
218
+ };
219
+ }
220
+ ): void;
221
+
222
+ /**
223
+ * @description This method is used to stop the meeting recording
224
+ */
225
+ stopRecording(): void;
226
+
227
+ /**
228
+ * This method is used to start the meeting RTMP livestream to provided output
229
+ * @param outputs This defines the array of outputs to which the RTMP livestream has to be broadcasted
230
+ * @param config Config can be used to configure the RTMP livestream
231
+ * @param config.layout.type This represents the layout which is to used in the RTMP livestream
232
+ * @param config.layout.priority This defines the priority of participants to be considered while composing RTMP livestream
233
+ * @param config.layout.gridSize This defines the maximum number of participants in the grid
234
+ * @param config.theme This defines the color theme of the RTMP livestream
235
+ */
236
+ startLivestream(
237
+ outputs: Array<{
238
+ url: string;
239
+ streamKey: string;
240
+ }>,
241
+ config?: {
242
+ layout: {
243
+ type: 'GRID' | 'SPOTLIGHT' | 'SIDEBAR';
244
+ priority: 'SPEAKER' | 'PIN';
245
+ gridSize: number;
246
+ };
247
+ theme: 'DARK' | 'LIGHT' | 'DEFAULT';
248
+ }
249
+ ): void;
250
+
251
+ /**
252
+ * @description This method is used to stop the meeting RTMP livestream
253
+ */
254
+ stopLivestream(): void;
255
+
256
+ /**
257
+ * This method is used to start the meeting HLS
258
+ * @param config Config can be used to configure the HLS stream
259
+ * @param config.layout.type This represents the layout which is to used in the HLS
260
+ * @param config.layout.priority This defines the priority of participants to be considered while composing HLS
261
+ * @param config.layout.gridSize This defines the maximum number of participants in the grid
262
+ * @param config.theme This defines the color theme of the HLS livestream
263
+ * @param config.mode This defines the mode of the HLS livestream as only audio or vidoe and audio both
264
+ * @param config.quality This defines the quality of the HLS livestream
265
+ *
266
+ * @param transcription Configuration of post-meeting transcription and summary generation.
267
+ * @param transcription.enabled Enables or disables post transcription.
268
+ * @param transcription.summary.enabled Enables or disables summary generation from post transcriptions.
269
+ * @param transcription.summary.prompt Guides summary generation (optional).
270
+ */
271
+ startHls(config?: {
272
+ layout: {
273
+ type: 'GRID' | 'SPOTLIGHT' | 'SIDEBAR';
274
+ priority: 'SPEAKER' | 'PIN';
275
+ gridSize: number;
276
+ };
277
+ theme: 'DARK' | 'LIGHT' | 'DEFAULT';
278
+ mode: 'video-and-audio' | 'audio';
279
+ quality: 'low' | 'med' | 'high';
280
+ transcription?: {
281
+ enabled: boolean;
282
+ summary?: {
283
+ enabled: boolean;
284
+ prompt?: string;
285
+ };
286
+ };
287
+ }): Promise<void>;
288
+
289
+ /**
290
+ * @description This method is used to stop the meeting HLS
291
+ */
292
+ stopHls(): void;
293
+
294
+ /**
295
+ * @description This method returns all the available mics
296
+ */
297
+ getMics(): Promise<
298
+ Array<{
299
+ deviceId: string;
300
+ label: string;
301
+ }>
302
+ >;
303
+
304
+ /**
305
+ * @description This method returns all the available webcams
306
+ */
307
+ getWebcams(): Promise<
308
+ Array<{
309
+ deviceId: string;
310
+ label: string;
311
+ facingMode: 'front' | 'environment';
312
+ }>
313
+ >;
314
+
315
+ /**
316
+ *
317
+ * @param object These can be the `deviceId` to which the mic input has to be changed or
318
+ * you can pass the audio stream to this method which will be used for the audio broadcast
319
+ */
320
+ changeMic(object: string | MediaStream): void;
321
+
322
+ /**
323
+ * @description This method is used to switch to a different meeting
324
+ * @param meetingId The ID of the meeting to switch to (mandatory)
325
+ * @param token The token for the new meeting (optional)
326
+ */
327
+ switchTo({
328
+ meetingId,
329
+ token
330
+ }: {
331
+ meetingId: string;
332
+ token?: string;
333
+ }): void;
334
+
335
+ /**
336
+ *
337
+ * @param object These can be the `deviceId` to which the webcam input has to be changed or
338
+ * you can pass the video stream to this method which will be used for the video broadcast
339
+ */
340
+ changeWebcam(object: string | MediaStream): void;
341
+
342
+ /**
343
+ * @param stream This method will be used to replace the provided stream with current webcam stream
344
+ */
345
+ replaceWebcamStream(stream: MediaStream): void;
346
+
347
+ /**
348
+ *
349
+ * @param quality This method will be used set the webcam quality to be used.
350
+ */
351
+ setWebcamQuality(quality: 'low' | 'med' | 'high'): void;
352
+
353
+ /**
354
+ * Used for internal purpose
355
+ */
356
+ startWhiteboard(): void;
357
+
358
+ /**
359
+ * Used for internal purpose
360
+ */
361
+ stopWhiteboard(): void;
362
+
363
+ /**
364
+ * @deprecated
365
+ * @param options
366
+ */
367
+ startVideo({ link }: { link: string }): void;
368
+ /**
369
+ * @deprecated
370
+ */
371
+ stopVideo(): void;
372
+ /**
373
+ * @deprecated
374
+ */
375
+ resumeVideo(): void;
376
+ refreshConnection(): void;
377
+ /**
378
+ * @deprecated
379
+ * @param options
380
+ */
381
+ pauseVideo({ currentTime }: { currentTime: number }): void;
382
+ /**
383
+ * @deprecated
384
+ * @param options
385
+ */
386
+ seekVideo({ currentTime }: { currentTime: number }): void;
387
+
388
+ /**
389
+ * @description Enables Adaptive Subscription, which dynamically adjusts the subscribed video streams
390
+ * based on participant visibility and network conditions to optimize performance in large meetings.
391
+ */
392
+ enableAdaptiveSubscription(): void;
393
+ /**
394
+ * @description Disables Adaptive Subscription, forcing all subscribed video streams to remain active
395
+ * regardless of participant visibility or network conditions.
396
+ */
397
+ disableAdaptiveSubscription(): void;
398
+ pubSub: {
399
+ /**
400
+ * Publish message to a topic
401
+ *
402
+ * @param topic Topic to which the message will be published
403
+ * @param message This will be the actual message which has to be send
404
+ * @param options This will define other options like `persist` which will decide if the message has to be stored or not
405
+ */
406
+ publish: (
407
+ topic: string,
408
+ message: string,
409
+ options: {
410
+ persist: boolean;
411
+ },
412
+ payload: object,
413
+ sendOnly: Array<String>
414
+ ) => Promise<void>;
415
+ /**
416
+ * Subscribe to message on a topic
417
+ *
418
+ * @param topic Topic to which you want to subscribe
419
+ * @param callback Callback function which will be triggered when a new message is received
420
+ */
421
+ subscribe: (
422
+ topic: string,
423
+ callback: (message: {
424
+ id: string;
425
+ message: string;
426
+ senderId: string;
427
+ senderName: string;
428
+ timestamp: string;
429
+ topic: string;
430
+ payload: object;
431
+ }) => void
432
+ ) => Promise<
433
+ Array<{
434
+ id: string;
435
+ message: string;
436
+ senderId: string;
437
+ senderName: string;
438
+ timestamp: string;
439
+ topic: string;
440
+ payload: object;
441
+ }>
442
+ >;
443
+ /**
444
+ * Unsubscribe from messages on a topic
445
+ *
446
+ * @param topic Topic to which you want to stop getting message for
447
+ * @param callback Callback function which was passed which subscribing to the topic
448
+ */
449
+ unsubscribe: (
450
+ topic: string,
451
+ callback: (message: {
452
+ id: string;
453
+ message: string;
454
+ senderId: string;
455
+ senderName: string;
456
+ timestamp: string;
457
+ topic: string;
458
+ payload: object;
459
+ }) => void
460
+ ) => Promise<void>;
461
+ };
462
+ /**
463
+ * @deprecated
464
+ * @param options
465
+ */
466
+ connectTo({
467
+ meetingId,
468
+ payload
469
+ }: {
470
+ meetingId: string;
471
+ payload: string;
472
+ }): Promise<void>;
473
+
474
+ /**
475
+ * @description This method is used to request media relay to another meeting
476
+ * @param options.destinationMeetingId The ID of the meeting to relay media to
477
+ * @param options.token Optional token for the destination meeting
478
+ * @param options.kinds Optional array of media types to relay ('audio', 'video', 'share', 'share_audio')
479
+ */
480
+ requestMediaRelay(options: {
481
+ destinationMeetingId: string;
482
+ token?: string;
483
+ kinds?: Array<'audio' | 'video' | 'share' | 'share_audio'>;
484
+ }): void;
485
+
486
+ /**
487
+ * @description Stop relaying media to a destination meeting
488
+ * @param destinationMeetingId The meeting ID to stop media relay to
489
+ */
490
+ stopMediaRelay(destinationMeetingId: string): void;
491
+
492
+ /**
493
+ * Add event listener
494
+ * @param eventType Event name to which you want to subscribe.
495
+ * @param listener Callback function which will be triggered when the event happens
496
+ */
497
+ on(
498
+ eventType:
499
+ | 'participant-joined'
500
+ | 'participant-left'
501
+ | 'participant-mode-change'
502
+ | 'speaker-changed'
503
+ | 'presenter-changed'
504
+ | 'main-participant-changed'
505
+ | 'entry-requested'
506
+ | 'entry-responded'
507
+ | 'recording-started'
508
+ | 'recording-stopped'
509
+ | 'recording-state-changed'
510
+ | 'livestream-started'
511
+ | 'livestream-stopped'
512
+ | 'livestream-state-changed'
513
+ | 'hls-started'
514
+ | 'hls-stopped'
515
+ | 'hls-state-changed'
516
+ | 'stream-enabled'
517
+ | 'stream-disabled'
518
+ | 'whiteboard-started'
519
+ | 'whiteboard-stopped'
520
+ | 'meeting-joined'
521
+ | 'meeting-left'
522
+ | 'video-state-changed'
523
+ | 'video-seeked'
524
+ | 'mic-requested'
525
+ | 'webcam-requested'
526
+ | 'pin-state-changed'
527
+ | 'connection-open'
528
+ | 'connection-close'
529
+ | 'meeting-state-changed'
530
+ | 'switch-meeting'
531
+ | 'error'
532
+ | 'data'
533
+ | 'transcription-text'
534
+ | 'transcription-state-changed'
535
+ | 'character-joined'
536
+ | 'character-left'
537
+ | "paused-all-streams"
538
+ | "resumed-all-streams"
539
+ | "media-relay-started"
540
+ | "media-relay-stopped"
541
+ | "media-relay-error"
542
+ | "media-relay-request-response"
543
+ | "media-relay-request-received",
544
+ listener: (data: any) => void
545
+ ): void;
546
+ /**
547
+ * Remove event listener
548
+ * @param eventType Event name to which you want to unsubscribe.
549
+ * @param listener Callback function which was passed while subscribing to the event
550
+ */
551
+ off(
552
+ eventType:
553
+ | 'participant-joined'
554
+ | 'participant-left'
555
+ | 'participant-mode-change'
556
+ | 'speaker-changed'
557
+ | 'presenter-changed'
558
+ | 'main-participant-changed'
559
+ | 'entry-requested'
560
+ | 'entry-responded'
561
+ | 'recording-started'
562
+ | 'recording-stopped'
563
+ | 'recording-state-changed'
564
+ | 'livestream-started'
565
+ | 'livestream-stopped'
566
+ | 'livestream-state-changed'
567
+ | 'hls-started'
568
+ | 'hls-stopped'
569
+ | 'hls-state-changed'
570
+ | 'stream-enabled'
571
+ | 'stream-disabled'
572
+ | 'whiteboard-started'
573
+ | 'whiteboard-stopped'
574
+ | 'meeting-joined'
575
+ | 'meeting-left'
576
+ | 'video-state-changed'
577
+ | 'video-seeked'
578
+ | 'mic-requested'
579
+ | 'webcam-requested'
580
+ | 'pin-state-changed'
581
+ | 'connection-open'
582
+ | 'connection-close'
583
+ | 'meeting-state-changed'
584
+ | 'switch-meeting'
585
+ | 'error'
586
+ | 'data'
587
+ | 'transcription-text'
588
+ | 'transcription-state-changed'
589
+ | 'character-joined'
590
+ | 'character-left'
591
+ | "paused-all-streams"
592
+ | "resumed-all-streams"
593
+ | "media-relay-started"
594
+ | "media-relay-stopped"
595
+ | "media-relay-error"
596
+ | "media-relay-request-response"
597
+ | "media-relay-request-received",
598
+
599
+ listener: (data: any) => void
600
+ ): void;
601
+ }
602
+
603
+ import { Participant } from './participant';
604
+ import { Connection } from './connection';