@videosdk.live/react-sdk 0.1.87 → 0.1.89

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,491 @@
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 `sendChatMessage` method
76
+ */
77
+ messages: Array<{
78
+ message: string;
79
+ senderId: string;
80
+ senderName: string;
81
+ timestamp: Date;
82
+ topic: string;
83
+ payload: object;
84
+ }>;
85
+
86
+ /**
87
+ * @description These method is used to join the meeting
88
+ */
89
+ join(): void;
90
+
91
+ /**
92
+ * @description These method is used to change the participant mode between CONFERENCE and VIEWER
93
+ */
94
+ changeMode(mode: 'CONFERENCE' | 'VIEWER'): void;
95
+
96
+ /**
97
+ * @description These method is used to leave the meeting for local participant
98
+ */
99
+ leave(): void;
100
+
101
+ /**
102
+ * @description These method is used to end the meeting for all participants
103
+ */
104
+ end(): void;
105
+
106
+ /**
107
+ * @param participantId `participantId` for which entry is to be responed
108
+ * @param decision `true` if the participant is allowed to join the meeting else `false`
109
+ */
110
+ respondEntry(participantId: string, decision: boolean): void;
111
+ /**
112
+ * @description returns all the pinned participants in the meeting
113
+ */
114
+ get pinnedParticipants(): Map<string, Participant>;
115
+
116
+ /**
117
+ * @description Mute the mic of local participant and stop broadcasting audio
118
+ */
119
+ muteMic(): void;
120
+
121
+ /**
122
+ * @param customAudioTrack You can pass your own custom audio track here.
123
+ * To learn more checkour this [reference](https://docs.videosdk.live/javascript/guide/video-and-audio-calling-api-sdk/features/custom-track/custom-audio-track)
124
+ * @description unmute the mic of local participant and start broadcasting audio
125
+ */
126
+ unmuteMic(customAudioTrack?: MediaStream): void;
127
+
128
+ /**
129
+ *
130
+ * @description This method is used to stop boradcasting the video to other participants
131
+ */
132
+ disableWebcam(): void;
133
+
134
+ /**
135
+ * @param customVideoTrack You can pass your own custom video track here.
136
+ * To learn more checkour this [reference](https://docs.videosdk.live/javascript/guide/video-and-audio-calling-api-sdk/features/custom-track/custom-video-track)
137
+ * @description This method will turn on the webcam of local participant and start broadcasting video
138
+ */
139
+ enableWebcam(customVideoTrack?: MediaStream): void;
140
+ /**
141
+ * @description This method is used to stop boradcasting the screenshare to other participants
142
+ */
143
+ disableScreenShare(): void;
144
+ /**
145
+ * @param customScreenSharingTrack You can pass your own custom screen share track here.
146
+ * 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)
147
+ * @description This method will start broadcasting participants screen share
148
+ *
149
+ */
150
+ enableScreenShare(customScreenSharingTrack?: MediaStream): void;
151
+
152
+ /**
153
+ * @deprecated
154
+ * @param text Message which is to be send to all participants in th meeting
155
+ */
156
+ sendChatMessage(text: string): void;
157
+
158
+ /**
159
+ * @param webhookUrl
160
+ * Webhook URL which will be called by VideoSDK when the recording state gets changed
161
+ * @param awsDirPath?
162
+ * awsDirPath represents the Directory you want to store your recording if you have configured your own S3 storage
163
+ *
164
+ * @param config Config can be used to configure the HLS stream
165
+ * @param config.layout.type These represents the layout which is to used in the HLS
166
+ * @param config.layout.priority These defines the priority of participants to be considered while composing HLS
167
+ * @param config.layout.gridSize These defines the maximum number of participants in the grid
168
+ * @param config.theme These defines the color theme of the HLS livestream
169
+ * @param config.mode These defines the mode of the HLS livestream as only audio or vidoe and audio both
170
+ * @param config.quality These defines the quality of the HLS livestream
171
+ */
172
+ startRecording(
173
+ webhookUrl: string,
174
+ awsDirPath: string,
175
+ config: {
176
+ layout: {
177
+ type: 'GRID' | 'SPOTLIGHT' | 'SIDEBAR';
178
+ priority: 'SPEAKER' | 'PIN';
179
+ gridSize: number;
180
+ };
181
+ theme: 'DARK' | 'LIGHT' | 'DEFAULT';
182
+ mode: 'video-and-audio' | 'audio';
183
+ quality: 'low' | 'med' | 'high';
184
+ }
185
+ ): void;
186
+
187
+ /**
188
+ * @description This method is used to stop the meeting recording
189
+ */
190
+ stopRecording(): void;
191
+
192
+ /**
193
+ * These method is used to start the meeting RTMP to provided output
194
+ * @param outputs These defines the array of outputs to which the RTMP has to be broadcasted
195
+ * @param config Config can be used to configure the HLS stream
196
+ * @param config.layout.type These represents the layout which is to used in the HLS
197
+ * @param config.layout.priority These defines the priority of participants to be considered while composing HLS
198
+ * @param config.layout.gridSize These defines the maximum number of participants in the grid
199
+ * @param config.theme These defines the color theme of the RTMP livestream
200
+ */
201
+ startLivestream(
202
+ outputs: Array<{
203
+ url: string;
204
+ streamKey: string;
205
+ }>,
206
+ config?: {
207
+ layout: {
208
+ type: 'GRID' | 'SPOTLIGHT' | 'SIDEBAR';
209
+ priority: 'SPEAKER' | 'PIN';
210
+ gridSize: number;
211
+ };
212
+ theme: 'DARK' | 'LIGHT' | 'DEFAULT';
213
+ }
214
+ ): void;
215
+
216
+ /**
217
+ * @description This method is used to stop the meeting livestream
218
+ */
219
+ stopLivestream(): void;
220
+
221
+ /**
222
+ * These method is used to start the meeting HLS
223
+ * @param config Config can be used to configure the HLS stream
224
+ * @param config.layout.type These represents the layout which is to used in the HLS
225
+ * @param config.layout.priority These defines the priority of participants to be considered while composing HLS
226
+ * @param config.layout.gridSize These defines the maximum number of participants in the grid
227
+ * @param config.theme These defines the color theme of the HLS livestream
228
+ * @param config.mode These defines the mode of the HLS livestream as only audio or vidoe and audio both
229
+ * @param config.quality These defines the quality of the HLS livestream
230
+ */
231
+ startHls(config?: {
232
+ layout: {
233
+ type: 'GRID' | 'SPOTLIGHT' | 'SIDEBAR';
234
+ priority: 'SPEAKER' | 'PIN';
235
+ gridSize: number;
236
+ };
237
+ theme: 'DARK' | 'LIGHT' | 'DEFAULT';
238
+ mode: 'video-and-audio' | 'audio';
239
+ quality: 'low' | 'med' | 'high';
240
+ }): Promise<void>;
241
+
242
+ /**
243
+ * @description This method is used to stop the meeting HLS
244
+ */
245
+ stopHls(): void;
246
+
247
+ /**
248
+ * @description This method returns all the available mics
249
+ */
250
+ getMics(): Promise<
251
+ Array<{
252
+ deviceId: string;
253
+ label: string;
254
+ }>
255
+ >;
256
+
257
+ /**
258
+ * @description This method returns all the available webcams
259
+ */
260
+ getWebcams(): Promise<
261
+ Array<{
262
+ deviceId: string;
263
+ label: string;
264
+ facingMode: 'front' | 'environment';
265
+ }>
266
+ >;
267
+
268
+ /**
269
+ *
270
+ * @param object These can be the `deviceId` to which the mic input has to be changed or
271
+ * you can pass the audio stream to this method which will be used for the audio broadcast
272
+ */
273
+ changeMic(object: string | MediaStream): void;
274
+
275
+ /**
276
+ *
277
+ * @param object These can be the `deviceId` to which the webcam input has to be changed or
278
+ * you can pass the video stream to this method which will be used for the video broadcast
279
+ */
280
+ changeWebcam(object: string | MediaStream): void;
281
+
282
+ /**
283
+ * @param stream This method will be used to replace the provided stream with current webcam stream
284
+ */
285
+ replaceWebcamStream(stream: MediaStream): void;
286
+
287
+ /**
288
+ *
289
+ * @param quality This method will be used set the webcam quality to be used.
290
+ */
291
+ setWebcamQuality(quality: 'low' | 'med' | 'high'): void;
292
+
293
+ /**
294
+ * Used for internal purpose
295
+ */
296
+ startWhiteboard(): void;
297
+
298
+ /**
299
+ * Used for internal purpose
300
+ */
301
+ stopWhiteboard(): void;
302
+
303
+ /**
304
+ * @deprecated
305
+ * @param options
306
+ */
307
+ startVideo({ link }: { link: string }): void;
308
+ /**
309
+ * @deprecated
310
+ */
311
+ stopVideo(): void;
312
+ /**
313
+ * @deprecated
314
+ */
315
+ resumeVideo(): void;
316
+ refreshConnection(): void;
317
+ /**
318
+ * @deprecated
319
+ * @param options
320
+ */
321
+ pauseVideo({ currentTime }: { currentTime: number }): void;
322
+ /**
323
+ * @deprecated
324
+ * @param options
325
+ */
326
+ seekVideo({ currentTime }: { currentTime: number }): void;
327
+ pubSub: {
328
+ /**
329
+ * Publish message to a topic
330
+ *
331
+ * @param topic Topic to which the message will be published
332
+ * @param message This will be the actual message which has to be send
333
+ * @param options This will define other options like `persist` which will decide if the message has to be stored or not
334
+ */
335
+ publish: (
336
+ topic: string,
337
+ message: string,
338
+ options: {
339
+ persist: boolean;
340
+ },
341
+ payload: object,
342
+ sendOnly: Array<String>
343
+ ) => Promise<void>;
344
+ /**
345
+ * Subscribe to message on a topic
346
+ *
347
+ * @param topic Topic to which you want to subscribe
348
+ * @param callback Callback function which will be triggered when a new message is received
349
+ */
350
+ subscribe: (
351
+ topic: string,
352
+ callback: (message: {
353
+ id: string;
354
+ message: string;
355
+ senderId: string;
356
+ senderName: string;
357
+ timestamp: string;
358
+ topic: string;
359
+ payload: object;
360
+ }) => void
361
+ ) => Promise<
362
+ Array<{
363
+ id: string;
364
+ message: string;
365
+ senderId: string;
366
+ senderName: string;
367
+ timestamp: string;
368
+ topic: string;
369
+ payload: object;
370
+ }>
371
+ >;
372
+ /**
373
+ * Unsubscribe from messages on a topic
374
+ *
375
+ * @param topic Topic to which you want to stop getting message for
376
+ * @param callback Callback function which was passed which subscribing to the topic
377
+ */
378
+ unsubscribe: (
379
+ topic: string,
380
+ callback: (message: {
381
+ id: string;
382
+ message: string;
383
+ senderId: string;
384
+ senderName: string;
385
+ timestamp: string;
386
+ topic: string;
387
+ payload: object;
388
+ }) => void
389
+ ) => Promise<void>;
390
+ };
391
+ /**
392
+ * @deprecated
393
+ * @param options
394
+ */
395
+ connectTo({
396
+ meetingId,
397
+ payload
398
+ }: {
399
+ meetingId: string;
400
+ payload: string;
401
+ }): Promise<void>;
402
+ /**
403
+ * Add event listener
404
+ * @param eventType Event name to which you want to subscribe.
405
+ * @param listener Callback function which will be triggered when the event happens
406
+ */
407
+ on(
408
+ eventType:
409
+ | 'participant-joined'
410
+ | 'participant-left'
411
+ | 'participant-mode-change'
412
+ | 'speaker-changed'
413
+ | 'presenter-changed'
414
+ | 'main-participant-changed'
415
+ | 'entry-requested'
416
+ | 'entry-responded'
417
+ | 'recording-started'
418
+ | 'recording-stopped'
419
+ | 'recording-state-changed'
420
+ | 'livestream-started'
421
+ | 'livestream-stopped'
422
+ | 'livestream-state-changed'
423
+ | 'hls-started'
424
+ | 'hls-stopped'
425
+ | 'hls-state-changed'
426
+ | 'stream-enabled'
427
+ | 'stream-disabled'
428
+ | 'whiteboard-started'
429
+ | 'whiteboard-stopped'
430
+ | 'meeting-joined'
431
+ | 'meeting-left'
432
+ | 'video-state-changed'
433
+ | 'video-seeked'
434
+ | 'mic-requested'
435
+ | 'webcam-requested'
436
+ | 'pin-state-changed'
437
+ | 'connection-open'
438
+ | 'connection-close'
439
+ | 'meeting-state-changed'
440
+ | 'switch-meeting'
441
+ | 'error'
442
+ | 'chat-message',
443
+ listener: (data: any) => void
444
+ ): void;
445
+ /**
446
+ * Remove event listener
447
+ * @param eventType Event name to which you want to unsubscribe.
448
+ * @param listener Callback function which was passed while subscribing to the event
449
+ */
450
+ off(
451
+ eventType:
452
+ | 'participant-joined'
453
+ | 'participant-left'
454
+ | 'participant-mode-change'
455
+ | 'speaker-changed'
456
+ | 'presenter-changed'
457
+ | 'main-participant-changed'
458
+ | 'entry-requested'
459
+ | 'entry-responded'
460
+ | 'recording-started'
461
+ | 'recording-stopped'
462
+ | 'recording-state-changed'
463
+ | 'livestream-started'
464
+ | 'livestream-stopped'
465
+ | 'livestream-state-changed'
466
+ | 'hls-started'
467
+ | 'hls-stopped'
468
+ | 'hls-state-changed'
469
+ | 'stream-enabled'
470
+ | 'stream-disabled'
471
+ | 'whiteboard-started'
472
+ | 'whiteboard-stopped'
473
+ | 'meeting-joined'
474
+ | 'meeting-left'
475
+ | 'video-state-changed'
476
+ | 'video-seeked'
477
+ | 'mic-requested'
478
+ | 'webcam-requested'
479
+ | 'pin-state-changed'
480
+ | 'connection-open'
481
+ | 'connection-close'
482
+ | 'meeting-state-changed'
483
+ | 'switch-meeting'
484
+ | 'error'
485
+ | 'chat-message',
486
+ listener: (data: any) => void
487
+ ): void;
488
+ }
489
+
490
+ import { Participant } from './participant';
491
+ import { Connection } from './connection';
@@ -0,0 +1,194 @@
1
+ export class Participant {
2
+ /**
3
+ * @description This represents the participant's ID
4
+ */
5
+ id: string;
6
+ /**
7
+ * @description This represents the participant's name
8
+ */
9
+ displayName: string;
10
+ /**
11
+ * @description This represents the all the Streams that the participant is producing
12
+ *
13
+ */
14
+ streams: Map<string, Stream>;
15
+ /**
16
+ * @description This represents the quality of video being consumed for the participant
17
+ *
18
+ */
19
+ quality: 'low' | 'med' | 'high';
20
+ /**
21
+ * @description This represents if the participant is local or remote
22
+ *
23
+ */
24
+ local: boolean;
25
+ /**
26
+ * @description This represents participant's current pin state
27
+ *
28
+ */
29
+ pinState: {
30
+ cam: boolean;
31
+ share: boolean;
32
+ };
33
+ /**
34
+ * @description This represents participant's current webcam status
35
+ */
36
+ webcamOn: boolean;
37
+ /**
38
+ * @description This represents participant's current mic status
39
+ *
40
+ */
41
+ micOn: boolean;
42
+ /**
43
+ * @description This represents participant's current mode
44
+ *
45
+ */
46
+ mode: 'CONFERENCE' | 'VIEWER';
47
+ /**
48
+ * @description This represents metaData which is passed in MeetingProvider
49
+ *
50
+ */
51
+ metaData: object;
52
+
53
+ /**
54
+ * @description This method can be used to kickout a participant from the meeting
55
+ */
56
+ remove(): void;
57
+ /**
58
+ * @description This method can be used to enable mic of the participant in the meeting
59
+ */
60
+ enableMic(): void;
61
+ /**
62
+ * @description This method can be used to disable mic of the participant in the meeting
63
+ */
64
+ disableMic(): void;
65
+ /**
66
+ * @description This method can be used to enable webcam of the participant in the meeting
67
+ */
68
+ enableWebcam(): void;
69
+ /**
70
+ * @description This method can be used to disable webcam of the participant in the meeting
71
+ */
72
+ disableWebcam(): void;
73
+ /**
74
+ * @description This method can be used to capture image in the meeting
75
+ */
76
+ captureImage({height,width}:{height?:number,width?:number}): Promise<string | null>;
77
+ /**
78
+ * @description This method can be used to set the incoming video quality of the participant
79
+ * @param quality
80
+ */
81
+ setQuality(quality: 'low' | 'med' | 'high'): void;
82
+ /**
83
+ * @description This method can be used to set the video quality of the participant based on the size of the viewport it is being displayed in
84
+ * @param width Width of the Viewport in which participant video is shown
85
+ * @param height Height of the Viewport in which participant video is shown
86
+ */
87
+ setViewPort(width: number, height: number): void;
88
+
89
+ /**
90
+ * @param type If `SHARE_AND_CAM` is provided, it will pin screenshare and camera of the participant.
91
+ * If `CAM` is provided, it will only pin the participant's camera, If `SHARE` is provided, it will only pin the participant's screen share
92
+ */
93
+ pin(type: 'SHARE_AND_CAM' | 'CAM' | 'SHARE'): void;
94
+ /**
95
+ * @param type If `SHARE_AND_CAM` is provided, it will unpin screenshare and camera of the participant.
96
+ * If `CAM` is provided, it will only unpin the participant's camera, If `SHARE` is provided, it will only unpin the participant's screen share
97
+ */
98
+ unpin(type: 'SHARE_AND_CAM' | 'CAM' | 'SHARE'): void;
99
+ /**
100
+ * @deprecated
101
+ * @param options
102
+ */
103
+ switchTo({ meetingId, payload, token }: { meetingId: string; payload: string; token: string }): Promise<void>;
104
+ /**
105
+ * @description This method returns the Video Statistics of the participant.
106
+ * To learn more about the video statistics check these [reference](https://docs.videosdk.live/react/guide/video-and-audio-calling-api-sdk/render-media/understanding-call-quality)
107
+ */
108
+ getVideoStats(): Promise<
109
+ Array<{
110
+ bitrate: number;
111
+ rtt: number;
112
+ network: string;
113
+ codec: string;
114
+ jitter: number;
115
+ limitation: any;
116
+ totalPackets: number;
117
+ packetsLost: number;
118
+ concealmentEvents: number;
119
+ insertedSamplesForDecelaration: number;
120
+ removedSamplesForAccelaration: number;
121
+ size: any;
122
+ currentSpatialLayer: number;
123
+ currentTemporalLayer: number;
124
+ preferredSpatialLayer: number;
125
+ preferredTemporalLayer: number;
126
+ }>
127
+ >;
128
+ /**
129
+ * @description This method returns the Screen Share Statistics of the participant.
130
+ * To learn more about the video statistics check these [reference](https://docs.videosdk.live/react/guide/video-and-audio-calling-api-sdk/render-media/understanding-call-quality)
131
+ */
132
+ getShareStats(): Promise<
133
+ Array<{
134
+ bitrate: number;
135
+ rtt: number;
136
+ network: string;
137
+ codec: string;
138
+ jitter: number;
139
+ limitation: any;
140
+ totalPackets: number;
141
+ packetsLost: number;
142
+ concealmentEvents: number;
143
+ insertedSamplesForDecelaration: number;
144
+ removedSamplesForAccelaration: number;
145
+ size: any;
146
+ currentSpatialLayer: number;
147
+ currentTemporalLayer: number;
148
+ preferredSpatialLayer: number;
149
+ preferredTemporalLayer: number;
150
+ }>
151
+ >;
152
+ /**
153
+ * @description This method returns the Audio Statistics of the participant.
154
+ * To learn more about the video statistics check these [reference](https://docs.videosdk.live/react/guide/video-and-audio-calling-api-sdk/render-media/understanding-call-quality)
155
+ */
156
+ getAudioStats(): Promise<
157
+ Array<{
158
+ bitrate: number;
159
+ rtt: number;
160
+ network: string;
161
+ codec: string;
162
+ jitter: number;
163
+ totalPackets: number;
164
+ packetsLost: number;
165
+ concealmentEvents: number;
166
+ insertedSamplesForDecelaration: number;
167
+ removedSamplesForAccelaration: number;
168
+ size: any;
169
+ }>
170
+ >;
171
+ consumeMicStreams(): void;
172
+ consumeWebcamStreams(): void;
173
+ stopConsumingWebcamStreams(): void;
174
+ stopConsumingMicStreams(): void;
175
+ /**
176
+ * Add event listener
177
+ * @param eventType Event name to which you want to subscribe.
178
+ * @param listener Callback function which will be triggered when the event happens
179
+ */
180
+ on(
181
+ eventType: 'stream-enabled' | 'stream-disabled' | 'media-status-changed' | 'video-quality-changed',
182
+ listener: (data: any) => void,
183
+ ): void;
184
+ /**
185
+ * Remove event
186
+ * @param eventType Event name to which you want to unsubscribe.
187
+ * @param listener Callback function which was passed while subscribing to the event
188
+ */
189
+ off(
190
+ eventType: 'stream-enabled' | 'stream-disabled' | 'media-status-changed' | 'video-quality-changed',
191
+ listener: (data: any) => void,
192
+ ): void;
193
+ }
194
+ import { Stream } from './stream';
@@ -0,0 +1,5 @@
1
+ export declare enum Permission {
2
+ AUDIO = "audio",
3
+ VIDEO = "video",
4
+ AUDIO_AND_VIDEO = "audio_video"
5
+ }