@videosdk.live/react-sdk 0.1.69 → 0.1.71

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