@videosdk.live/react-sdk 0.1.94 → 0.1.96
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.
- package/dist/index.js +288 -33
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +288 -34
- package/dist/index.modern.js.map +1 -1
- package/dist/types/character.d.ts +96 -0
- package/dist/types/index.d.ts +153 -3
- package/dist/types/meeting.d.ts +11 -2
- package/package.json +2 -2
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { Participant } from './participant';
|
|
2
|
+
import { Stream } from './stream';
|
|
3
|
+
|
|
4
|
+
export enum CharacterMode {
|
|
5
|
+
Text2Text = 'text2text',
|
|
6
|
+
Speech2Text = 'speech2text',
|
|
7
|
+
Speech2Speech = 'speech2speech'
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export enum CharacterState {
|
|
11
|
+
CHARACTER_SPEAKING = 'CHARACTER_SPEAKING',
|
|
12
|
+
CHARACTER_THINKING = 'CHARACTER_THINKING',
|
|
13
|
+
CHARACTER_LISTENING = 'CHARACTER_LISTENING'
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export class Character extends Participant {
|
|
17
|
+
/**
|
|
18
|
+
* @description This represents interactionId of interaction
|
|
19
|
+
*/
|
|
20
|
+
interactionId: string;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @description This represents the id character participant
|
|
24
|
+
*/
|
|
25
|
+
id: string;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @description This represents state of character participant
|
|
29
|
+
*/
|
|
30
|
+
state: CharacterState;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @description This represents attached knowledge to character participant
|
|
34
|
+
*/
|
|
35
|
+
knowledgeBases: string[];
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @description This represents communication mode of character participant
|
|
39
|
+
*/
|
|
40
|
+
characterMode: CharacterMode;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* @description This represents role of character participant
|
|
44
|
+
*/
|
|
45
|
+
characterRole: string;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @description This method can be used to join a character participant in the meeting
|
|
49
|
+
*/
|
|
50
|
+
join(): Promise<void>;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* @description This method can be used to leave a character participant from the meeting
|
|
54
|
+
*/
|
|
55
|
+
leave(): Promise<void>;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* @description This method can be used to send message to a character participant
|
|
59
|
+
*/
|
|
60
|
+
sendMessage(text: string): Promise<void>;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Add event listener
|
|
64
|
+
* @param eventType Event name to which you want to subscribe.
|
|
65
|
+
* @param listener Callback function which will be triggered when the event happens
|
|
66
|
+
*/
|
|
67
|
+
on(
|
|
68
|
+
eventType:
|
|
69
|
+
| 'stream-enabled'
|
|
70
|
+
| 'stream-disabled'
|
|
71
|
+
| 'media-status-changed'
|
|
72
|
+
| 'video-quality-changed'
|
|
73
|
+
| 'character-state-changed'
|
|
74
|
+
| 'character-message'
|
|
75
|
+
| 'character-joined'
|
|
76
|
+
| 'character-left',
|
|
77
|
+
listener: (data: any) => void
|
|
78
|
+
): void;
|
|
79
|
+
/**
|
|
80
|
+
* Remove event
|
|
81
|
+
* @param eventType Event name to which you want to unsubscribe.
|
|
82
|
+
* @param listener Callback function which was passed while subscribing to the event
|
|
83
|
+
*/
|
|
84
|
+
off(
|
|
85
|
+
eventType:
|
|
86
|
+
| 'stream-enabled'
|
|
87
|
+
| 'stream-disabled'
|
|
88
|
+
| 'media-status-changed'
|
|
89
|
+
| 'video-quality-changed'
|
|
90
|
+
| 'character-state-changed'
|
|
91
|
+
| 'character-message'
|
|
92
|
+
| 'character-joined'
|
|
93
|
+
| 'character-left',
|
|
94
|
+
listener: (data: any) => void
|
|
95
|
+
): void;
|
|
96
|
+
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ import { Permission } from './permission';
|
|
|
16
16
|
import { Meeting } from './meeting';
|
|
17
17
|
import { Participant } from './participant';
|
|
18
18
|
import { Stream } from './stream';
|
|
19
|
+
import { Character, CharacterMode, CharacterState } from './character';
|
|
19
20
|
/**
|
|
20
21
|
* @param children - Render child component.
|
|
21
22
|
* ---
|
|
@@ -85,7 +86,7 @@ export function MeetingProvider({
|
|
|
85
86
|
config: {
|
|
86
87
|
meetingId: string;
|
|
87
88
|
autoConsume?: boolean;
|
|
88
|
-
preferredProtocol?:
|
|
89
|
+
preferredProtocol?: 'UDP_ONLY' | 'UDP_OVER_TCP' | 'TCP_ONLY';
|
|
89
90
|
participantId?: string | undefined;
|
|
90
91
|
name: string;
|
|
91
92
|
micEnabled: boolean;
|
|
@@ -640,7 +641,9 @@ export function useMeeting({
|
|
|
640
641
|
onRecordingStateChanged,
|
|
641
642
|
onLivestreamStateChanged,
|
|
642
643
|
onMeetingStateChanged,
|
|
643
|
-
onParticipantModeChanged
|
|
644
|
+
onParticipantModeChanged,
|
|
645
|
+
onCharacterJoined,
|
|
646
|
+
onCharacterLeft
|
|
644
647
|
}?: {
|
|
645
648
|
onParticipantJoined?: (participant: Participant) => void;
|
|
646
649
|
onParticipantLeft?: (participant: Participant) => void;
|
|
@@ -765,12 +768,15 @@ export function useMeeting({
|
|
|
765
768
|
participantId: string;
|
|
766
769
|
mode: 'CONFERENCE' | 'VIEWER';
|
|
767
770
|
}) => void;
|
|
771
|
+
onCharacterJoined?: (character: Character) => void;
|
|
772
|
+
onCharacterLeft?: (character: Character) => void;
|
|
768
773
|
}): {
|
|
769
774
|
meetingId: string;
|
|
770
775
|
meeting: Meeting;
|
|
771
776
|
localParticipant: Participant;
|
|
772
777
|
activeSpeakerId: string;
|
|
773
778
|
participants: Map<string, Participant>;
|
|
779
|
+
characters: Map<string, Character>;
|
|
774
780
|
pinnedParticipants: Map<
|
|
775
781
|
string,
|
|
776
782
|
{
|
|
@@ -1006,7 +1012,7 @@ export function useFile(): {
|
|
|
1006
1012
|
* console.log('Transcription Text Payload:', data);
|
|
1007
1013
|
* }
|
|
1008
1014
|
*
|
|
1009
|
-
* const { startTranscription, stopTranscription } = useTranscription(
|
|
1015
|
+
* const { startTranscription, stopTranscription } = useTranscription({
|
|
1010
1016
|
* onTranscriptionStateChanged,
|
|
1011
1017
|
* onTranscriptionText,
|
|
1012
1018
|
* });
|
|
@@ -1055,6 +1061,148 @@ export function useTranscription({
|
|
|
1055
1061
|
stopTranscription: () => void;
|
|
1056
1062
|
};
|
|
1057
1063
|
|
|
1064
|
+
/**
|
|
1065
|
+
* @param onCharacterStateChanged - This will triggered when a character state is changed.
|
|
1066
|
+
* ---
|
|
1067
|
+
* @param onCharacterMessage - This will triggered when a character response/message is published.
|
|
1068
|
+
* ---
|
|
1069
|
+
* @param onStreamEnabled - It's a callback which gets triggered whenever a character's video, audio or screen share stream is enabled.
|
|
1070
|
+
* ---
|
|
1071
|
+
* @param onStreamEnabled - It's a callback which gets triggered whenever a character's video, audio or screen share stream is disabled.
|
|
1072
|
+
* ---
|
|
1073
|
+
* @param onMediaStatusChanged - It's a callback which gets triggered whenever a character's video or audio is disabled or enabled.
|
|
1074
|
+
* ---
|
|
1075
|
+
* @param onVideoQualityChanged -
|
|
1076
|
+
* - It's a callback which gets triggered whenever a character's video quality changes.
|
|
1077
|
+
* - currentQuality and prevQuality can have values `HIGH` | `MEDIUM` | `LOW`.
|
|
1078
|
+
* ---
|
|
1079
|
+
* @returns This will return `character` Object.
|
|
1080
|
+
* ---
|
|
1081
|
+
* **useCharacter example**
|
|
1082
|
+
* ```js
|
|
1083
|
+
*
|
|
1084
|
+
* function onCharacterStateChanged(data) {
|
|
1085
|
+
* console.log('New State Payload:', data)
|
|
1086
|
+
* }
|
|
1087
|
+
*
|
|
1088
|
+
* function onCharacterMessage(data) {
|
|
1089
|
+
* console.log('character message Payload:', data);
|
|
1090
|
+
* }
|
|
1091
|
+
*
|
|
1092
|
+
* const { join, leave, sendMessage } = useCharacter({
|
|
1093
|
+
* interactionId,
|
|
1094
|
+
* // OR
|
|
1095
|
+
* id,
|
|
1096
|
+
* displayName,
|
|
1097
|
+
* characterRole,
|
|
1098
|
+
* characterMode,
|
|
1099
|
+
* knowledgeBases,
|
|
1100
|
+
* },
|
|
1101
|
+
* {
|
|
1102
|
+
* onCharacterStateChanged,
|
|
1103
|
+
* onCharacterMessage,
|
|
1104
|
+
* onCharacterJoined,
|
|
1105
|
+
* onCharacterLeft,
|
|
1106
|
+
*
|
|
1107
|
+
* onStreamEnabled,
|
|
1108
|
+
* onStreamDisabled,
|
|
1109
|
+
* onMediaStatusChanged,
|
|
1110
|
+
* onVideoQualityChanged
|
|
1111
|
+
* });
|
|
1112
|
+
*
|
|
1113
|
+
* async function joinCharacter()=>{
|
|
1114
|
+
* await join()
|
|
1115
|
+
* }
|
|
1116
|
+
*
|
|
1117
|
+
* async function removeCharacter()=>{
|
|
1118
|
+
* await leave()
|
|
1119
|
+
* }
|
|
1120
|
+
* ```
|
|
1121
|
+
*/
|
|
1122
|
+
export function useCharacter(
|
|
1123
|
+
{
|
|
1124
|
+
interactionId,
|
|
1125
|
+
// OR
|
|
1126
|
+
id,
|
|
1127
|
+
displayName,
|
|
1128
|
+
characterRole,
|
|
1129
|
+
characterMode,
|
|
1130
|
+
knowledgeBases
|
|
1131
|
+
}: {
|
|
1132
|
+
interactionId: string;
|
|
1133
|
+
// OR
|
|
1134
|
+
id: string;
|
|
1135
|
+
displayName: string;
|
|
1136
|
+
characterRole: string;
|
|
1137
|
+
characterMode: 'text2text' | 'speech2text' | 'speech2speech';
|
|
1138
|
+
knowledgeBases: string[];
|
|
1139
|
+
},
|
|
1140
|
+
{
|
|
1141
|
+
onCharacterStateChanged,
|
|
1142
|
+
onCharacterMessage,
|
|
1143
|
+
|
|
1144
|
+
onStreamEnabled,
|
|
1145
|
+
onStreamDisabled,
|
|
1146
|
+
onMediaStatusChanged,
|
|
1147
|
+
onVideoQualityChanged
|
|
1148
|
+
}: {
|
|
1149
|
+
onCharacterStateChanged?: (data: {
|
|
1150
|
+
id: string;
|
|
1151
|
+
status: CharacterState;
|
|
1152
|
+
}) => void;
|
|
1153
|
+
onCharacterMessage?: (data: {
|
|
1154
|
+
participantId: string;
|
|
1155
|
+
participantName: string;
|
|
1156
|
+
text: string;
|
|
1157
|
+
timestamp: number;
|
|
1158
|
+
}) => void;
|
|
1159
|
+
onCharacterJoined?: () => void;
|
|
1160
|
+
onCharacterLeft?: () => void;
|
|
1161
|
+
|
|
1162
|
+
onStreamDisabled?: (stream: Stream) => void;
|
|
1163
|
+
onStreamEnabled?: (stream: Stream) => void;
|
|
1164
|
+
onMediaStatusChanged?: ({
|
|
1165
|
+
kind,
|
|
1166
|
+
peerId,
|
|
1167
|
+
newStatus
|
|
1168
|
+
}: {
|
|
1169
|
+
kind: 'audio' | 'video';
|
|
1170
|
+
peerId: string;
|
|
1171
|
+
newStatus: boolean;
|
|
1172
|
+
}) => void;
|
|
1173
|
+
onVideoQualityChanged?: ({
|
|
1174
|
+
peerId,
|
|
1175
|
+
prevQuality,
|
|
1176
|
+
currentQuality
|
|
1177
|
+
}: {
|
|
1178
|
+
peerId: string;
|
|
1179
|
+
prevQuality: 'low' | 'med' | 'high';
|
|
1180
|
+
currentQuality: 'low' | 'med' | 'high';
|
|
1181
|
+
}) => void;
|
|
1182
|
+
}
|
|
1183
|
+
): {
|
|
1184
|
+
displayName: string;
|
|
1185
|
+
webcamStream: Stream;
|
|
1186
|
+
micStream: Stream;
|
|
1187
|
+
webcamOn: boolean;
|
|
1188
|
+
micOn: boolean;
|
|
1189
|
+
isActiveSpeaker: boolean;
|
|
1190
|
+
|
|
1191
|
+
interactionId?: string;
|
|
1192
|
+
id?: string;
|
|
1193
|
+
characterMode?: CharacterMode;
|
|
1194
|
+
characterState?: CharacterState;
|
|
1195
|
+
knowledgeBases?: string[];
|
|
1196
|
+
|
|
1197
|
+
enableMic: () => void;
|
|
1198
|
+
disableMic: () => void;
|
|
1199
|
+
enableWebcam: () => void;
|
|
1200
|
+
disableWebcam: () => void;
|
|
1201
|
+
join: () => Promise<void>;
|
|
1202
|
+
leave: () => Promise<void>;
|
|
1203
|
+
sendMessage: (text: string) => Promise<void>;
|
|
1204
|
+
};
|
|
1205
|
+
|
|
1058
1206
|
/**
|
|
1059
1207
|
* @param microphoneId - It will be the id of the mic from which the audio should be captured.
|
|
1060
1208
|
* ---
|
|
@@ -1318,6 +1466,8 @@ export const Constants: {
|
|
|
1318
1466
|
TRANSCRIPTION_STOPPING: string;
|
|
1319
1467
|
TRANSCRIPTION_STOPPED: string;
|
|
1320
1468
|
};
|
|
1469
|
+
characterState: CharacterState;
|
|
1470
|
+
characterMode: CharacterMode;
|
|
1321
1471
|
modes: {
|
|
1322
1472
|
CONFERENCE: string;
|
|
1323
1473
|
VIEWER: string;
|
package/dist/types/meeting.d.ts
CHANGED
|
@@ -463,7 +463,11 @@ export class Meeting {
|
|
|
463
463
|
| 'meeting-state-changed'
|
|
464
464
|
| 'switch-meeting'
|
|
465
465
|
| 'error'
|
|
466
|
-
| 'chat-message'
|
|
466
|
+
| 'chat-message'
|
|
467
|
+
| 'transcription-text'
|
|
468
|
+
| 'transcription-state-changed'
|
|
469
|
+
| 'character-joined'
|
|
470
|
+
| 'character-left',
|
|
467
471
|
listener: (data: any) => void
|
|
468
472
|
): void;
|
|
469
473
|
/**
|
|
@@ -506,7 +510,12 @@ export class Meeting {
|
|
|
506
510
|
| 'meeting-state-changed'
|
|
507
511
|
| 'switch-meeting'
|
|
508
512
|
| 'error'
|
|
509
|
-
| 'chat-message'
|
|
513
|
+
| 'chat-message'
|
|
514
|
+
| 'transcription-text'
|
|
515
|
+
| 'transcription-state-changed'
|
|
516
|
+
| 'character-joined'
|
|
517
|
+
| 'character-left',
|
|
518
|
+
|
|
510
519
|
listener: (data: any) => void
|
|
511
520
|
): void;
|
|
512
521
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@videosdk.live/react-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.96",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.modern.js",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
}
|
|
74
74
|
},
|
|
75
75
|
"dependencies": {
|
|
76
|
-
"@videosdk.live/js-sdk": "0.0.
|
|
76
|
+
"@videosdk.live/js-sdk": "0.0.92",
|
|
77
77
|
"events": "^3.3.0"
|
|
78
78
|
}
|
|
79
79
|
}
|