@tavus/cvi-ui 0.0.1-beta.2 → 0.0.1-beta.4
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/README.md +42 -75
- package/dev-components/components/README.md +145 -59
- package/dev-components/components/audio-wave/audio-wave.module.css +33 -0
- package/dev-components/components/audio-wave/index.tsx +55 -0
- package/dev-components/components/conversation-01/conversation.module.css +228 -0
- package/dev-components/components/conversation-01/index.tsx +173 -0
- package/dev-components/components/device-select/device-select.module.css +115 -0
- package/dev-components/components/{controls → device-select}/index.tsx +7 -7
- package/dev-components/components/{hair-check → hair-check-01}/hair-check.module.css +3 -2
- package/dev-components/components/{hair-check → hair-check-01}/index.tsx +4 -4
- package/dev-components/components/media-controls/index.tsx +207 -0
- package/dev-components/components/media-controls/media-controls.module.css +49 -0
- package/dev-components/hooks/cvi-events-hooks.tsx +6 -6
- package/dev-components/hooks/{use-cvi-call.ts → use-cvi-call.tsx} +7 -0
- package/dist/index.js +457 -110
- package/dist/types/templates/components.d.ts +37 -4
- package/dist/types/templates/jsx/index.d.ts +13 -2
- package/dist/types/templates/tsx/index.d.ts +13 -2
- package/dist/types/utils/version-utils.d.ts +3 -0
- package/package.json +9 -5
- package/prepare-scripts/create-templates.js +1 -1
- package/src/templates/components.ts +19 -0
- package/src/templates/index.ts +2 -0
- package/src/templates/jsx/components/audio-wave.json +5 -0
- package/src/templates/jsx/components/conversation-01.json +13 -0
- package/src/templates/jsx/components/cvi-provider.json +5 -0
- package/src/templates/jsx/components/device-select.json +10 -0
- package/src/templates/jsx/components/hair-check-01.json +11 -0
- package/src/templates/jsx/components/media-controls.json +10 -0
- package/src/templates/jsx/hooks/cvi-events-hooks.json +5 -0
- package/src/templates/jsx/hooks/use-cvi-call.json +5 -0
- package/src/templates/jsx/hooks/use-local-camera.json +5 -0
- package/src/templates/jsx/hooks/use-local-microphone.json +5 -0
- package/src/templates/jsx/hooks/use-local-screenshare.json +5 -0
- package/src/templates/jsx/hooks/use-remote-participant-ids.json +5 -0
- package/src/templates/jsx/hooks/use-replica-ids.json +5 -0
- package/src/templates/jsx/hooks/use-request-permissions.json +5 -0
- package/src/templates/jsx/hooks/use-start-haircheck.json +5 -0
- package/src/templates/jsx/index.ts +15 -0
- package/src/templates/tsx/components/audio-wave.json +5 -0
- package/src/templates/tsx/components/conversation-01.json +13 -0
- package/src/templates/tsx/components/cvi-provider.json +5 -0
- package/src/templates/tsx/components/device-select.json +10 -0
- package/src/templates/tsx/components/hair-check-01.json +11 -0
- package/src/templates/tsx/components/media-controls.json +10 -0
- package/src/templates/tsx/hooks/cvi-events-hooks.json +5 -0
- package/src/templates/tsx/hooks/use-cvi-call.json +5 -0
- package/src/templates/tsx/hooks/use-local-camera.json +5 -0
- package/src/templates/tsx/hooks/use-local-microphone.json +5 -0
- package/src/templates/tsx/hooks/use-local-screenshare.json +5 -0
- package/src/templates/tsx/hooks/use-remote-participant-ids.json +5 -0
- package/src/templates/tsx/hooks/use-replica-ids.json +5 -0
- package/src/templates/tsx/hooks/use-request-permissions.json +8 -0
- package/src/templates/tsx/hooks/use-start-haircheck.json +5 -0
- package/src/templates/tsx/index.ts +15 -0
- package/src/utils/resolve-components-tree.ts +59 -2
- package/src/utils/update-files.ts +38 -10
- package/src/utils/version-utils.ts +26 -0
- package/dev-components/components/controls/controls.module.css +0 -113
- package/dist/templates/components/controls.tsx +0 -279
- package/dist/templates/components/cvi-provider.tsx +0 -9
- package/dist/templates/controls.tsx +0 -279
- package/dist/templates/cvi-hooks.tsx +0 -38
- package/dist/templates/cvi-provider.tsx +0 -9
- package/dist/templates/hooks/cvi-hooks.tsx +0 -38
- package/dist/templates/tsx/components/controls.tsx +0 -279
- package/dist/templates/tsx/components/cvi-provider.tsx +0 -9
- package/dist/types/constants/components.d.ts +0 -59
- package/dist/types/utils/resolve-import.d.ts +0 -2
- package/dist/typescript-XxXP1Woc.js +0 -14
- /package/dev-components/hooks/{use-local-camera.ts → use-local-camera.tsx} +0 -0
- /package/dev-components/hooks/{use-local-microphone.ts → use-local-microphone.tsx} +0 -0
- /package/dev-components/hooks/{use-local-screenshare.ts → use-local-screenshare.tsx} +0 -0
- /package/dev-components/hooks/{use-remote-participant-ids.ts → use-remote-participant-ids.tsx} +0 -0
- /package/dev-components/hooks/{use-replica-ids.ts → use-replica-ids.tsx} +0 -0
- /package/dev-components/hooks/{use-request-permissions.ts → use-request-permissions.tsx} +0 -0
- /package/dev-components/hooks/{use-start-haircheck.ts → use-start-haircheck.tsx} +0 -0
|
@@ -1,279 +0,0 @@
|
|
|
1
|
-
import React, { memo, useMemo } from "react";
|
|
2
|
-
import {
|
|
3
|
-
useAudioTrack,
|
|
4
|
-
useDaily,
|
|
5
|
-
useDevices,
|
|
6
|
-
useLocalSessionId,
|
|
7
|
-
useVideoTrack,
|
|
8
|
-
} from "@daily-co/daily-react";
|
|
9
|
-
|
|
10
|
-
export const SelectDevice = ({
|
|
11
|
-
value,
|
|
12
|
-
devices,
|
|
13
|
-
disabled,
|
|
14
|
-
onChange,
|
|
15
|
-
}: {
|
|
16
|
-
value: string | undefined;
|
|
17
|
-
devices: { device: MediaDeviceInfo }[];
|
|
18
|
-
disabled: boolean;
|
|
19
|
-
onChange: (value: string) => void;
|
|
20
|
-
}) => {
|
|
21
|
-
return (
|
|
22
|
-
<select
|
|
23
|
-
value={value}
|
|
24
|
-
onChange={(e) => onChange(e.target.value)}
|
|
25
|
-
disabled={disabled}
|
|
26
|
-
style={{
|
|
27
|
-
height: "3rem",
|
|
28
|
-
width: "5.5rem",
|
|
29
|
-
borderRadius: "9999px",
|
|
30
|
-
backgroundColor: "rgba(255, 255, 255, 0.2)",
|
|
31
|
-
padding: "0 0.75rem",
|
|
32
|
-
border: "1px solid rgba(255, 255, 255, 0.2)",
|
|
33
|
-
backdropFilter: "blur(10px)",
|
|
34
|
-
}}
|
|
35
|
-
>
|
|
36
|
-
{devices.map(({ device }) => (
|
|
37
|
-
<option key={device.deviceId} value={device.deviceId}>
|
|
38
|
-
{device.label}
|
|
39
|
-
</option>
|
|
40
|
-
))}
|
|
41
|
-
</select>
|
|
42
|
-
);
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export const MicrophoneButton = memo(() => {
|
|
46
|
-
const daily = useDaily();
|
|
47
|
-
const localSessionId = useLocalSessionId();
|
|
48
|
-
const localAudio = useAudioTrack(localSessionId);
|
|
49
|
-
const { micState, microphones, currentMic, setMicrophone } = useDevices();
|
|
50
|
-
const isMicReady = useMemo(() => micState === "granted", [micState]);
|
|
51
|
-
const mutedAudio = localAudio.isOff;
|
|
52
|
-
|
|
53
|
-
const handleClick = () => {
|
|
54
|
-
daily?.setLocalAudio(mutedAudio);
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
return (
|
|
58
|
-
<div style={{
|
|
59
|
-
position: "relative",
|
|
60
|
-
display: "flex",
|
|
61
|
-
alignItems: "center",
|
|
62
|
-
justifyContent: "center",
|
|
63
|
-
borderRadius: "9999px",
|
|
64
|
-
backdropFilter: "blur(4px)"
|
|
65
|
-
}}>
|
|
66
|
-
<button
|
|
67
|
-
type="button"
|
|
68
|
-
onClick={handleClick}
|
|
69
|
-
disabled={!isMicReady}
|
|
70
|
-
style={{
|
|
71
|
-
position: "absolute",
|
|
72
|
-
left: 0,
|
|
73
|
-
top: 0,
|
|
74
|
-
zIndex: 10,
|
|
75
|
-
height: "3rem",
|
|
76
|
-
width: "3rem",
|
|
77
|
-
borderRadius: "9999px",
|
|
78
|
-
backgroundColor: "white",
|
|
79
|
-
display: "flex",
|
|
80
|
-
alignItems: "center",
|
|
81
|
-
justifyContent: "center",
|
|
82
|
-
opacity: !isMicReady ? "0.5" : "1"
|
|
83
|
-
}}
|
|
84
|
-
>
|
|
85
|
-
<span>
|
|
86
|
-
{mutedAudio || !isMicReady ? (
|
|
87
|
-
<svg
|
|
88
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
89
|
-
width="24"
|
|
90
|
-
height="24"
|
|
91
|
-
viewBox="0 0 24 24"
|
|
92
|
-
fill="none"
|
|
93
|
-
role="img"
|
|
94
|
-
aria-label="Microphone Muted"
|
|
95
|
-
>
|
|
96
|
-
<path
|
|
97
|
-
d="M12 18C10.1435 18 8.36301 17.2625 7.05025 15.9497C5.7375 14.637 5 12.8565 5 11V10M12 18C13.8565 18 15.637 17.2625 16.9497 15.9497C18.2625 14.637 18.1339 14.0992 18.1339 14.0992M12 18V21"
|
|
98
|
-
stroke="#020617"
|
|
99
|
-
strokeWidth="1.66667"
|
|
100
|
-
strokeLinecap="round"
|
|
101
|
-
strokeLinejoin="round"
|
|
102
|
-
/>
|
|
103
|
-
<rect
|
|
104
|
-
x="1.30225"
|
|
105
|
-
y="3"
|
|
106
|
-
width="26"
|
|
107
|
-
height="2.24738"
|
|
108
|
-
rx="1.12369"
|
|
109
|
-
transform="rotate(30 1.30225 3)"
|
|
110
|
-
fill="#020617"
|
|
111
|
-
/>
|
|
112
|
-
<path
|
|
113
|
-
fillRule="evenodd"
|
|
114
|
-
clipRule="evenodd"
|
|
115
|
-
d="M9 9.39031V11C9 11.7956 9.31607 12.5587 9.87868 13.1213C10.4413 13.6839 11.2044 14 12 14C12.7956 14 13.5587 13.6839 14.1213 13.1213C14.2829 12.9597 14.4242 12.7816 14.5435 12.5908L9 9.39031ZM15 7.71466V6C15 5.20435 14.6839 4.44129 14.1213 3.87868C13.5587 3.31607 12.7956 3 12 3C11.2044 3 10.4413 3.31607 9.87868 3.87868C9.69528 4.06208 9.53807 4.26678 9.40948 4.48697L15 7.71466Z"
|
|
116
|
-
fill="#020617"
|
|
117
|
-
/>
|
|
118
|
-
<path
|
|
119
|
-
d="M9 9.39031L9.41667 8.66862C9.15883 8.51976 8.84117 8.51976 8.58333 8.66862C8.3255 8.81748 8.16667 9.09259 8.16667 9.39031H9ZM9.87868 13.1213L9.28942 13.7106H9.28942L9.87868 13.1213ZM14.1213 13.1213L14.7106 13.7106L14.7106 13.7106L14.1213 13.1213ZM14.5435 12.5908L15.25 13.0327C15.3699 12.841 15.4068 12.6088 15.3521 12.3894C15.2974 12.17 15.156 11.9822 14.9601 11.8692L14.5435 12.5908ZM15 7.71466L14.5833 8.43635C14.8412 8.58521 15.1588 8.58521 15.4167 8.43635C15.6745 8.28749 15.8333 8.01238 15.8333 7.71466H15ZM14.1213 3.87868L14.7106 3.28942L14.7106 3.28942L14.1213 3.87868ZM9.87868 3.87868L9.28942 3.28942L9.28942 3.28942L9.87868 3.87868ZM9.40948 4.48697L8.68988 4.06671C8.57806 4.25818 8.54715 4.48633 8.604 4.70065C8.66086 4.91497 8.80078 5.09779 8.99281 5.20866L9.40948 4.48697ZM9.83333 11V9.39031H8.16667V11H9.83333ZM10.4679 12.5321C10.0616 12.1257 9.83333 11.5746 9.83333 11H8.16667C8.16667 12.0167 8.57053 12.9917 9.28942 13.7106L10.4679 12.5321ZM12 13.1667C11.4254 13.1667 10.8743 12.9384 10.4679 12.5321L9.28942 13.7106C10.0083 14.4295 10.9833 14.8333 12 14.8333V13.1667ZM13.5321 12.5321C13.1257 12.9384 12.5746 13.1667 12 13.1667V14.8333C13.0167 14.8333 13.9917 14.4295 14.7106 13.7106L13.5321 12.5321ZM13.837 12.149C13.7508 12.2867 13.6488 12.4153 13.5321 12.5321L14.7106 13.7106C14.917 13.5041 15.0976 13.2764 15.25 13.0327L13.837 12.149ZM14.9601 11.8692L9.41667 8.66862L8.58333 10.112L14.1268 13.3125L14.9601 11.8692ZM14.1667 6V7.71466H15.8333V6H14.1667ZM13.5321 4.46794C13.9384 4.87426 14.1667 5.42536 14.1667 6H15.8333C15.8333 4.98334 15.4295 4.00831 14.7106 3.28942L13.5321 4.46794ZM12 3.83333C12.5746 3.83333 13.1257 4.06161 13.5321 4.46794L14.7106 3.28942C13.9917 2.57053 13.0167 2.16667 12 2.16667V3.83333ZM10.4679 4.46794C10.8743 4.06161 11.4254 3.83333 12 3.83333V2.16667C10.9833 2.16667 10.0083 2.57053 9.28942 3.28942L10.4679 4.46794ZM10.1291 4.90724C10.2219 4.74824 10.3354 4.60042 10.4679 4.46794L9.28942 3.28942C9.05511 3.52374 8.85421 3.78533 8.68988 4.06671L10.1291 4.90724ZM8.99281 5.20866L14.5833 8.43635L15.4167 6.99298L9.82615 3.76529L8.99281 5.20866Z"
|
|
120
|
-
fill="#020617"
|
|
121
|
-
/>
|
|
122
|
-
</svg>
|
|
123
|
-
) : (
|
|
124
|
-
<svg
|
|
125
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
126
|
-
width="24"
|
|
127
|
-
height="24"
|
|
128
|
-
viewBox="0 0 24 24"
|
|
129
|
-
fill="none"
|
|
130
|
-
role="img"
|
|
131
|
-
aria-label="Microphone"
|
|
132
|
-
>
|
|
133
|
-
<path
|
|
134
|
-
d="M9 6C9 5.20435 9.31607 4.44129 9.87868 3.87868C10.4413 3.31607 11.2044 3 12 3C12.7956 3 13.5587 3.31607 14.1213 3.87868C14.6839 4.44129 15 5.20435 15 6V11C15 11.7956 14.6839 12.5587 14.1213 13.1213C13.5587 13.6839 12.7956 14 12 14C11.2044 14 10.4413 13.6839 9.87868 13.1213C9.31607 12.5587 9 11.7956 9 11V6Z"
|
|
135
|
-
fill="#020617"
|
|
136
|
-
stroke="#020617"
|
|
137
|
-
strokeWidth="2"
|
|
138
|
-
strokeLinecap="round"
|
|
139
|
-
strokeLinejoin="round"
|
|
140
|
-
/>
|
|
141
|
-
<path
|
|
142
|
-
d="M12 18C10.1435 18 8.36301 17.2625 7.05025 15.9497C5.7375 14.637 5 12.8565 5 11V10M12 18C13.8565 18 15.637 17.2625 16.9497 15.9497C18.2625 14.637 19 12.8565 19 11V10M12 18V21"
|
|
143
|
-
stroke="#020617"
|
|
144
|
-
strokeWidth="2"
|
|
145
|
-
strokeLinecap="round"
|
|
146
|
-
strokeLinejoin="round"
|
|
147
|
-
/>
|
|
148
|
-
</svg>
|
|
149
|
-
)}
|
|
150
|
-
</span>
|
|
151
|
-
<span style={{ position: "absolute", width: "1px", height: "1px", padding: "0", margin: "-1px", overflow: "hidden", clip: "rect(0, 0, 0, 0)", whiteSpace: "nowrap", borderWidth: "0" }}>Microphone</span>
|
|
152
|
-
</button>
|
|
153
|
-
<SelectDevice
|
|
154
|
-
value={currentMic?.device?.deviceId}
|
|
155
|
-
devices={microphones || []}
|
|
156
|
-
disabled={!isMicReady}
|
|
157
|
-
onChange={(val) => setMicrophone(val)}
|
|
158
|
-
/>
|
|
159
|
-
</div>
|
|
160
|
-
);
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
MicrophoneButton.displayName = "MicrophoneButton";
|
|
164
|
-
|
|
165
|
-
export const CameraButton = memo(() => {
|
|
166
|
-
const daily = useDaily();
|
|
167
|
-
const localSessionId = useLocalSessionId();
|
|
168
|
-
const localVideo = useVideoTrack(localSessionId);
|
|
169
|
-
const { currentCam, camState, cameras, setCamera } = useDevices();
|
|
170
|
-
const isCamReady = camState === "granted";
|
|
171
|
-
const mutedVideo = localVideo.isOff;
|
|
172
|
-
|
|
173
|
-
const handleClick = () => {
|
|
174
|
-
daily?.setLocalVideo(mutedVideo);
|
|
175
|
-
};
|
|
176
|
-
|
|
177
|
-
return (
|
|
178
|
-
<div style={{
|
|
179
|
-
position: "relative",
|
|
180
|
-
display: "flex",
|
|
181
|
-
alignItems: "center",
|
|
182
|
-
justifyContent: "center",
|
|
183
|
-
borderRadius: "9999px",
|
|
184
|
-
backdropFilter: "blur(4px)"
|
|
185
|
-
}}>
|
|
186
|
-
<button
|
|
187
|
-
type="button"
|
|
188
|
-
onClick={handleClick}
|
|
189
|
-
disabled={!isCamReady || !currentCam}
|
|
190
|
-
style={{
|
|
191
|
-
position: "absolute",
|
|
192
|
-
left: 0,
|
|
193
|
-
top: 0,
|
|
194
|
-
zIndex: 10,
|
|
195
|
-
height: "3rem",
|
|
196
|
-
width: "3rem",
|
|
197
|
-
borderRadius: "9999px",
|
|
198
|
-
backgroundColor: "white",
|
|
199
|
-
display: "flex",
|
|
200
|
-
alignItems: "center",
|
|
201
|
-
justifyContent: "center",
|
|
202
|
-
opacity: (!isCamReady || !currentCam) ? "0.5" : "1"
|
|
203
|
-
}}
|
|
204
|
-
>
|
|
205
|
-
<span>
|
|
206
|
-
{mutedVideo ? (
|
|
207
|
-
<svg
|
|
208
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
209
|
-
width="24"
|
|
210
|
-
height="24"
|
|
211
|
-
viewBox="0 0 24 24"
|
|
212
|
-
fill="none"
|
|
213
|
-
role="img"
|
|
214
|
-
aria-label="Camera Muted"
|
|
215
|
-
>
|
|
216
|
-
<g clipPath="url(#clip0_7082_14220)">
|
|
217
|
-
<path
|
|
218
|
-
fillRule="evenodd"
|
|
219
|
-
clipRule="evenodd"
|
|
220
|
-
d="M3.19874 5.60093C3.08628 5.68537 2.97928 5.77808 2.87868 5.87868C2.31607 6.44129 2 7.20435 2 8V16C2 16.7956 2.31607 17.5587 2.87868 18.1213C3.44129 18.6839 4.20435 19 5 19H15C15.7956 19 16.5587 18.6839 17.1213 18.1213C17.6839 17.5587 18 16.7956 18 16V15.048C17.7787 14.8204 17.5304 14.6189 17.2595 14.4485L3.19874 5.60093ZM22 12.655V8C22 7.80225 21.9413 7.60895 21.8314 7.44454C21.7215 7.28013 21.5654 7.15199 21.3827 7.07632C21.2 7.00065 20.9989 6.98085 20.805 7.01942C20.611 7.05798 20.4329 7.15319 20.293 7.293L18 9.586V8C18 7.20435 17.6839 6.44129 17.1213 5.87868C16.5587 5.31607 15.7956 5 15 5H8.7412L22 12.655Z"
|
|
221
|
-
fill="#020617"
|
|
222
|
-
/>
|
|
223
|
-
<rect
|
|
224
|
-
x="0.777222"
|
|
225
|
-
y="2.64844"
|
|
226
|
-
width="26.7988"
|
|
227
|
-
height="2.24738"
|
|
228
|
-
rx="1.12369"
|
|
229
|
-
transform="rotate(30 0.777222 2.64844)"
|
|
230
|
-
fill="#020617"
|
|
231
|
-
/>
|
|
232
|
-
</g>
|
|
233
|
-
<defs>
|
|
234
|
-
<clipPath id="clip0_7082_14220">
|
|
235
|
-
<rect width="24" height="24" fill="white" />
|
|
236
|
-
</clipPath>
|
|
237
|
-
</defs>
|
|
238
|
-
</svg>
|
|
239
|
-
) : (
|
|
240
|
-
<svg
|
|
241
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
242
|
-
width="24"
|
|
243
|
-
height="24"
|
|
244
|
-
viewBox="0 0 24 24"
|
|
245
|
-
fill="none"
|
|
246
|
-
role="img"
|
|
247
|
-
aria-label="Camera"
|
|
248
|
-
>
|
|
249
|
-
<path
|
|
250
|
-
fillRule="evenodd"
|
|
251
|
-
clipRule="evenodd"
|
|
252
|
-
d="M5 5C4.20435 5 3.44129 5.31607 2.87868 5.87868C2.31607 6.44129 2 7.20435 2 8V16C2 16.7956 2.31607 17.5587 2.87868 18.1213C3.44129 18.6839 4.20435 19 5 19H15C15.7956 19 16.5587 18.6839 17.1213 18.1213C17.6839 17.5587 18 16.7956 18 16V14.414L20.293 16.707C20.4329 16.8468 20.611 16.942 20.805 16.9806C20.9989 17.0192 21.2 16.9993 21.3827 16.9237C21.5654 16.848 21.7215 16.7199 21.8314 16.5555C21.9413 16.391 22 16.1978 22 16V8C22 7.80225 21.9413 7.60895 21.8314 7.44454C21.7215 7.28013 21.5654 7.15199 21.3827 7.07632C21.2 7.00065 20.9989 6.98085 20.805 7.01942C20.611 7.05798 20.4329 7.15319 20.293 7.293L18 9.586V8C18 7.20435 17.6839 6.44129 17.1213 5.87868C16.5587 5.31607 15.7956 5 15 5H5Z"
|
|
253
|
-
fill="#020617"
|
|
254
|
-
/>
|
|
255
|
-
</svg>
|
|
256
|
-
)}
|
|
257
|
-
</span>
|
|
258
|
-
<span style={{ position: "absolute", width: "1px", height: "1px", padding: "0", margin: "-1px", overflow: "hidden", clip: "rect(0, 0, 0, 0)", whiteSpace: "nowrap", borderWidth: "0" }}>Camera</span>
|
|
259
|
-
</button>
|
|
260
|
-
<SelectDevice
|
|
261
|
-
value={currentCam?.device?.deviceId}
|
|
262
|
-
devices={cameras || []}
|
|
263
|
-
disabled={!isCamReady}
|
|
264
|
-
onChange={(val) => setCamera(val)}
|
|
265
|
-
/>
|
|
266
|
-
</div>
|
|
267
|
-
);
|
|
268
|
-
});
|
|
269
|
-
|
|
270
|
-
CameraButton.displayName = "CameraButton";
|
|
271
|
-
|
|
272
|
-
export const Controls = memo(() => {
|
|
273
|
-
return (
|
|
274
|
-
<div style={{ display: 'flex', gap: '10px' }}>
|
|
275
|
-
<MicrophoneButton />
|
|
276
|
-
<CameraButton />
|
|
277
|
-
</div>
|
|
278
|
-
);
|
|
279
|
-
});
|
|
@@ -1,279 +0,0 @@
|
|
|
1
|
-
import React, { memo, useMemo } from "react";
|
|
2
|
-
import {
|
|
3
|
-
useAudioTrack,
|
|
4
|
-
useDaily,
|
|
5
|
-
useDevices,
|
|
6
|
-
useLocalSessionId,
|
|
7
|
-
useVideoTrack,
|
|
8
|
-
} from "@daily-co/daily-react";
|
|
9
|
-
|
|
10
|
-
export const SelectDevice = ({
|
|
11
|
-
value,
|
|
12
|
-
devices,
|
|
13
|
-
disabled,
|
|
14
|
-
onChange,
|
|
15
|
-
}: {
|
|
16
|
-
value: string | undefined;
|
|
17
|
-
devices: { device: MediaDeviceInfo }[];
|
|
18
|
-
disabled: boolean;
|
|
19
|
-
onChange: (value: string) => void;
|
|
20
|
-
}) => {
|
|
21
|
-
return (
|
|
22
|
-
<select
|
|
23
|
-
value={value}
|
|
24
|
-
onChange={(e) => onChange(e.target.value)}
|
|
25
|
-
disabled={disabled}
|
|
26
|
-
style={{
|
|
27
|
-
height: "3rem",
|
|
28
|
-
width: "5.5rem",
|
|
29
|
-
borderRadius: "9999px",
|
|
30
|
-
backgroundColor: "rgba(255, 255, 255, 0.2)",
|
|
31
|
-
padding: "0 0.75rem",
|
|
32
|
-
border: "1px solid rgba(255, 255, 255, 0.2)",
|
|
33
|
-
backdropFilter: "blur(10px)",
|
|
34
|
-
}}
|
|
35
|
-
>
|
|
36
|
-
{devices.map(({ device }) => (
|
|
37
|
-
<option key={device.deviceId} value={device.deviceId}>
|
|
38
|
-
{device.label}
|
|
39
|
-
</option>
|
|
40
|
-
))}
|
|
41
|
-
</select>
|
|
42
|
-
);
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export const MicrophoneButton = memo(() => {
|
|
46
|
-
const daily = useDaily();
|
|
47
|
-
const localSessionId = useLocalSessionId();
|
|
48
|
-
const localAudio = useAudioTrack(localSessionId);
|
|
49
|
-
const { micState, microphones, currentMic, setMicrophone } = useDevices();
|
|
50
|
-
const isMicReady = useMemo(() => micState === "granted", [micState]);
|
|
51
|
-
const mutedAudio = localAudio.isOff;
|
|
52
|
-
|
|
53
|
-
const handleClick = () => {
|
|
54
|
-
daily?.setLocalAudio(mutedAudio);
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
return (
|
|
58
|
-
<div style={{
|
|
59
|
-
position: "relative",
|
|
60
|
-
display: "flex",
|
|
61
|
-
alignItems: "center",
|
|
62
|
-
justifyContent: "center",
|
|
63
|
-
borderRadius: "9999px",
|
|
64
|
-
backdropFilter: "blur(4px)"
|
|
65
|
-
}}>
|
|
66
|
-
<button
|
|
67
|
-
type="button"
|
|
68
|
-
onClick={handleClick}
|
|
69
|
-
disabled={!isMicReady}
|
|
70
|
-
style={{
|
|
71
|
-
position: "absolute",
|
|
72
|
-
left: 0,
|
|
73
|
-
top: 0,
|
|
74
|
-
zIndex: 10,
|
|
75
|
-
height: "3rem",
|
|
76
|
-
width: "3rem",
|
|
77
|
-
borderRadius: "9999px",
|
|
78
|
-
backgroundColor: "white",
|
|
79
|
-
display: "flex",
|
|
80
|
-
alignItems: "center",
|
|
81
|
-
justifyContent: "center",
|
|
82
|
-
opacity: !isMicReady ? "0.5" : "1"
|
|
83
|
-
}}
|
|
84
|
-
>
|
|
85
|
-
<span>
|
|
86
|
-
{mutedAudio || !isMicReady ? (
|
|
87
|
-
<svg
|
|
88
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
89
|
-
width="24"
|
|
90
|
-
height="24"
|
|
91
|
-
viewBox="0 0 24 24"
|
|
92
|
-
fill="none"
|
|
93
|
-
role="img"
|
|
94
|
-
aria-label="Microphone Muted"
|
|
95
|
-
>
|
|
96
|
-
<path
|
|
97
|
-
d="M12 18C10.1435 18 8.36301 17.2625 7.05025 15.9497C5.7375 14.637 5 12.8565 5 11V10M12 18C13.8565 18 15.637 17.2625 16.9497 15.9497C18.2625 14.637 18.1339 14.0992 18.1339 14.0992M12 18V21"
|
|
98
|
-
stroke="#020617"
|
|
99
|
-
strokeWidth="1.66667"
|
|
100
|
-
strokeLinecap="round"
|
|
101
|
-
strokeLinejoin="round"
|
|
102
|
-
/>
|
|
103
|
-
<rect
|
|
104
|
-
x="1.30225"
|
|
105
|
-
y="3"
|
|
106
|
-
width="26"
|
|
107
|
-
height="2.24738"
|
|
108
|
-
rx="1.12369"
|
|
109
|
-
transform="rotate(30 1.30225 3)"
|
|
110
|
-
fill="#020617"
|
|
111
|
-
/>
|
|
112
|
-
<path
|
|
113
|
-
fillRule="evenodd"
|
|
114
|
-
clipRule="evenodd"
|
|
115
|
-
d="M9 9.39031V11C9 11.7956 9.31607 12.5587 9.87868 13.1213C10.4413 13.6839 11.2044 14 12 14C12.7956 14 13.5587 13.6839 14.1213 13.1213C14.2829 12.9597 14.4242 12.7816 14.5435 12.5908L9 9.39031ZM15 7.71466V6C15 5.20435 14.6839 4.44129 14.1213 3.87868C13.5587 3.31607 12.7956 3 12 3C11.2044 3 10.4413 3.31607 9.87868 3.87868C9.69528 4.06208 9.53807 4.26678 9.40948 4.48697L15 7.71466Z"
|
|
116
|
-
fill="#020617"
|
|
117
|
-
/>
|
|
118
|
-
<path
|
|
119
|
-
d="M9 9.39031L9.41667 8.66862C9.15883 8.51976 8.84117 8.51976 8.58333 8.66862C8.3255 8.81748 8.16667 9.09259 8.16667 9.39031H9ZM9.87868 13.1213L9.28942 13.7106H9.28942L9.87868 13.1213ZM14.1213 13.1213L14.7106 13.7106L14.7106 13.7106L14.1213 13.1213ZM14.5435 12.5908L15.25 13.0327C15.3699 12.841 15.4068 12.6088 15.3521 12.3894C15.2974 12.17 15.156 11.9822 14.9601 11.8692L14.5435 12.5908ZM15 7.71466L14.5833 8.43635C14.8412 8.58521 15.1588 8.58521 15.4167 8.43635C15.6745 8.28749 15.8333 8.01238 15.8333 7.71466H15ZM14.1213 3.87868L14.7106 3.28942L14.7106 3.28942L14.1213 3.87868ZM9.87868 3.87868L9.28942 3.28942L9.28942 3.28942L9.87868 3.87868ZM9.40948 4.48697L8.68988 4.06671C8.57806 4.25818 8.54715 4.48633 8.604 4.70065C8.66086 4.91497 8.80078 5.09779 8.99281 5.20866L9.40948 4.48697ZM9.83333 11V9.39031H8.16667V11H9.83333ZM10.4679 12.5321C10.0616 12.1257 9.83333 11.5746 9.83333 11H8.16667C8.16667 12.0167 8.57053 12.9917 9.28942 13.7106L10.4679 12.5321ZM12 13.1667C11.4254 13.1667 10.8743 12.9384 10.4679 12.5321L9.28942 13.7106C10.0083 14.4295 10.9833 14.8333 12 14.8333V13.1667ZM13.5321 12.5321C13.1257 12.9384 12.5746 13.1667 12 13.1667V14.8333C13.0167 14.8333 13.9917 14.4295 14.7106 13.7106L13.5321 12.5321ZM13.837 12.149C13.7508 12.2867 13.6488 12.4153 13.5321 12.5321L14.7106 13.7106C14.917 13.5041 15.0976 13.2764 15.25 13.0327L13.837 12.149ZM14.9601 11.8692L9.41667 8.66862L8.58333 10.112L14.1268 13.3125L14.9601 11.8692ZM14.1667 6V7.71466H15.8333V6H14.1667ZM13.5321 4.46794C13.9384 4.87426 14.1667 5.42536 14.1667 6H15.8333C15.8333 4.98334 15.4295 4.00831 14.7106 3.28942L13.5321 4.46794ZM12 3.83333C12.5746 3.83333 13.1257 4.06161 13.5321 4.46794L14.7106 3.28942C13.9917 2.57053 13.0167 2.16667 12 2.16667V3.83333ZM10.4679 4.46794C10.8743 4.06161 11.4254 3.83333 12 3.83333V2.16667C10.9833 2.16667 10.0083 2.57053 9.28942 3.28942L10.4679 4.46794ZM10.1291 4.90724C10.2219 4.74824 10.3354 4.60042 10.4679 4.46794L9.28942 3.28942C9.05511 3.52374 8.85421 3.78533 8.68988 4.06671L10.1291 4.90724ZM8.99281 5.20866L14.5833 8.43635L15.4167 6.99298L9.82615 3.76529L8.99281 5.20866Z"
|
|
120
|
-
fill="#020617"
|
|
121
|
-
/>
|
|
122
|
-
</svg>
|
|
123
|
-
) : (
|
|
124
|
-
<svg
|
|
125
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
126
|
-
width="24"
|
|
127
|
-
height="24"
|
|
128
|
-
viewBox="0 0 24 24"
|
|
129
|
-
fill="none"
|
|
130
|
-
role="img"
|
|
131
|
-
aria-label="Microphone"
|
|
132
|
-
>
|
|
133
|
-
<path
|
|
134
|
-
d="M9 6C9 5.20435 9.31607 4.44129 9.87868 3.87868C10.4413 3.31607 11.2044 3 12 3C12.7956 3 13.5587 3.31607 14.1213 3.87868C14.6839 4.44129 15 5.20435 15 6V11C15 11.7956 14.6839 12.5587 14.1213 13.1213C13.5587 13.6839 12.7956 14 12 14C11.2044 14 10.4413 13.6839 9.87868 13.1213C9.31607 12.5587 9 11.7956 9 11V6Z"
|
|
135
|
-
fill="#020617"
|
|
136
|
-
stroke="#020617"
|
|
137
|
-
strokeWidth="2"
|
|
138
|
-
strokeLinecap="round"
|
|
139
|
-
strokeLinejoin="round"
|
|
140
|
-
/>
|
|
141
|
-
<path
|
|
142
|
-
d="M12 18C10.1435 18 8.36301 17.2625 7.05025 15.9497C5.7375 14.637 5 12.8565 5 11V10M12 18C13.8565 18 15.637 17.2625 16.9497 15.9497C18.2625 14.637 19 12.8565 19 11V10M12 18V21"
|
|
143
|
-
stroke="#020617"
|
|
144
|
-
strokeWidth="2"
|
|
145
|
-
strokeLinecap="round"
|
|
146
|
-
strokeLinejoin="round"
|
|
147
|
-
/>
|
|
148
|
-
</svg>
|
|
149
|
-
)}
|
|
150
|
-
</span>
|
|
151
|
-
<span style={{ position: "absolute", width: "1px", height: "1px", padding: "0", margin: "-1px", overflow: "hidden", clip: "rect(0, 0, 0, 0)", whiteSpace: "nowrap", borderWidth: "0" }}>Microphone</span>
|
|
152
|
-
</button>
|
|
153
|
-
<SelectDevice
|
|
154
|
-
value={currentMic?.device?.deviceId}
|
|
155
|
-
devices={microphones || []}
|
|
156
|
-
disabled={!isMicReady}
|
|
157
|
-
onChange={(val) => setMicrophone(val)}
|
|
158
|
-
/>
|
|
159
|
-
</div>
|
|
160
|
-
);
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
MicrophoneButton.displayName = "MicrophoneButton";
|
|
164
|
-
|
|
165
|
-
export const CameraButton = memo(() => {
|
|
166
|
-
const daily = useDaily();
|
|
167
|
-
const localSessionId = useLocalSessionId();
|
|
168
|
-
const localVideo = useVideoTrack(localSessionId);
|
|
169
|
-
const { currentCam, camState, cameras, setCamera } = useDevices();
|
|
170
|
-
const isCamReady = camState === "granted";
|
|
171
|
-
const mutedVideo = localVideo.isOff;
|
|
172
|
-
|
|
173
|
-
const handleClick = () => {
|
|
174
|
-
daily?.setLocalVideo(mutedVideo);
|
|
175
|
-
};
|
|
176
|
-
|
|
177
|
-
return (
|
|
178
|
-
<div style={{
|
|
179
|
-
position: "relative",
|
|
180
|
-
display: "flex",
|
|
181
|
-
alignItems: "center",
|
|
182
|
-
justifyContent: "center",
|
|
183
|
-
borderRadius: "9999px",
|
|
184
|
-
backdropFilter: "blur(4px)"
|
|
185
|
-
}}>
|
|
186
|
-
<button
|
|
187
|
-
type="button"
|
|
188
|
-
onClick={handleClick}
|
|
189
|
-
disabled={!isCamReady || !currentCam}
|
|
190
|
-
style={{
|
|
191
|
-
position: "absolute",
|
|
192
|
-
left: 0,
|
|
193
|
-
top: 0,
|
|
194
|
-
zIndex: 10,
|
|
195
|
-
height: "3rem",
|
|
196
|
-
width: "3rem",
|
|
197
|
-
borderRadius: "9999px",
|
|
198
|
-
backgroundColor: "white",
|
|
199
|
-
display: "flex",
|
|
200
|
-
alignItems: "center",
|
|
201
|
-
justifyContent: "center",
|
|
202
|
-
opacity: (!isCamReady || !currentCam) ? "0.5" : "1"
|
|
203
|
-
}}
|
|
204
|
-
>
|
|
205
|
-
<span>
|
|
206
|
-
{mutedVideo ? (
|
|
207
|
-
<svg
|
|
208
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
209
|
-
width="24"
|
|
210
|
-
height="24"
|
|
211
|
-
viewBox="0 0 24 24"
|
|
212
|
-
fill="none"
|
|
213
|
-
role="img"
|
|
214
|
-
aria-label="Camera Muted"
|
|
215
|
-
>
|
|
216
|
-
<g clipPath="url(#clip0_7082_14220)">
|
|
217
|
-
<path
|
|
218
|
-
fillRule="evenodd"
|
|
219
|
-
clipRule="evenodd"
|
|
220
|
-
d="M3.19874 5.60093C3.08628 5.68537 2.97928 5.77808 2.87868 5.87868C2.31607 6.44129 2 7.20435 2 8V16C2 16.7956 2.31607 17.5587 2.87868 18.1213C3.44129 18.6839 4.20435 19 5 19H15C15.7956 19 16.5587 18.6839 17.1213 18.1213C17.6839 17.5587 18 16.7956 18 16V15.048C17.7787 14.8204 17.5304 14.6189 17.2595 14.4485L3.19874 5.60093ZM22 12.655V8C22 7.80225 21.9413 7.60895 21.8314 7.44454C21.7215 7.28013 21.5654 7.15199 21.3827 7.07632C21.2 7.00065 20.9989 6.98085 20.805 7.01942C20.611 7.05798 20.4329 7.15319 20.293 7.293L18 9.586V8C18 7.20435 17.6839 6.44129 17.1213 5.87868C16.5587 5.31607 15.7956 5 15 5H8.7412L22 12.655Z"
|
|
221
|
-
fill="#020617"
|
|
222
|
-
/>
|
|
223
|
-
<rect
|
|
224
|
-
x="0.777222"
|
|
225
|
-
y="2.64844"
|
|
226
|
-
width="26.7988"
|
|
227
|
-
height="2.24738"
|
|
228
|
-
rx="1.12369"
|
|
229
|
-
transform="rotate(30 0.777222 2.64844)"
|
|
230
|
-
fill="#020617"
|
|
231
|
-
/>
|
|
232
|
-
</g>
|
|
233
|
-
<defs>
|
|
234
|
-
<clipPath id="clip0_7082_14220">
|
|
235
|
-
<rect width="24" height="24" fill="white" />
|
|
236
|
-
</clipPath>
|
|
237
|
-
</defs>
|
|
238
|
-
</svg>
|
|
239
|
-
) : (
|
|
240
|
-
<svg
|
|
241
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
242
|
-
width="24"
|
|
243
|
-
height="24"
|
|
244
|
-
viewBox="0 0 24 24"
|
|
245
|
-
fill="none"
|
|
246
|
-
role="img"
|
|
247
|
-
aria-label="Camera"
|
|
248
|
-
>
|
|
249
|
-
<path
|
|
250
|
-
fillRule="evenodd"
|
|
251
|
-
clipRule="evenodd"
|
|
252
|
-
d="M5 5C4.20435 5 3.44129 5.31607 2.87868 5.87868C2.31607 6.44129 2 7.20435 2 8V16C2 16.7956 2.31607 17.5587 2.87868 18.1213C3.44129 18.6839 4.20435 19 5 19H15C15.7956 19 16.5587 18.6839 17.1213 18.1213C17.6839 17.5587 18 16.7956 18 16V14.414L20.293 16.707C20.4329 16.8468 20.611 16.942 20.805 16.9806C20.9989 17.0192 21.2 16.9993 21.3827 16.9237C21.5654 16.848 21.7215 16.7199 21.8314 16.5555C21.9413 16.391 22 16.1978 22 16V8C22 7.80225 21.9413 7.60895 21.8314 7.44454C21.7215 7.28013 21.5654 7.15199 21.3827 7.07632C21.2 7.00065 20.9989 6.98085 20.805 7.01942C20.611 7.05798 20.4329 7.15319 20.293 7.293L18 9.586V8C18 7.20435 17.6839 6.44129 17.1213 5.87868C16.5587 5.31607 15.7956 5 15 5H5Z"
|
|
253
|
-
fill="#020617"
|
|
254
|
-
/>
|
|
255
|
-
</svg>
|
|
256
|
-
)}
|
|
257
|
-
</span>
|
|
258
|
-
<span style={{ position: "absolute", width: "1px", height: "1px", padding: "0", margin: "-1px", overflow: "hidden", clip: "rect(0, 0, 0, 0)", whiteSpace: "nowrap", borderWidth: "0" }}>Camera</span>
|
|
259
|
-
</button>
|
|
260
|
-
<SelectDevice
|
|
261
|
-
value={currentCam?.device?.deviceId}
|
|
262
|
-
devices={cameras || []}
|
|
263
|
-
disabled={!isCamReady}
|
|
264
|
-
onChange={(val) => setCamera(val)}
|
|
265
|
-
/>
|
|
266
|
-
</div>
|
|
267
|
-
);
|
|
268
|
-
});
|
|
269
|
-
|
|
270
|
-
CameraButton.displayName = "CameraButton";
|
|
271
|
-
|
|
272
|
-
export const Controls = memo(() => {
|
|
273
|
-
return (
|
|
274
|
-
<div style={{ display: 'flex', gap: '10px' }}>
|
|
275
|
-
<MicrophoneButton />
|
|
276
|
-
<CameraButton />
|
|
277
|
-
</div>
|
|
278
|
-
);
|
|
279
|
-
});
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { useCallback } from 'react';
|
|
2
|
-
import { useDaily, useParticipantIds } from "@daily-co/daily-react";
|
|
3
|
-
|
|
4
|
-
export const useReplicasIDs = () => {
|
|
5
|
-
const replicasIDs = useParticipantIds({
|
|
6
|
-
filter: (participant) => participant.user_id.includes("tavus-replica"),
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
return replicasIDs;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export const useRemoteParticipantsIDs = () => {
|
|
13
|
-
const remoteParticipantIds = useParticipantIds({
|
|
14
|
-
filter: (participant) => !participant.local,
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
return remoteParticipantIds;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export const useCVICall = () => {
|
|
21
|
-
const daily = useDaily();
|
|
22
|
-
|
|
23
|
-
const joinCall = useCallback(({ url }: { url: string }) => {
|
|
24
|
-
daily?.join({
|
|
25
|
-
url: url,
|
|
26
|
-
});
|
|
27
|
-
}, [daily]);
|
|
28
|
-
|
|
29
|
-
const leaveCall = useCallback(() => {
|
|
30
|
-
daily?.leave();
|
|
31
|
-
}, [daily]);
|
|
32
|
-
|
|
33
|
-
return { daily: daily, joinCall, leaveCall };
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
const useCVIEvents = () => {
|
|
37
|
-
// TODO: add app-messages listener
|
|
38
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { useCallback } from 'react';
|
|
2
|
-
import { useDaily, useParticipantIds } from "@daily-co/daily-react";
|
|
3
|
-
|
|
4
|
-
export const useReplicasIDs = () => {
|
|
5
|
-
const replicasIDs = useParticipantIds({
|
|
6
|
-
filter: (participant) => participant.user_id.includes("tavus-replica"),
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
return replicasIDs;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export const useRemoteParticipantsIDs = () => {
|
|
13
|
-
const remoteParticipantIds = useParticipantIds({
|
|
14
|
-
filter: (participant) => !participant.local,
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
return remoteParticipantIds;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export const useCVICall = () => {
|
|
21
|
-
const daily = useDaily();
|
|
22
|
-
|
|
23
|
-
const joinCall = useCallback(({ url }: { url: string }) => {
|
|
24
|
-
daily?.join({
|
|
25
|
-
url: url,
|
|
26
|
-
});
|
|
27
|
-
}, [daily]);
|
|
28
|
-
|
|
29
|
-
const leaveCall = useCallback(() => {
|
|
30
|
-
daily?.leave();
|
|
31
|
-
}, [daily]);
|
|
32
|
-
|
|
33
|
-
return { daily: daily, joinCall, leaveCall };
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
const useCVIEvents = () => {
|
|
37
|
-
// TODO: add app-messages listener
|
|
38
|
-
}
|