@pipecat-ai/client-react 0.4.1 → 1.0.1
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 +46 -47
- package/dist/index.d.ts +19 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +233 -155
- package/dist/index.js.map +1 -1
- package/dist/index.module.js +225 -147
- package/dist/index.module.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2,8 +2,8 @@ var $5Zyvw$reactjsxruntime = require("react/jsx-runtime");
|
|
|
2
2
|
var $5Zyvw$pipecataiclientjs = require("@pipecat-ai/client-js");
|
|
3
3
|
var $5Zyvw$react = require("react");
|
|
4
4
|
var $5Zyvw$jotai = require("jotai");
|
|
5
|
-
var $5Zyvw$jotaireact = require("jotai/react");
|
|
6
5
|
var $5Zyvw$jotaiutils = require("jotai/utils");
|
|
6
|
+
var $5Zyvw$jotaireact = require("jotai/react");
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
function $parcel$export(e, n, v, s) {
|
|
@@ -14,18 +14,18 @@ function $parcel$interopDefault(a) {
|
|
|
14
14
|
return a && a.__esModule ? a.default : a;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
$parcel$export(module.exports, "
|
|
18
|
-
$parcel$export(module.exports, "
|
|
19
|
-
$parcel$export(module.exports, "
|
|
20
|
-
$parcel$export(module.exports, "
|
|
21
|
-
$parcel$export(module.exports, "
|
|
22
|
-
$parcel$export(module.exports, "
|
|
23
|
-
$parcel$export(module.exports, "
|
|
17
|
+
$parcel$export(module.exports, "PipecatClientAudio", () => $a2a1c5f475114d56$export$b52250cb73ff4de1);
|
|
18
|
+
$parcel$export(module.exports, "PipecatClientCamToggle", () => $666ceba11158b494$export$dc9a029eeca8213f);
|
|
19
|
+
$parcel$export(module.exports, "PipecatClientMicToggle", () => $1a9931980e271aa3$export$bc8133b69ff660a2);
|
|
20
|
+
$parcel$export(module.exports, "PipecatClientProvider", () => $8df0e777e4d7dd49$export$bb43666ced7a20d0);
|
|
21
|
+
$parcel$export(module.exports, "PipecatClientVideo", () => $0f97689637ada1d8$export$85974db6d0cc43b3);
|
|
22
|
+
$parcel$export(module.exports, "usePipecatClient", () => $172f489fc5d91d99$export$777fa8498be78705);
|
|
23
|
+
$parcel$export(module.exports, "usePipecatClientCamControl", () => $d9b24817de62910a$export$3ea2601427f0430f);
|
|
24
|
+
$parcel$export(module.exports, "usePipecatClientMediaDevices", () => $9bd3e7d3a9d7acd1$export$642bc4d2d2a376f1);
|
|
25
|
+
$parcel$export(module.exports, "usePipecatClientMediaTrack", () => $630203d8dad1dd45$export$9813dcd2d0c26814);
|
|
26
|
+
$parcel$export(module.exports, "usePipecatClientMicControl", () => $4af0eba414c586fd$export$388e706586309ef0);
|
|
27
|
+
$parcel$export(module.exports, "usePipecatClientTransportState", () => $810478f6ae107062$export$30aee278309a867b);
|
|
24
28
|
$parcel$export(module.exports, "useRTVIClientEvent", () => $8a6b68ebf0332682$export$33a6ac53b8f02625);
|
|
25
|
-
$parcel$export(module.exports, "useRTVIClientMediaDevices", () => $01bcacdf0a25e20c$export$652c54907b83a48d);
|
|
26
|
-
$parcel$export(module.exports, "useRTVIClientMediaTrack", () => $e5be552b22401c66$export$7c03381e0d26a6c3);
|
|
27
|
-
$parcel$export(module.exports, "useRTVIClientMicControl", () => $b5946020fafb75c5$export$805915964ad7bc25);
|
|
28
|
-
$parcel$export(module.exports, "useRTVIClientTransportState", () => $6b6c1a9f794236bd$export$599fa01283bd4ece);
|
|
29
29
|
$parcel$export(module.exports, "VoiceVisualizer", () => $a1dfa75b13e6bb9b$export$59bf27bd43679db6);
|
|
30
30
|
/**
|
|
31
31
|
* Copyright (c) 2024, Daily.
|
|
@@ -39,6 +39,9 @@ $parcel$export(module.exports, "VoiceVisualizer", () => $a1dfa75b13e6bb9b$export
|
|
|
39
39
|
*
|
|
40
40
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
41
41
|
*/
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
42
45
|
/**
|
|
43
46
|
* Copyright (c) 2024, Daily.
|
|
44
47
|
*
|
|
@@ -48,81 +51,195 @@ $parcel$export(module.exports, "VoiceVisualizer", () => $a1dfa75b13e6bb9b$export
|
|
|
48
51
|
|
|
49
52
|
|
|
50
53
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
store: jotaiStore,
|
|
56
|
-
children: (0, $5Zyvw$reactjsxruntime.jsx)($0befa35d025c789a$export$8d2b07cbee622e7c.Provider, {
|
|
57
|
-
value: {
|
|
58
|
-
client: client
|
|
59
|
-
},
|
|
60
|
-
children: children
|
|
61
|
-
})
|
|
62
|
-
});
|
|
63
|
-
};
|
|
64
|
-
$0befa35d025c789a$export$4a4ae2d5dc96782.displayName = "RTVIClientProvider";
|
|
54
|
+
|
|
55
|
+
var $d1f89db81f967f39$exports = {};
|
|
56
|
+
$d1f89db81f967f39$exports = JSON.parse("{\"name\":\"@pipecat-ai/client-react\",\"version\":\"1.0.1\",\"license\":\"BSD-2-Clause\",\"main\":\"dist/index.js\",\"module\":\"dist/index.module.js\",\"types\":\"dist/index.d.ts\",\"source\":\"src/index.ts\",\"repository\":{\"type\":\"git\",\"url\":\"git+https://github.com/pipecat-ai/pipecat-client-web.git\"},\"files\":[\"dist\",\"package.json\",\"README.md\"],\"scripts\":{\"build\":\"parcel build --no-cache\",\"dev\":\"parcel watch\",\"lint\":\"eslint . --report-unused-disable-directives --max-warnings 0 --ignore-pattern 'dist/'\"},\"devDependencies\":{\"@pipecat-ai/client-js\":\"*\",\"@types/react\":\"^18.3.3\",\"@types/react-dom\":\"^18.3.0\",\"@typescript-eslint/eslint-plugin\":\"^8.32.0\",\"eslint\":\"^9.11.1\",\"eslint-config-prettier\":\"^9.1.0\",\"eslint-plugin-react-hooks\":\"^5.2.0\",\"eslint-plugin-simple-import-sort\":\"^12.1.1\",\"parcel\":\"^2.12.0\",\"react\":\"^18.3.1\",\"react-dom\":\"^18.3.1\",\"typescript\":\"^5.2.2\"},\"peerDependencies\":{\"@pipecat-ai/client-js\":\"*\",\"react\":\">=18\",\"react-dom\":\">=18\"},\"dependencies\":{\"jotai\":\"^2.9.0\"}}");
|
|
57
|
+
|
|
65
58
|
|
|
66
59
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Copyright (c) 2024, Daily.
|
|
65
|
+
*
|
|
66
|
+
* SPDX-License-Identifier: BSD-2-Clause
|
|
67
|
+
*/
|
|
68
|
+
|
|
69
|
+
const $a37ab5d1bcf1d3b2$export$fe23d0ef95286467 = /*#__PURE__*/ (0, $5Zyvw$react.createContext)({
|
|
70
|
+
on: ()=>{},
|
|
71
|
+
off: ()=>{}
|
|
72
|
+
});
|
|
71
73
|
|
|
72
74
|
|
|
73
75
|
const $8a6b68ebf0332682$export$33a6ac53b8f02625 = (event, handler)=>{
|
|
74
|
-
const
|
|
76
|
+
const { on: on, off: off } = (0, $5Zyvw$react.useContext)((0, $a37ab5d1bcf1d3b2$export$fe23d0ef95286467));
|
|
75
77
|
(0, $5Zyvw$react.useEffect)(()=>{
|
|
76
|
-
|
|
77
|
-
client.on(event, handler);
|
|
78
|
+
on(event, handler);
|
|
78
79
|
return ()=>{
|
|
79
|
-
|
|
80
|
+
off(event, handler);
|
|
80
81
|
};
|
|
81
82
|
}, [
|
|
82
83
|
event,
|
|
83
84
|
handler,
|
|
85
|
+
on,
|
|
86
|
+
off
|
|
87
|
+
]);
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
const $44c6278d186dd94f$export$d6bdcccacef16204 = /*#__PURE__*/ (0, $5Zyvw$react.createContext)({
|
|
92
|
+
enableCam: ()=>{
|
|
93
|
+
throw new Error("PipecatClientCamStateContext: enableCam() called outside of provider");
|
|
94
|
+
},
|
|
95
|
+
isCamEnabled: false
|
|
96
|
+
});
|
|
97
|
+
const $44c6278d186dd94f$export$802b42df0e0d8153 = /*#__PURE__*/ (0, $5Zyvw$react.createContext)({
|
|
98
|
+
enableMic: ()=>{
|
|
99
|
+
throw new Error("PipecatClientMicStateContext: enableMic() called outside of provider");
|
|
100
|
+
},
|
|
101
|
+
isMicEnabled: false
|
|
102
|
+
});
|
|
103
|
+
const $44c6278d186dd94f$export$db79fdf85ddd6b65 = /*#__PURE__*/ (0, $5Zyvw$react.createContext)("disconnected");
|
|
104
|
+
const $44c6278d186dd94f$export$4777554fda61c378 = ({ children: children })=>{
|
|
105
|
+
const client = (0, $172f489fc5d91d99$export$777fa8498be78705)();
|
|
106
|
+
const [isCamEnabled, setIsCamEnabled] = (0, $5Zyvw$react.useState)(false);
|
|
107
|
+
const [isMicEnabled, setIsMicEnabled] = (0, $5Zyvw$react.useState)(false);
|
|
108
|
+
const [transportState, setTransportState] = (0, $5Zyvw$react.useState)("disconnected");
|
|
109
|
+
(0, $8a6b68ebf0332682$export$33a6ac53b8f02625)((0, $5Zyvw$pipecataiclientjs.RTVIEvent).TransportStateChanged, (state)=>{
|
|
110
|
+
setTransportState(state);
|
|
111
|
+
if (state === "initialized" && client) {
|
|
112
|
+
setIsCamEnabled(client.isCamEnabled ?? false);
|
|
113
|
+
setIsMicEnabled(client.isMicEnabled ?? false);
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
const enableCam = (0, $5Zyvw$react.useCallback)((enabled)=>{
|
|
117
|
+
setIsCamEnabled(enabled);
|
|
118
|
+
client?.enableCam?.(enabled);
|
|
119
|
+
}, [
|
|
84
120
|
client
|
|
85
121
|
]);
|
|
122
|
+
const enableMic = (0, $5Zyvw$react.useCallback)((enabled)=>{
|
|
123
|
+
setIsMicEnabled(enabled);
|
|
124
|
+
client?.enableMic?.(enabled);
|
|
125
|
+
}, [
|
|
126
|
+
client
|
|
127
|
+
]);
|
|
128
|
+
return (0, $5Zyvw$reactjsxruntime.jsx)($44c6278d186dd94f$export$db79fdf85ddd6b65.Provider, {
|
|
129
|
+
value: transportState,
|
|
130
|
+
children: (0, $5Zyvw$reactjsxruntime.jsx)($44c6278d186dd94f$export$d6bdcccacef16204.Provider, {
|
|
131
|
+
value: {
|
|
132
|
+
enableCam: enableCam,
|
|
133
|
+
isCamEnabled: isCamEnabled
|
|
134
|
+
},
|
|
135
|
+
children: (0, $5Zyvw$reactjsxruntime.jsx)($44c6278d186dd94f$export$802b42df0e0d8153.Provider, {
|
|
136
|
+
value: {
|
|
137
|
+
enableMic: enableMic,
|
|
138
|
+
isMicEnabled: isMicEnabled
|
|
139
|
+
},
|
|
140
|
+
children: children
|
|
141
|
+
})
|
|
142
|
+
})
|
|
143
|
+
});
|
|
86
144
|
};
|
|
87
145
|
|
|
88
146
|
|
|
89
|
-
/**
|
|
90
|
-
* Copyright (c) 2024, Daily.
|
|
91
|
-
*
|
|
92
|
-
* SPDX-License-Identifier: BSD-2-Clause
|
|
93
|
-
*/
|
|
94
147
|
|
|
148
|
+
const $8df0e777e4d7dd49$var$defaultStore = (0, $5Zyvw$jotai.createStore)();
|
|
149
|
+
const $8df0e777e4d7dd49$export$67f6d73bc6cd7bb1 = /*#__PURE__*/ (0, $5Zyvw$react.createContext)({});
|
|
150
|
+
const $8df0e777e4d7dd49$export$bb43666ced7a20d0 = ({ children: children, client: client, jotaiStore: jotaiStore = $8df0e777e4d7dd49$var$defaultStore })=>{
|
|
151
|
+
(0, $5Zyvw$react.useEffect)(()=>{
|
|
152
|
+
(0, $5Zyvw$pipecataiclientjs.setAboutClient)({
|
|
153
|
+
library: (0, $d1f89db81f967f39$exports.name),
|
|
154
|
+
library_version: (0, $d1f89db81f967f39$exports.version)
|
|
155
|
+
});
|
|
156
|
+
}, []);
|
|
157
|
+
const eventHandlersMap = (0, $5Zyvw$react.useRef)({});
|
|
158
|
+
(0, $5Zyvw$react.useEffect)(()=>{
|
|
159
|
+
if (!client) return;
|
|
160
|
+
const allEvents = Object.values((0, $5Zyvw$pipecataiclientjs.RTVIEvent)).filter((value)=>isNaN(Number(value)));
|
|
161
|
+
const allHandlers = {};
|
|
162
|
+
allEvents.forEach((event)=>{
|
|
163
|
+
const handler = (...payload)=>{
|
|
164
|
+
const handlers = eventHandlersMap.current[event];
|
|
165
|
+
if (!handlers) return;
|
|
166
|
+
handlers.forEach((h)=>{
|
|
167
|
+
h(...payload);
|
|
168
|
+
});
|
|
169
|
+
};
|
|
170
|
+
allHandlers[event] = handler;
|
|
171
|
+
client.on(event, handler);
|
|
172
|
+
});
|
|
173
|
+
return ()=>{
|
|
174
|
+
allEvents.forEach((event)=>{
|
|
175
|
+
client.off(event, allHandlers[event]);
|
|
176
|
+
});
|
|
177
|
+
};
|
|
178
|
+
}, [
|
|
179
|
+
client
|
|
180
|
+
]);
|
|
181
|
+
const on = (0, $5Zyvw$react.useCallback)((event, handler)=>{
|
|
182
|
+
if (!eventHandlersMap.current[event]) eventHandlersMap.current[event] = new Set();
|
|
183
|
+
eventHandlersMap.current[event].add(handler);
|
|
184
|
+
}, []);
|
|
185
|
+
const off = (0, $5Zyvw$react.useCallback)((event, handler)=>{
|
|
186
|
+
eventHandlersMap.current[event]?.delete(handler);
|
|
187
|
+
}, []);
|
|
188
|
+
return (0, $5Zyvw$reactjsxruntime.jsx)((0, $5Zyvw$jotaireact.Provider), {
|
|
189
|
+
store: jotaiStore,
|
|
190
|
+
children: (0, $5Zyvw$reactjsxruntime.jsx)($8df0e777e4d7dd49$export$67f6d73bc6cd7bb1.Provider, {
|
|
191
|
+
value: {
|
|
192
|
+
client: client
|
|
193
|
+
},
|
|
194
|
+
children: (0, $5Zyvw$reactjsxruntime.jsx)((0, $a37ab5d1bcf1d3b2$export$fe23d0ef95286467).Provider, {
|
|
195
|
+
value: {
|
|
196
|
+
on: on,
|
|
197
|
+
off: off
|
|
198
|
+
},
|
|
199
|
+
children: (0, $5Zyvw$reactjsxruntime.jsx)((0, $44c6278d186dd94f$export$4777554fda61c378), {
|
|
200
|
+
children: children
|
|
201
|
+
})
|
|
202
|
+
})
|
|
203
|
+
})
|
|
204
|
+
});
|
|
205
|
+
};
|
|
206
|
+
$8df0e777e4d7dd49$export$bb43666ced7a20d0.displayName = "PipecatClientProvider";
|
|
95
207
|
|
|
96
208
|
|
|
209
|
+
const $172f489fc5d91d99$export$777fa8498be78705 = ()=>{
|
|
210
|
+
const { client: client } = (0, $5Zyvw$react.useContext)((0, $8df0e777e4d7dd49$export$67f6d73bc6cd7bb1));
|
|
211
|
+
return client;
|
|
212
|
+
};
|
|
213
|
+
|
|
97
214
|
|
|
98
215
|
|
|
99
|
-
const $
|
|
100
|
-
const $
|
|
101
|
-
const $
|
|
102
|
-
const $
|
|
103
|
-
const $
|
|
104
|
-
const $
|
|
105
|
-
const $
|
|
216
|
+
const $630203d8dad1dd45$var$localAudioTrackAtom = (0, $5Zyvw$jotai.atom)(null);
|
|
217
|
+
const $630203d8dad1dd45$var$localVideoTrackAtom = (0, $5Zyvw$jotai.atom)(null);
|
|
218
|
+
const $630203d8dad1dd45$var$localScreenAudioTrackAtom = (0, $5Zyvw$jotai.atom)(null);
|
|
219
|
+
const $630203d8dad1dd45$var$localScreenVideoTrackAtom = (0, $5Zyvw$jotai.atom)(null);
|
|
220
|
+
const $630203d8dad1dd45$var$botAudioTrackAtom = (0, $5Zyvw$jotai.atom)(null);
|
|
221
|
+
const $630203d8dad1dd45$var$botVideoTrackAtom = (0, $5Zyvw$jotai.atom)(null);
|
|
222
|
+
const $630203d8dad1dd45$var$trackAtom = (0, $5Zyvw$jotaiutils.atomFamily)(({ local: local, trackType: trackType })=>{
|
|
106
223
|
if (local) switch(trackType){
|
|
107
224
|
case "audio":
|
|
108
|
-
return $
|
|
225
|
+
return $630203d8dad1dd45$var$localAudioTrackAtom;
|
|
109
226
|
case "screenAudio":
|
|
110
|
-
return $
|
|
227
|
+
return $630203d8dad1dd45$var$localScreenAudioTrackAtom;
|
|
111
228
|
case "screenVideo":
|
|
112
|
-
return $
|
|
229
|
+
return $630203d8dad1dd45$var$localScreenVideoTrackAtom;
|
|
113
230
|
case "video":
|
|
114
|
-
return $
|
|
231
|
+
return $630203d8dad1dd45$var$localVideoTrackAtom;
|
|
115
232
|
}
|
|
116
|
-
return trackType === "audio" ? $
|
|
233
|
+
return trackType === "audio" ? $630203d8dad1dd45$var$botAudioTrackAtom : $630203d8dad1dd45$var$botVideoTrackAtom;
|
|
117
234
|
});
|
|
118
|
-
const $
|
|
119
|
-
const client = (0, $
|
|
120
|
-
const track = (0, $5Zyvw$jotai.useAtomValue)($
|
|
235
|
+
const $630203d8dad1dd45$export$9813dcd2d0c26814 = (trackType, participantType)=>{
|
|
236
|
+
const client = (0, $172f489fc5d91d99$export$777fa8498be78705)();
|
|
237
|
+
const track = (0, $5Zyvw$jotai.useAtomValue)($630203d8dad1dd45$var$trackAtom({
|
|
121
238
|
local: participantType === "local",
|
|
122
239
|
trackType: trackType
|
|
123
240
|
}));
|
|
124
241
|
const updateTrack = (0, $5Zyvw$jotaiutils.useAtomCallback)((0, $5Zyvw$react.useCallback)((get, set, track, trackType, local)=>{
|
|
125
|
-
const atom = $
|
|
242
|
+
const atom = $630203d8dad1dd45$var$trackAtom({
|
|
126
243
|
local: local,
|
|
127
244
|
trackType: trackType
|
|
128
245
|
});
|
|
@@ -157,9 +274,10 @@ const $e5be552b22401c66$export$7c03381e0d26a6c3 = (trackType, participantType)=>
|
|
|
157
274
|
};
|
|
158
275
|
|
|
159
276
|
|
|
160
|
-
|
|
277
|
+
|
|
278
|
+
const $a2a1c5f475114d56$export$b52250cb73ff4de1 = ()=>{
|
|
161
279
|
const botAudioRef = (0, $5Zyvw$react.useRef)(null);
|
|
162
|
-
const botAudioTrack = (0, $
|
|
280
|
+
const botAudioTrack = (0, $630203d8dad1dd45$export$9813dcd2d0c26814)("audio", "bot");
|
|
163
281
|
(0, $5Zyvw$react.useEffect)(()=>{
|
|
164
282
|
if (!botAudioRef.current || !botAudioTrack) return;
|
|
165
283
|
if (botAudioRef.current.srcObject) {
|
|
@@ -184,9 +302,7 @@ const $e6a9aa6ceb34e585$export$ba1245f7cbf3ae02 = ()=>{
|
|
|
184
302
|
})
|
|
185
303
|
});
|
|
186
304
|
};
|
|
187
|
-
$
|
|
188
|
-
|
|
189
|
-
|
|
305
|
+
$a2a1c5f475114d56$export$b52250cb73ff4de1.displayName = "PipecatClientAudio";
|
|
190
306
|
|
|
191
307
|
|
|
192
308
|
|
|
@@ -197,42 +313,11 @@ $e6a9aa6ceb34e585$export$ba1245f7cbf3ae02.displayName = "RTVIClientAudio";
|
|
|
197
313
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
198
314
|
*/
|
|
199
315
|
|
|
200
|
-
|
|
201
|
-
const $6b6c1a9f794236bd$var$transportStateAtom = (0, $5Zyvw$jotai.atom)("disconnected");
|
|
202
|
-
const $6b6c1a9f794236bd$export$599fa01283bd4ece = ()=>{
|
|
203
|
-
const [transportState, setTransportState] = (0, $5Zyvw$jotai.useAtom)($6b6c1a9f794236bd$var$transportStateAtom);
|
|
204
|
-
(0, $8a6b68ebf0332682$export$33a6ac53b8f02625)((0, $5Zyvw$pipecataiclientjs.RTVIEvent).TransportStateChanged, setTransportState);
|
|
205
|
-
return transportState;
|
|
206
|
-
};
|
|
316
|
+
const $d9b24817de62910a$export$3ea2601427f0430f = ()=>(0, $5Zyvw$react.useContext)((0, $44c6278d186dd94f$export$d6bdcccacef16204));
|
|
207
317
|
|
|
208
318
|
|
|
209
|
-
const $
|
|
210
|
-
const
|
|
211
|
-
const [isCamEnabled, setIsCamEnabled] = (0, $5Zyvw$react.useState)(client?.isCamEnabled ?? false);
|
|
212
|
-
const transportState = (0, $6b6c1a9f794236bd$export$599fa01283bd4ece)();
|
|
213
|
-
// Sync component state with client state initially
|
|
214
|
-
(0, $5Zyvw$react.useEffect)(()=>{
|
|
215
|
-
if (!client || transportState !== "initialized" || typeof client.isCamEnabled !== "boolean") return;
|
|
216
|
-
setIsCamEnabled(client.isCamEnabled);
|
|
217
|
-
}, [
|
|
218
|
-
client,
|
|
219
|
-
transportState
|
|
220
|
-
]);
|
|
221
|
-
const enableCam = (0, $5Zyvw$react.useCallback)((enabled)=>{
|
|
222
|
-
setIsCamEnabled(enabled);
|
|
223
|
-
client?.enableCam?.(enabled);
|
|
224
|
-
}, [
|
|
225
|
-
client
|
|
226
|
-
]);
|
|
227
|
-
return {
|
|
228
|
-
enableCam: enableCam,
|
|
229
|
-
isCamEnabled: isCamEnabled
|
|
230
|
-
};
|
|
231
|
-
};
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
const $e7a27a30474b270e$export$156c26e16246ae3e = ({ onCamEnabledChanged: onCamEnabledChanged, disabled: disabled = false, children: children })=>{
|
|
235
|
-
const { isCamEnabled: isCamEnabled, enableCam: enableCam } = (0, $affd351738e2f16c$export$46099a7ec2fe8ac5)();
|
|
319
|
+
const $666ceba11158b494$export$dc9a029eeca8213f = ({ onCamEnabledChanged: onCamEnabledChanged, disabled: disabled = false, children: children })=>{
|
|
320
|
+
const { isCamEnabled: isCamEnabled, enableCam: enableCam } = (0, $d9b24817de62910a$export$3ea2601427f0430f)();
|
|
236
321
|
const handleToggleCam = (0, $5Zyvw$react.useCallback)(()=>{
|
|
237
322
|
if (disabled) return;
|
|
238
323
|
const newEnabledState = !isCamEnabled;
|
|
@@ -252,41 +337,22 @@ const $e7a27a30474b270e$export$156c26e16246ae3e = ({ onCamEnabledChanged: onCamE
|
|
|
252
337
|
})
|
|
253
338
|
});
|
|
254
339
|
};
|
|
255
|
-
var $
|
|
256
|
-
|
|
340
|
+
var $666ceba11158b494$export$2e2bcd8739ae039 = $666ceba11158b494$export$dc9a029eeca8213f;
|
|
257
341
|
|
|
258
342
|
|
|
259
343
|
|
|
260
344
|
|
|
345
|
+
/**
|
|
346
|
+
* Copyright (c) 2024, Daily.
|
|
347
|
+
*
|
|
348
|
+
* SPDX-License-Identifier: BSD-2-Clause
|
|
349
|
+
*/
|
|
261
350
|
|
|
351
|
+
const $4af0eba414c586fd$export$388e706586309ef0 = ()=>(0, $5Zyvw$react.useContext)((0, $44c6278d186dd94f$export$802b42df0e0d8153));
|
|
262
352
|
|
|
263
|
-
const $b5946020fafb75c5$export$805915964ad7bc25 = ()=>{
|
|
264
|
-
const client = (0, $8ee07494475a7fa7$export$31a5f6a22c9b8fba)();
|
|
265
|
-
const [isMicEnabled, setIsMicEnabled] = (0, $5Zyvw$react.useState)(client?.isMicEnabled ?? false);
|
|
266
|
-
const transportState = (0, $6b6c1a9f794236bd$export$599fa01283bd4ece)();
|
|
267
|
-
// Sync component state with client state initially
|
|
268
|
-
(0, $5Zyvw$react.useEffect)(()=>{
|
|
269
|
-
if (!client || transportState !== "initialized" || typeof client.isMicEnabled !== "boolean") return;
|
|
270
|
-
setIsMicEnabled(client.isMicEnabled);
|
|
271
|
-
}, [
|
|
272
|
-
client,
|
|
273
|
-
transportState
|
|
274
|
-
]);
|
|
275
|
-
const enableMic = (0, $5Zyvw$react.useCallback)((enabled)=>{
|
|
276
|
-
setIsMicEnabled(enabled);
|
|
277
|
-
client?.enableMic?.(enabled);
|
|
278
|
-
}, [
|
|
279
|
-
client
|
|
280
|
-
]);
|
|
281
|
-
return {
|
|
282
|
-
enableMic: enableMic,
|
|
283
|
-
isMicEnabled: isMicEnabled
|
|
284
|
-
};
|
|
285
|
-
};
|
|
286
353
|
|
|
287
|
-
|
|
288
|
-
const
|
|
289
|
-
const { enableMic: enableMic, isMicEnabled: isMicEnabled } = (0, $b5946020fafb75c5$export$805915964ad7bc25)();
|
|
354
|
+
const $1a9931980e271aa3$export$bc8133b69ff660a2 = ({ onMicEnabledChanged: onMicEnabledChanged, disabled: disabled = false, children: children })=>{
|
|
355
|
+
const { enableMic: enableMic, isMicEnabled: isMicEnabled } = (0, $4af0eba414c586fd$export$388e706586309ef0)();
|
|
290
356
|
const handleToggleMic = (0, $5Zyvw$react.useCallback)(()=>{
|
|
291
357
|
if (disabled) return;
|
|
292
358
|
const newEnabledState = !isMicEnabled;
|
|
@@ -306,7 +372,7 @@ const $8a175691955798a2$export$bf1c2c9ca877628d = ({ onMicEnabledChanged: onMicE
|
|
|
306
372
|
})
|
|
307
373
|
});
|
|
308
374
|
};
|
|
309
|
-
var $
|
|
375
|
+
var $1a9931980e271aa3$export$2e2bcd8739ae039 = $1a9931980e271aa3$export$bc8133b69ff660a2;
|
|
310
376
|
|
|
311
377
|
|
|
312
378
|
|
|
@@ -336,8 +402,8 @@ var $a73c18d97634a8ff$export$2e2bcd8739ae039 = $a73c18d97634a8ff$var$useMergedRe
|
|
|
336
402
|
|
|
337
403
|
|
|
338
404
|
|
|
339
|
-
const $
|
|
340
|
-
const videoTrack = (0, $
|
|
405
|
+
const $0f97689637ada1d8$export$85974db6d0cc43b3 = /*#__PURE__*/ (0, $5Zyvw$react.forwardRef)(function VoiceClientVideo({ participant: participant = "local", fit: fit = "contain", mirror: mirror, onResize: onResize, style: style = {}, trackType: trackType = "video", ...props }, ref) {
|
|
406
|
+
const videoTrack = (0, $630203d8dad1dd45$export$9813dcd2d0c26814)(trackType, participant);
|
|
341
407
|
const videoEl = (0, $5Zyvw$react.useRef)(null);
|
|
342
408
|
const videoRef = (0, $a73c18d97634a8ff$export$2e2bcd8739ae039)(videoEl, ref);
|
|
343
409
|
/**
|
|
@@ -449,43 +515,46 @@ const $c1952f9ddec789e5$export$d090a384943608eb = /*#__PURE__*/ (0, $5Zyvw$react
|
|
|
449
515
|
...props
|
|
450
516
|
});
|
|
451
517
|
});
|
|
452
|
-
$
|
|
453
|
-
|
|
454
|
-
|
|
518
|
+
$0f97689637ada1d8$export$85974db6d0cc43b3.displayName = "PipecatClientVideo";
|
|
455
519
|
|
|
456
520
|
|
|
457
521
|
|
|
458
522
|
|
|
523
|
+
/**
|
|
524
|
+
* Copyright (c) 2024, Daily.
|
|
525
|
+
*
|
|
526
|
+
* SPDX-License-Identifier: BSD-2-Clause
|
|
527
|
+
*/
|
|
459
528
|
|
|
460
529
|
|
|
461
530
|
|
|
462
531
|
|
|
463
532
|
|
|
464
|
-
const $
|
|
465
|
-
const $
|
|
466
|
-
const $
|
|
467
|
-
const $
|
|
468
|
-
const $
|
|
469
|
-
const $
|
|
470
|
-
const $
|
|
471
|
-
const client = (0, $
|
|
472
|
-
const availableCams = (0, $5Zyvw$jotai.useAtomValue)($
|
|
473
|
-
const availableMics = (0, $5Zyvw$jotai.useAtomValue)($
|
|
474
|
-
const availableSpeakers = (0, $5Zyvw$jotai.useAtomValue)($
|
|
475
|
-
const selectedCam = (0, $5Zyvw$jotai.useAtomValue)($
|
|
476
|
-
const selectedMic = (0, $5Zyvw$jotai.useAtomValue)($
|
|
477
|
-
const selectedSpeaker = (0, $5Zyvw$jotai.useAtomValue)($
|
|
533
|
+
const $9bd3e7d3a9d7acd1$var$availableMicsAtom = (0, $5Zyvw$jotai.atom)([]);
|
|
534
|
+
const $9bd3e7d3a9d7acd1$var$availableCamsAtom = (0, $5Zyvw$jotai.atom)([]);
|
|
535
|
+
const $9bd3e7d3a9d7acd1$var$availableSpeakersAtom = (0, $5Zyvw$jotai.atom)([]);
|
|
536
|
+
const $9bd3e7d3a9d7acd1$var$selectedMicAtom = (0, $5Zyvw$jotai.atom)({});
|
|
537
|
+
const $9bd3e7d3a9d7acd1$var$selectedCamAtom = (0, $5Zyvw$jotai.atom)({});
|
|
538
|
+
const $9bd3e7d3a9d7acd1$var$selectedSpeakerAtom = (0, $5Zyvw$jotai.atom)({});
|
|
539
|
+
const $9bd3e7d3a9d7acd1$export$642bc4d2d2a376f1 = ()=>{
|
|
540
|
+
const client = (0, $172f489fc5d91d99$export$777fa8498be78705)();
|
|
541
|
+
const availableCams = (0, $5Zyvw$jotai.useAtomValue)($9bd3e7d3a9d7acd1$var$availableCamsAtom);
|
|
542
|
+
const availableMics = (0, $5Zyvw$jotai.useAtomValue)($9bd3e7d3a9d7acd1$var$availableMicsAtom);
|
|
543
|
+
const availableSpeakers = (0, $5Zyvw$jotai.useAtomValue)($9bd3e7d3a9d7acd1$var$availableSpeakersAtom);
|
|
544
|
+
const selectedCam = (0, $5Zyvw$jotai.useAtomValue)($9bd3e7d3a9d7acd1$var$selectedCamAtom);
|
|
545
|
+
const selectedMic = (0, $5Zyvw$jotai.useAtomValue)($9bd3e7d3a9d7acd1$var$selectedMicAtom);
|
|
546
|
+
const selectedSpeaker = (0, $5Zyvw$jotai.useAtomValue)($9bd3e7d3a9d7acd1$var$selectedSpeakerAtom);
|
|
478
547
|
const initDevices = (0, $5Zyvw$jotaiutils.useAtomCallback)((0, $5Zyvw$react.useCallback)(async (_get, set)=>{
|
|
479
548
|
if (!client) return;
|
|
480
549
|
const availableCams = await client.getAllCams();
|
|
481
550
|
const availableMics = await client.getAllMics();
|
|
482
551
|
const availableSpeakers = await client.getAllSpeakers();
|
|
483
|
-
set($
|
|
484
|
-
set($
|
|
485
|
-
set($
|
|
486
|
-
set($
|
|
487
|
-
set($
|
|
488
|
-
set($
|
|
552
|
+
set($9bd3e7d3a9d7acd1$var$availableCamsAtom, availableCams);
|
|
553
|
+
set($9bd3e7d3a9d7acd1$var$availableMicsAtom, availableMics);
|
|
554
|
+
set($9bd3e7d3a9d7acd1$var$availableSpeakersAtom, availableSpeakers);
|
|
555
|
+
set($9bd3e7d3a9d7acd1$var$selectedCamAtom, client.selectedCam);
|
|
556
|
+
set($9bd3e7d3a9d7acd1$var$selectedMicAtom, client.selectedMic);
|
|
557
|
+
set($9bd3e7d3a9d7acd1$var$selectedSpeakerAtom, client.selectedSpeaker);
|
|
489
558
|
}, [
|
|
490
559
|
client
|
|
491
560
|
]));
|
|
@@ -495,22 +564,22 @@ const $01bcacdf0a25e20c$export$652c54907b83a48d = ()=>{
|
|
|
495
564
|
initDevices
|
|
496
565
|
]);
|
|
497
566
|
(0, $8a6b68ebf0332682$export$33a6ac53b8f02625)((0, $5Zyvw$pipecataiclientjs.RTVIEvent).AvailableCamsUpdated, (0, $5Zyvw$jotaiutils.useAtomCallback)((0, $5Zyvw$react.useCallback)((_get, set, cams)=>{
|
|
498
|
-
set($
|
|
567
|
+
set($9bd3e7d3a9d7acd1$var$availableCamsAtom, cams);
|
|
499
568
|
}, [])));
|
|
500
569
|
(0, $8a6b68ebf0332682$export$33a6ac53b8f02625)((0, $5Zyvw$pipecataiclientjs.RTVIEvent).AvailableMicsUpdated, (0, $5Zyvw$jotaiutils.useAtomCallback)((0, $5Zyvw$react.useCallback)((_get, set, mics)=>{
|
|
501
|
-
set($
|
|
570
|
+
set($9bd3e7d3a9d7acd1$var$availableMicsAtom, mics);
|
|
502
571
|
}, [])));
|
|
503
572
|
(0, $8a6b68ebf0332682$export$33a6ac53b8f02625)((0, $5Zyvw$pipecataiclientjs.RTVIEvent).AvailableSpeakersUpdated, (0, $5Zyvw$jotaiutils.useAtomCallback)((0, $5Zyvw$react.useCallback)((_get, set, speakers)=>{
|
|
504
|
-
set($
|
|
573
|
+
set($9bd3e7d3a9d7acd1$var$availableSpeakersAtom, speakers);
|
|
505
574
|
}, [])));
|
|
506
575
|
(0, $8a6b68ebf0332682$export$33a6ac53b8f02625)((0, $5Zyvw$pipecataiclientjs.RTVIEvent).CamUpdated, (0, $5Zyvw$jotaiutils.useAtomCallback)((0, $5Zyvw$react.useCallback)((_get, set, cam)=>{
|
|
507
|
-
set($
|
|
576
|
+
set($9bd3e7d3a9d7acd1$var$selectedCamAtom, cam);
|
|
508
577
|
}, [])));
|
|
509
578
|
(0, $8a6b68ebf0332682$export$33a6ac53b8f02625)((0, $5Zyvw$pipecataiclientjs.RTVIEvent).MicUpdated, (0, $5Zyvw$jotaiutils.useAtomCallback)((0, $5Zyvw$react.useCallback)((_get, set, mic)=>{
|
|
510
|
-
set($
|
|
579
|
+
set($9bd3e7d3a9d7acd1$var$selectedMicAtom, mic);
|
|
511
580
|
}, [])));
|
|
512
581
|
(0, $8a6b68ebf0332682$export$33a6ac53b8f02625)((0, $5Zyvw$pipecataiclientjs.RTVIEvent).SpeakerUpdated, (0, $5Zyvw$jotaiutils.useAtomCallback)((0, $5Zyvw$react.useCallback)((_get, set, speaker)=>{
|
|
513
|
-
set($
|
|
582
|
+
set($9bd3e7d3a9d7acd1$var$selectedSpeakerAtom, speaker);
|
|
514
583
|
}, [])));
|
|
515
584
|
const updateCam = (0, $5Zyvw$react.useCallback)((id)=>{
|
|
516
585
|
client?.updateCam(id);
|
|
@@ -543,13 +612,22 @@ const $01bcacdf0a25e20c$export$652c54907b83a48d = ()=>{
|
|
|
543
612
|
|
|
544
613
|
|
|
545
614
|
|
|
615
|
+
/**
|
|
616
|
+
* Copyright (c) 2024, Daily.
|
|
617
|
+
*
|
|
618
|
+
* SPDX-License-Identifier: BSD-2-Clause
|
|
619
|
+
*/
|
|
620
|
+
|
|
621
|
+
const $810478f6ae107062$export$30aee278309a867b = ()=>(0, $5Zyvw$react.useContext)((0, $44c6278d186dd94f$export$db79fdf85ddd6b65));
|
|
622
|
+
|
|
623
|
+
|
|
546
624
|
|
|
547
625
|
|
|
548
626
|
|
|
549
627
|
|
|
550
628
|
const $a1dfa75b13e6bb9b$export$59bf27bd43679db6 = /*#__PURE__*/ (0, ($parcel$interopDefault($5Zyvw$react))).memo(({ backgroundColor: backgroundColor = "transparent", barColor: barColor = "black", barCount: barCount = 5, barGap: barGap = 12, barLineCap: barLineCap = "round", barMaxHeight: barMaxHeight = 120, barOrigin: barOrigin = "center", barWidth: barWidth = 30, participantType: participantType })=>{
|
|
551
629
|
const canvasRef = (0, $5Zyvw$react.useRef)(null);
|
|
552
|
-
const track = (0, $
|
|
630
|
+
const track = (0, $630203d8dad1dd45$export$9813dcd2d0c26814)("audio", participantType);
|
|
553
631
|
(0, $5Zyvw$react.useEffect)(()=>{
|
|
554
632
|
if (!canvasRef.current) return;
|
|
555
633
|
const canvasWidth = barCount * barWidth + (barCount - 1) * barGap;
|