@videosdk.live/react-sdk 0.3.8 → 0.3.10

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.
@@ -86,7 +86,8 @@ export class Character extends Participant {
86
86
  | 'character-joined'
87
87
  | 'character-left'
88
88
  | 'user-message'
89
- | 'data',
89
+ | 'data'
90
+ | 'error',
90
91
  listener: (data: any) => void
91
92
  ): void;
92
93
  /**
@@ -105,7 +106,8 @@ export class Character extends Participant {
105
106
  | 'character-joined'
106
107
  | 'character-left'
107
108
  | 'user-message'
108
- | 'data',
109
+ | 'data'
110
+ | 'error',
109
111
  listener: (data: any) => void
110
112
  ): void;
111
113
  }
@@ -235,8 +235,8 @@ export function MeetingConsumer({
235
235
  participantId: string;
236
236
  decision: string;
237
237
  }) => void;
238
- onPausedAllStreams?: ({ kind }: { kind: "audio" | "video" | "share" | "shareAudio" | "all" | undefined}) => void;
239
- onResumedAllStreams?: ({ kind }: { kind: "audio" | "video" | "share" | "shareAudio" | "all" | undefined}) => void;
238
+ onPausedAllStreams?: ({ kind }: { kind: "audio" | "video" | "share" | "shareAudio" | "all" | undefined }) => void;
239
+ onResumedAllStreams?: ({ kind }: { kind: "audio" | "video" | "share" | "shareAudio" | "all" | undefined }) => void;
240
240
  onRecordingStarted?: () => void;
241
241
  onRecordingStopped?: () => void;
242
242
  onChatMessage?: (data: {
@@ -522,6 +522,7 @@ export function useParticipant(
522
522
  stopConsumingMicStreams: () => void;
523
523
  stopConsumingWebcamStreams: () => void;
524
524
  setQuality: (quality: 'low' | 'med' | 'high') => void;
525
+ setScreenShareQuality: (quality: 'low' | 'med' | 'high') => void;
525
526
  setViewPort: (width: number, height: number) => void;
526
527
  enableMic: () => void;
527
528
  disableMic: () => void;
@@ -537,15 +538,6 @@ export function useParticipant(
537
538
  }) => Promise<string | null>;
538
539
  pin: (data: 'SHARE_AND_CAM' | 'CAM' | 'SHARE') => void;
539
540
  unpin: (data: 'SHARE_AND_CAM' | 'CAM' | 'SHARE') => void;
540
- switchTo: ({
541
- meetingId,
542
- payload,
543
- token
544
- }: {
545
- meetingId: string;
546
- payload: string;
547
- token: string;
548
- }) => Promise<void>;
549
541
  getShareAudioStats: () => Promise<
550
542
  Array<{
551
543
  bitrate: number;
@@ -722,7 +714,12 @@ export function useMeeting({
722
714
  onMeetingStateChanged,
723
715
  onParticipantModeChanged,
724
716
  onCharacterJoined,
725
- onCharacterLeft
717
+ onCharacterLeft,
718
+ onMediaRelayStarted,
719
+ onMediaRelayStopped,
720
+ onMediaRelayError,
721
+ onMediaRelayRequestResponse,
722
+ onMediaRelayRequestReceived,
726
723
  }?: {
727
724
  onParticipantJoined?: (participant: Participant) => void;
728
725
  onParticipantLeft?: (participant: Participant) => void;
@@ -747,8 +744,8 @@ export function useMeeting({
747
744
  participantId: string;
748
745
  decision: string;
749
746
  }) => void;
750
- onPausedAllStreams?: ({ kind }: { kind: "audio" | "video" | "share" | "shareAudio" | "all" | undefined}) => void;
751
- onResumedAllStreams?: ({ kind }: { kind: "audio" | "video" | "share" | "shareAudio" | "all" | undefined}) => void;
747
+ onPausedAllStreams?: ({ kind }: { kind: "audio" | "video" | "share" | "shareAudio" | "all" | undefined }) => void;
748
+ onResumedAllStreams?: ({ kind }: { kind: "audio" | "video" | "share" | "shareAudio" | "all" | undefined }) => void;
752
749
  onRecordingStarted?: () => void;
753
750
  onRecordingStopped?: () => void;
754
751
  onChatMessage?: (data: {
@@ -851,6 +848,47 @@ export function useMeeting({
851
848
  }) => void;
852
849
  onCharacterJoined?: (character: Character) => void;
853
850
  onCharacterLeft?: (character: Character) => void;
851
+ onMediaRelayStarted?: ({
852
+ meetingId
853
+ }: {
854
+ meetingId: string
855
+ }) => void;
856
+ onMediaRelayStopped?: ({
857
+ meetingId,
858
+ reason
859
+ }: {
860
+ meetingId: string;
861
+ reason: string;
862
+ }) => void;
863
+ onMediaRelayError?: ({
864
+ meetingId,
865
+ error
866
+ }: {
867
+ meetingId: string;
868
+ error: string;
869
+ }) => void;
870
+ onMediaRelayRequestResponse?: ({
871
+ decision,
872
+ decidedBy,
873
+ meetingId
874
+ }: {
875
+ decision: "accepted" | "declined";
876
+ decidedBy: string;
877
+ meetingId: string;
878
+ }) => void;
879
+ onMediaRelayRequestReceived?: ({
880
+ participantId,
881
+ meetingId,
882
+ displayName,
883
+ accept,
884
+ reject
885
+ }: {
886
+ participantId: string;
887
+ meetingId: string;
888
+ displayName: string;
889
+ accept: () => void;
890
+ reject: () => void;
891
+ }) => void;
854
892
  }): {
855
893
  meetingId: string;
856
894
  meeting: Meeting;
@@ -1204,6 +1242,8 @@ export function useTranscription({
1204
1242
  * ---
1205
1243
  * @param onData - This will triggered when a character worker notify payload.
1206
1244
  * ---
1245
+ * @param onError - This will triggered when a there is an error related to character.
1246
+ * ---
1207
1247
  * @param onStreamEnabled - It's a callback which gets triggered whenever a character's video, audio or screen share stream is enabled.
1208
1248
  * ---
1209
1249
  * @param onStreamEnabled - It's a callback which gets triggered whenever a character's video, audio or screen share stream is disabled.
@@ -1234,6 +1274,10 @@ export function useTranscription({
1234
1274
  * function onData(topic, data) {
1235
1275
  * console.log('character data available:', topic, data);
1236
1276
  * }
1277
+ *
1278
+ * function onError(topic, data) {
1279
+ * console.log('character error:', data.code,data.message);
1280
+ * }
1237
1281
  *
1238
1282
  * const { join, leave, sendMessage, interrupt } = useCharacter({
1239
1283
  * interactionId,
@@ -1250,6 +1294,7 @@ export function useTranscription({
1250
1294
  * onCharacterMessage,
1251
1295
  * onUserMessage,
1252
1296
  * onData,
1297
+ * onError,
1253
1298
  * onCharacterJoined,
1254
1299
  * onCharacterLeft,
1255
1300
  *
@@ -1295,6 +1340,7 @@ export function useCharacter(
1295
1340
  onCharacterMessage,
1296
1341
  onUserMessage,
1297
1342
  onData,
1343
+ onError,
1298
1344
  onStreamEnabled,
1299
1345
  onStreamDisabled,
1300
1346
  onMediaStatusChanged,
@@ -1318,6 +1364,7 @@ export function useCharacter(
1318
1364
  }) => void;
1319
1365
 
1320
1366
  onData?: (topic: string, data: any) => void;
1367
+ onError?: (data: any) => void;
1321
1368
  onCharacterJoined?: () => void;
1322
1369
  onCharacterLeft?: () => void;
1323
1370
 
@@ -1503,6 +1550,8 @@ export function createCameraVideoTrack({
1503
1550
  *
1504
1551
  * #### Values : `enable`, `disable`
1505
1552
  * ---
1553
+ * @param multiStream - It will specifiy if the stream should send multiple resolution layers or single resolution layer.
1554
+ * Please refere thi link for more understanding [What is multiStream ?](https://docs.videosdk.live/react/guide/video-and-audio-calling-api-sdk/render-media/optimize-video-track#what-is-multistream)
1506
1555
  *
1507
1556
  * **Code Example**
1508
1557
  * ```js
@@ -1512,23 +1561,30 @@ export function createCameraVideoTrack({
1512
1561
  * optimizationMode: "motion", // "text" | "detail", Default : "motion"
1513
1562
  * encoderConfig: "h720p_15fps", // `h360p_30fps` | `h1080p_30fps` // Default : `h720p_15fps`
1514
1563
  * withAudio:'enable' // `disable`, Default : `disable`
1564
+ * multiStream: true // false, Default : false
1565
+ *
1515
1566
  * });
1516
1567
  * ```
1517
1568
  */
