@videosdk.live/react-sdk 0.4.6 → 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.
@@ -102,6 +102,8 @@ export function MeetingProvider({
102
102
  metaData?: object;
103
103
  defaultCamera?: 'front' | 'back';
104
104
  debugMode: boolean;
105
+ translationLanguage?: string;
106
+ speakingLanguage?: string;
105
107
  };
106
108
  token: string;
107
109
  joinWithoutUserInteraction?: boolean;
@@ -914,6 +916,7 @@ export function useMeeting({
914
916
  livestreamUrl: string;
915
917
  };
916
918
  transcriptionState: string;
919
+ translationState: string;
917
920
  selectedCameraDevice?: {
918
921
  deviceId: string;
919
922
  groupId: string;
@@ -1235,6 +1238,76 @@ export function useTranscription({
1235
1238
  stopTranscription: () => void;
1236
1239
  };
1237
1240
 
1241
+ /**
1242
+ * @param onTranslationStateChanged - This will triggered when a realtime translation state is changed.
1243
+ * ---
1244
+ * @param onTranslationLanguageChanged - This will triggered when a realtime translation language is changed.
1245
+ * ---
1246
+ * @param onTranslationText - This will triggered when a realtime translation text is published.
1247
+ * ---
1248
+ * @returns This will return `startTranslation()`, `changeTranslationLanguage()` and `stopTranslation()` method. You can refer this [API Reference](https://docs.videosdk.live/react/api/sdk-reference/use-translation#returns)
1249
+ * ---
1250
+ * **useTranslation example**
1251
+ * ```js
1252
+ *
1253
+ * function onTranslationStateChanged(data) {
1254
+ * console.log('New State Payload:', data)
1255
+ * }
1256
+ *
1257
+ * function onTranslationLanguageChanged(data) {
1258
+ * console.log('New Language Payload:', data)
1259
+ * }
1260
+ *
1261
+ * function onTranslationText(data) {
1262
+ * console.log('Translation Text Payload:', data);
1263
+ * }
1264
+ *
1265
+ * const { startTranslation, changeTranslationLanguage, stopTranslation } = useTranslation({
1266
+ * onTranslationStateChanged,
1267
+ * onTranslationLanguageChanged
1268
+ * onTranslationText,
1269
+ * });
1270
+ *
1271
+ * async function startTranslation()=>{
1272
+ * await startTranslation()
1273
+ * }
1274
+ *
1275
+ * async function changeTranslationLanguage()=>{
1276
+ * await changeTranslationLanguage(languageCode)
1277
+ * }
1278
+ *
1279
+ * async function stopTranslation()=>{
1280
+ * await stopTranslation()
1281
+ * }
1282
+ * ```
1283
+ */
1284
+ export function useTranslation({
1285
+ onTranslationStateChanged,
1286
+ onTranslationLanguageChanged,
1287
+ onTranslationText
1288
+ }?: {
1289
+ onTranslationStateChanged?: (data: { id: string; status: string }) => void;
1290
+ onTranslationLanguageChanged?: (data: {
1291
+ participantId: string,
1292
+ language: string,
1293
+ }) => void;
1294
+ onTranslationText?: (data: {
1295
+ participantId: string;
1296
+ participantName: string;
1297
+ text: string;
1298
+ timestamp: number;
1299
+ language: string;
1300
+ type: string;
1301
+ }) => void;
1302
+ }): {
1303
+ /**
1304
+ * @description This method is used to start the meeting translation
1305
+ */
1306
+ startTranslation: () => Promise<void>;
1307
+ changeTranslationLanguage: (languageCode: string) => Promise<void>;
1308
+ stopTranslation: () => Promise<void>;
1309
+ };
1310
+
1238
1311
  /**
1239
1312
  * @param onCharacterStateChanged - This will triggered when a character state is changed.
1240
1313
  * ---
@@ -1746,10 +1819,14 @@ export const Constants: {
1746
1819
  STOP_HLS_FAILED: number;
1747
1820
  START_TRANSCRIPTION_FAILED: number;
1748
1821
  STOP_TRANSCRIPTION_FAILED: number;
1822
+ START_TRANSLATION_FAILED: number;
1823
+ STOP_TRANSLATION_FAILED: number;
1824
+ CHANGE_TRANSLATION_LANGUAGE_FAILED: number;
1749
1825
  RECORDING_FAILED: number;
1750
1826
  LIVESTREAM_FAILED: number;
1751
1827
  HLS_FAILED: number;
1752
1828
  TRANSCRIPTION_FAILED: number;
1829
+ TRANSLATION_FAILED: number;
1753
1830
  ERROR_GET_VIDEO_MEDIA: number;
1754
1831
  ERROR_GET_AUDIO_MEDIA: number;
1755
1832
  ERROR_GET_DISPLAY_MEDIA: number;
@@ -1801,6 +1878,12 @@ export const Constants: {
1801
1878
  TRANSCRIPTION_STOPPING: string;
1802
1879
  TRANSCRIPTION_STOPPED: string;
1803
1880
  };
1881
+ translationEvents: {
1882
+ TRANSLATION_STARTING: string;
1883
+ TRANSLATION_STARTED: string;
1884
+ TRANSLATION_STOPPING: string;
1885
+ TRANSLATION_STOPPED: string;
1886
+ };
1804
1887
  characterState: CharacterState;
1805
1888
  characterMode: CharacterMode;
1806
1889
  modes: {
@@ -70,6 +70,15 @@ export class Meeting {
70
70
  | 'TRANSCRIPTION_STARTING'
71
71
  | 'TRANSCRIPTION_STARTED'
72
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';
73
82
 
74
83
  /**
75
84
  * @description These object will contain all the messages send using the `send` method
@@ -532,6 +541,9 @@ export class Meeting {
532
541
  | 'data'
533
542
  | 'transcription-text'
534
543
  | 'transcription-state-changed'
544
+ | 'translation-text'
545
+ | 'translation-state-changed'
546
+ | 'translation-language-changed'
535
547
  | 'character-joined'
536
548
  | 'character-left'
537
549
  | "paused-all-streams"
@@ -586,6 +598,9 @@ export class Meeting {
586
598
  | 'data'
587
599
  | 'transcription-text'
588
600
  | 'transcription-state-changed'
601
+ | 'translation-text'
602
+ | 'translation-state-changed'
603
+ | 'translation-language-changed'
589
604
  | 'character-joined'
590
605
  | 'character-left'
591
606
  | "paused-all-streams"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@videosdk.live/react-sdk",
3
- "version": "0.4.6",
3
+ "version": "0.4.7",
4
4
  "license": "ISC",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.modern.js",
@@ -74,7 +74,8 @@
74
74
  }
75
75
  },
76
76
  "dependencies": {
77
- "@videosdk.live/js-sdk": "0.3.8",
77
+ "@videosdk.live/js-sdk": "0.3.9",
78
78
  "events": "^3.3.0"
79
- }
80
- }
79
+ },
80
+ "packageManager": "yarn@1.22.22+sha1.ac34549e6aa8e7ead463a7407e1c7390f61a6610"
81
+ }