@videosdk.live/react-sdk 0.4.9 → 0.4.11

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.
@@ -116,7 +116,8 @@ export function MeetingProvider({
116
116
  * ---
117
117
  * @param onParticipantJoined - This event callback is trigger when a new participant joins the meeting.
118
118
  * ---
119
- * @param onParticipantLeft - This event callback is trigger when a participant leaves the meeting.
119
+ * @param onParticipantLeft - This event callback is triggered when a participant leaves the meeting.
120
+ * - It provides the participant object and an additional reason object describing why the participant left.
120
121
  * ---
121
122
  * @param onSpeakerChanged -
122
123
  * - This event will be emitted when a active speaker changed.
@@ -218,7 +219,7 @@ export function MeetingConsumer({
218
219
  }: {
219
220
  children: any;
220
221
  onParticipantJoined?: (participant: Participant) => void;
221
- onParticipantLeft?: (participant: Participant) => void;
222
+ onParticipantLeft?: (participant: Participant, reason: { message: string, code: number }) => void;
222
223
  onSpeakerChanged?: (activeSpeakerId: string | null) => void;
223
224
  onPresenterChanged?: (presenterId: string | null) => void;
224
225
  onMainParticipantChanged?: (participant: Participant) => void;
@@ -251,7 +252,7 @@ export function MeetingConsumer({
251
252
  reliability: string;
252
253
  }) => void;
253
254
  onMeetingJoined?: () => void;
254
- onMeetingLeft?: () => void;
255
+ onMeetingLeft?: (reason: { message: string, code: number }) => void;
255
256
  onLiveStreamStarted?: () => void;
256
257
  onLiveStreamStopped?: () => void;
257
258
  onVideoStateChanged?: () => void;
@@ -675,7 +676,8 @@ export function useStream(
675
676
  /**
676
677
  * @param onParticipantJoined - This event callback is trigger when a new participant joins the meeting.
677
678
  * ---
678
- * @param onParticipantLeft - This event callback is trigger when a participant leaves the meeting.
679
+ * @param onParticipantLeft - This event callback is triggered when a participant leaves the meeting.
680
+ * - It provides the participant object and an additional reason object describing why the participant left.
679
681
  * ---
680
682
  * @param onSpeakerChanged -
681
683
  * - This event will be emitted when a active speaker changed.
@@ -786,7 +788,7 @@ export function useMeeting({
786
788
  onQualityLimitation,
787
789
  }?: {
788
790
  onParticipantJoined?: (participant: Participant) => void;
789
- onParticipantLeft?: (participant: Participant) => void;
791
+ onParticipantLeft?: (participant: Participant, reason: { message: string, code: number }) => void;
790
792
  onSpeakerChanged?: (activeSpeakerId: string | null) => void;
791
793
  onPresenterChanged?: (presenterId: string | null) => void;
792
794
  onMainParticipantChanged?: (participant: Participant) => void;
@@ -819,7 +821,7 @@ export function useMeeting({
819
821
  reliability: string;
820
822
  }) => void;
821
823
  onMeetingJoined?: () => void;
822
- onMeetingLeft?: () => void;
824
+ onMeetingLeft?: (reason: { message: string, code: number }) => void;
823
825
  onLiveStreamStarted?: () => void;
824
826
  onLiveStreamStopped?: () => void;
825
827
  onVideoStateChanged?: () => void;
@@ -1187,6 +1189,49 @@ export function usePubSub(
1187
1189
  }>;
1188
1190
  };
1189
1191
 
1192
+ /**
1193
+ *
1194
+ * @param key - Represents the key for which you want to set the value in the realtime store.
1195
+ * ---
1196
+ * @param onValueChanged - This will get triggered when the value for the given key changes.
1197
+ * ---
1198
+ * @returns This will return `setValue()` and `getValue()` methods.
1199
+ * ---
1200
+ * **useRealtimeStore example**
1201
+ * ```js
1202
+ * var key = 'BLOCKED';
1203
+ *
1204
+ * function onValueChanged({value,updatedBy}) {
1205
+ * console.log('New Message:', message);
1206
+ * }
1207
+ *
1208
+ * const {setValue,getValue} = useRealtimeStore(key, {
1209
+ * onValueChanged,
1210
+ * });
1211
+ * ```
1212
+ */
1213
+ export function useRealtimeStore(
1214
+ key: string,
1215
+ {
1216
+ onValueChanged,
1217
+ }?: {
1218
+ onValueChanged?: ({
1219
+ value,
1220
+ updatedBy,
1221
+ }: {
1222
+ value: string
1223
+ updatedBy: string,
1224
+ }) => void,
1225
+ }
1226
+ ): {
1227
+ setValue: ({
1228
+ value
1229
+ }: {
1230
+ value: string;
1231
+ }) => Promise<any>;
1232
+ getValue: () => Promise<string>;
1233
+ };
1234
+
1190
1235
  export function useFile(): {
1191
1236
  uploadBase64File: ({
1192
1237
  base64Data,
@@ -1976,5 +2021,22 @@ export const Constants: {
1976
2021
  VIDEO: Permission;
1977
2022
  AUDIO_AND_VIDEO: Permission;
1978
2023
  };
2024
+ leaveReason:{
2025
+ WEBSOCKET_DISCONNECTED: number,
2026
+ REMOVE_PEER: number,
2027
+ REMOVE_PEER_VIEWER_MODE_CHANGED: number,
2028
+ REMOVE_PEER_MEDIA_RELAY_STOP: number,
2029
+ SWITCH_ROOM: number,
2030
+ ROOM_CLOSE: number,
2031
+ UNKNOWN: number,
2032
+ REMOVE_ALL: number,
2033
+ MEETING_END_API: number,
2034
+ REMOVE_PEER_API: number,
2035
+ MANUAL_LEAVE_CALLED: number,
2036
+ WEBSOCKET_CONNECTION_ATTEMPTS_EXHAUSTED: number,
2037
+ JOIN_ROOM_FAILED: number,
2038
+ SWITCH_ROOM_FAILED: number,
2039
+ CHARACTER_REMOVED: number,
2040
+ }
1979
2041
  };
1980
2042
  export { CameraDeviceInfo, DeviceInfo, MicrophoneDeviceInfo };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@videosdk.live/react-sdk",
3
- "version": "0.4.9",
3
+ "version": "0.4.11",
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.3.9",
77
+ "@videosdk.live/js-sdk": "0.3.11",
78
78
  "events": "^3.3.0"
79
79
  }
80
80
  }