1518
1569
  export function createScreenShareVideoTrack({
1519
1570
  encoderConfig,
1520
1571
  optimizationMode,
1521
- withAudio
1572
+ withAudio,
1573
+ multiStream,
1522
1574
  }: {
1523
1575
  encoderConfig?:
1524
- | 'h360p_30fps'
1525
- | 'h720p_5fps'
1526
- | 'h720p_15fps'
1527
- | 'h1080p_15fps'
1528
- | 'h1080p_30fps'
1576
+ | "h360p_30fps"
1577
+ | "h480p_15fps"
1578
+ | "h480p_30fps"
1579
+ | "h720p_5fps"
1580
+ | "h720p_15fps"
1581
+ | "h720p_30fps"
1582
+ | "h1080p_15fps"
1583
+ | "h1080p_30fps"
1529
1584
  | undefined;
1530
1585
  optimizationMode?: 'text' | 'motion' | 'detail' | undefined;
1531
1586
  withAudio?: 'enable' | 'disable';
1587
+ multiStream?: boolean;
1532
1588
  }): Promise<MediaStream>;
1533
1589
 
1534
1590
  /**
@@ -170,7 +170,7 @@ export class Meeting {
170
170
  resumeAllStreams(
171
171
  kind?: "audio" | "video" | "share" | "shareAudio" | "all"
172
172
  ): void;
173
-
173
+
174
174
  /**
175
175
  * @param webhookUrl
176
176
  * Webhook URL which will be called by VideoSDK when the recording state gets changed
@@ -463,6 +463,25 @@ export class Meeting {
463
463
  meetingId: string;
464
464
  payload: string;
465
465
  }): Promise<void>;
466
+
467
+ /**
468
+ * @description This method is used to request media relay to another meeting
469
+ * @param options.destinationMeetingId The ID of the meeting to relay media to
470
+ * @param options.token Optional token for the destination meeting
471
+ * @param options.kinds Optional array of media types to relay ('audio', 'video', 'share', 'share_audio')
472
+ */
473
+ requestMediaRelay(options: {
474
+ destinationMeetingId: string;
475
+ token?: string;
476
+ kinds?: Array<'audio' | 'video' | 'share' | 'share_audio'>;
477
+ }): void;
478
+
479
+ /**
480
+ * @description Stop relaying media to a destination meeting
481
+ * @param destinationMeetingId The meeting ID to stop media relay to
482
+ */
483
+ stopMediaRelay(destinationMeetingId: string): void;
484
+
466
485
  /**
467
486
  * Add event listener
468
487
  * @param eventType Event name to which you want to subscribe.
@@ -507,7 +526,14 @@ export class Meeting {
507
526
  | 'transcription-text'
508
527
  | 'transcription-state-changed'
509
528
  | 'character-joined'
510
- | 'character-left',
529
+ | 'character-left'
530
+ | "paused-all-streams"
531
+ | "resumed-all-streams"
532
+ | "media-relay-started"
533
+ | "media-relay-stopped"
534
+ | "media-relay-error"
535
+ | "media-relay-request-response"
536
+ | "media-relay-request-received",
511
537
  listener: (data: any) => void
512
538
  ): void;
513
539
  /**
@@ -554,7 +580,14 @@ export class Meeting {
554
580
  | 'transcription-text'
555
581
  | 'transcription-state-changed'
556
582
  | 'character-joined'
557
- | 'character-left',
583
+ | 'character-left'
584
+ | "paused-all-streams"
585
+ | "resumed-all-streams"
586
+ | "media-relay-started"
587
+ | "media-relay-stopped"
588
+ | "media-relay-error"
589
+ | "media-relay-request-response"
590
+ | "media-relay-request-received",
558
591
 
559
592
  listener: (data: any) => void
560
593
  ): void;
@@ -85,6 +85,11 @@ export class Participant {
85
85
  * @param quality
86
86
  */
