@videosdk.live/react-sdk 0.4.5 → 0.4.7

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