87
87
  setQuality(quality: 'low' | 'med' | 'high'): void;
88
+ /**
89
+ * @description This method can be used to set the incoming screen sharevideo quality of the participant
90
+ * @param quality
91
+ */
92
+ setScreenShareQuality(quality: 'low' | 'med' | 'high'): void;
88
93
  /**
89
94
  * @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
90
95
  * @param width Width of the Viewport in which participant video is shown
@@ -102,19 +107,6 @@ export class Participant {
102
107
  * 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
103
108
  */
104
109
  unpin(type: 'SHARE_AND_CAM' | 'CAM' | 'SHARE'): void;
105
- /**
106
- * @deprecated
107
- * @param options
108
- */
109
- switchTo({
110
- meetingId,
111
- payload,
112
- token
113
- }: {
114
- meetingId: string;
115
- payload: string;
116
- token: string;
117
- }): Promise<void>;
118
110
  /**
119
111
  * @description This method returns the Video Statistics of the participant.
120
112
  * 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)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@videosdk.live/react-sdk",
3
- "version": "0.3.8",
3
+ "version": "0.3.10",
4
4
  "license": "ISC",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.modern.js",
@@ -74,7 +74,7 @@
74
74
  }
75
75
  },
76
76
  "dependencies": {
77
- "@videosdk.live/js-sdk": "0.2.7",
77
+ "@videosdk.live/js-sdk": "0.2.8",
78
78
  "events": "^3.3.0"
79
79
  }
80
80
  }