@pipecat-ai/client-react 0.4.0 → 1.0.0
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 +18 -18
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +173 -112
- package/dist/index.js.map +1 -1
- package/dist/index.module.js +165 -104
- 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,132 @@ $parcel$export(module.exports, "VoiceVisualizer", () => $a1dfa75b13e6bb9b$export
|
|
|
48
51
|
|
|
49
52
|
|
|
50
53
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
+
|
|
55
|
+
var $d1f89db81f967f39$exports = {};
|
|
56
|
+
$d1f89db81f967f39$exports = JSON.parse("{\"name\":\"@pipecat-ai/client-react\",\"version\":\"1.0.0\",\"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
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
const $a37ab5d1bcf1d3b2$export$fe23d0ef95286467 = /*#__PURE__*/ (0, $5Zyvw$react.createContext)({
|
|
61
|
+
on: ()=>{},
|
|
62
|
+
off: ()=>{}
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
const $8df0e777e4d7dd49$var$defaultStore = (0, $5Zyvw$jotai.createStore)();
|
|
67
|
+
const $8df0e777e4d7dd49$export$67f6d73bc6cd7bb1 = /*#__PURE__*/ (0, $5Zyvw$react.createContext)({});
|
|
68
|
+
const $8df0e777e4d7dd49$export$bb43666ced7a20d0 = ({ children: children, client: client, jotaiStore: jotaiStore = $8df0e777e4d7dd49$var$defaultStore })=>{
|
|
69
|
+
(0, $5Zyvw$react.useEffect)(()=>{
|
|
70
|
+
(0, $5Zyvw$pipecataiclientjs.setAboutClient)({
|
|
71
|
+
library: (0, $d1f89db81f967f39$exports.name),
|
|
72
|
+
library_version: (0, $d1f89db81f967f39$exports.version)
|
|
73
|
+
});
|
|
74
|
+
}, []);
|
|
75
|
+
const eventHandlersMap = (0, $5Zyvw$react.useRef)({});
|
|
76
|
+
(0, $5Zyvw$react.useEffect)(()=>{
|
|
77
|
+
if (!client) return;
|
|
78
|
+
const allEvents = Object.values((0, $5Zyvw$pipecataiclientjs.RTVIEvent)).filter((value)=>isNaN(Number(value)));
|
|
79
|
+
const allHandlers = {};
|
|
80
|
+
allEvents.forEach((event)=>{
|
|
81
|
+
const handler = (...payload)=>{
|
|
82
|
+
const handlers = eventHandlersMap.current[event];
|
|
83
|
+
if (!handlers) return;
|
|
84
|
+
handlers.forEach((h)=>{
|
|
85
|
+
h(...payload);
|
|
86
|
+
});
|
|
87
|
+
};
|
|
88
|
+
allHandlers[event] = handler;
|
|
89
|
+
client.on(event, handler);
|
|
90
|
+
});
|
|
91
|
+
return ()=>{
|
|
92
|
+
allEvents.forEach((event)=>{
|
|
93
|
+
client.off(event, allHandlers[event]);
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
}, [
|
|
97
|
+
client
|
|
98
|
+
]);
|
|
99
|
+
const on = (0, $5Zyvw$react.useCallback)((event, handler)=>{
|
|
100
|
+
if (!eventHandlersMap.current[event]) eventHandlersMap.current[event] = new Set();
|
|
101
|
+
eventHandlersMap.current[event].add(handler);
|
|
102
|
+
}, []);
|
|
103
|
+
const off = (0, $5Zyvw$react.useCallback)((event, handler)=>{
|
|
104
|
+
eventHandlersMap.current[event]?.delete(handler);
|
|
105
|
+
}, []);
|
|
54
106
|
return (0, $5Zyvw$reactjsxruntime.jsx)((0, $5Zyvw$jotaireact.Provider), {
|
|
55
107
|
store: jotaiStore,
|
|
56
|
-
children: (0, $5Zyvw$reactjsxruntime.jsx)($
|
|
108
|
+
children: (0, $5Zyvw$reactjsxruntime.jsx)($8df0e777e4d7dd49$export$67f6d73bc6cd7bb1.Provider, {
|
|
57
109
|
value: {
|
|
58
110
|
client: client
|
|
59
111
|
},
|
|
60
|
-
children:
|
|
112
|
+
children: (0, $5Zyvw$reactjsxruntime.jsx)((0, $a37ab5d1bcf1d3b2$export$fe23d0ef95286467).Provider, {
|
|
113
|
+
value: {
|
|
114
|
+
on: on,
|
|
115
|
+
off: off
|
|
116
|
+
},
|
|
117
|
+
children: children
|
|
118
|
+
})
|
|
61
119
|
})
|
|
62
120
|
});
|
|
63
121
|
};
|
|
64
|
-
$
|
|
122
|
+
$8df0e777e4d7dd49$export$bb43666ced7a20d0.displayName = "PipecatClientProvider";
|
|
65
123
|
|
|
66
124
|
|
|
67
|
-
const $
|
|
68
|
-
const { client: client } = (0, $5Zyvw$react.useContext)((0, $
|
|
125
|
+
const $172f489fc5d91d99$export$777fa8498be78705 = ()=>{
|
|
126
|
+
const { client: client } = (0, $5Zyvw$react.useContext)((0, $8df0e777e4d7dd49$export$67f6d73bc6cd7bb1));
|
|
69
127
|
return client;
|
|
70
128
|
};
|
|
71
129
|
|
|
72
130
|
|
|
131
|
+
/**
|
|
132
|
+
* Copyright (c) 2024, Daily.
|
|
133
|
+
*
|
|
134
|
+
* SPDX-License-Identifier: BSD-2-Clause
|
|
135
|
+
*/
|
|
136
|
+
|
|
73
137
|
const $8a6b68ebf0332682$export$33a6ac53b8f02625 = (event, handler)=>{
|
|
74
|
-
const
|
|
138
|
+
const { on: on, off: off } = (0, $5Zyvw$react.useContext)((0, $a37ab5d1bcf1d3b2$export$fe23d0ef95286467));
|
|
75
139
|
(0, $5Zyvw$react.useEffect)(()=>{
|
|
76
|
-
|
|
77
|
-
client.on(event, handler);
|
|
140
|
+
on(event, handler);
|
|
78
141
|
return ()=>{
|
|
79
|
-
|
|
142
|
+
off(event, handler);
|
|
80
143
|
};
|
|
81
144
|
}, [
|
|
82
145
|
event,
|
|
83
146
|
handler,
|
|
84
|
-
|
|
147
|
+
on,
|
|
148
|
+
off
|
|
85
149
|
]);
|
|
86
150
|
};
|
|
87
151
|
|
|
88
152
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
const $e5be552b22401c66$var$localAudioTrackAtom = (0, $5Zyvw$jotai.atom)(null);
|
|
100
|
-
const $e5be552b22401c66$var$localVideoTrackAtom = (0, $5Zyvw$jotai.atom)(null);
|
|
101
|
-
const $e5be552b22401c66$var$localScreenAudioTrackAtom = (0, $5Zyvw$jotai.atom)(null);
|
|
102
|
-
const $e5be552b22401c66$var$localScreenVideoTrackAtom = (0, $5Zyvw$jotai.atom)(null);
|
|
103
|
-
const $e5be552b22401c66$var$botAudioTrackAtom = (0, $5Zyvw$jotai.atom)(null);
|
|
104
|
-
const $e5be552b22401c66$var$botVideoTrackAtom = (0, $5Zyvw$jotai.atom)(null);
|
|
105
|
-
const $e5be552b22401c66$var$trackAtom = (0, $5Zyvw$jotaiutils.atomFamily)(({ local: local, trackType: trackType })=>{
|
|
153
|
+
const $630203d8dad1dd45$var$localAudioTrackAtom = (0, $5Zyvw$jotai.atom)(null);
|
|
154
|
+
const $630203d8dad1dd45$var$localVideoTrackAtom = (0, $5Zyvw$jotai.atom)(null);
|
|
155
|
+
const $630203d8dad1dd45$var$localScreenAudioTrackAtom = (0, $5Zyvw$jotai.atom)(null);
|
|
156
|
+
const $630203d8dad1dd45$var$localScreenVideoTrackAtom = (0, $5Zyvw$jotai.atom)(null);
|
|
157
|
+
const $630203d8dad1dd45$var$botAudioTrackAtom = (0, $5Zyvw$jotai.atom)(null);
|
|
158
|
+
const $630203d8dad1dd45$var$botVideoTrackAtom = (0, $5Zyvw$jotai.atom)(null);
|
|
159
|
+
const $630203d8dad1dd45$var$trackAtom = (0, $5Zyvw$jotaiutils.atomFamily)(({ local: local, trackType: trackType })=>{
|
|
106
160
|
if (local) switch(trackType){
|
|
107
161
|
case "audio":
|
|
108
|
-
return $
|
|
162
|
+
return $630203d8dad1dd45$var$localAudioTrackAtom;
|
|
109
163
|
case "screenAudio":
|
|
110
|
-
return $
|
|
164
|
+
return $630203d8dad1dd45$var$localScreenAudioTrackAtom;
|
|
111
165
|
case "screenVideo":
|
|
112
|
-
return $
|
|
166
|
+
return $630203d8dad1dd45$var$localScreenVideoTrackAtom;
|
|
113
167
|
case "video":
|
|
114
|
-
return $
|
|
168
|
+
return $630203d8dad1dd45$var$localVideoTrackAtom;
|
|
115
169
|
}
|
|
116
|
-
return trackType === "audio" ? $
|
|
170
|
+
return trackType === "audio" ? $630203d8dad1dd45$var$botAudioTrackAtom : $630203d8dad1dd45$var$botVideoTrackAtom;
|
|
117
171
|
});
|
|
118
|
-
const $
|
|
119
|
-
const client = (0, $
|
|
120
|
-
const track = (0, $5Zyvw$jotai.useAtomValue)($
|
|
172
|
+
const $630203d8dad1dd45$export$9813dcd2d0c26814 = (trackType, participantType)=>{
|
|
173
|
+
const client = (0, $172f489fc5d91d99$export$777fa8498be78705)();
|
|
174
|
+
const track = (0, $5Zyvw$jotai.useAtomValue)($630203d8dad1dd45$var$trackAtom({
|
|
121
175
|
local: participantType === "local",
|
|
122
176
|
trackType: trackType
|
|
123
177
|
}));
|
|
124
178
|
const updateTrack = (0, $5Zyvw$jotaiutils.useAtomCallback)((0, $5Zyvw$react.useCallback)((get, set, track, trackType, local)=>{
|
|
125
|
-
const atom = $
|
|
179
|
+
const atom = $630203d8dad1dd45$var$trackAtom({
|
|
126
180
|
local: local,
|
|
127
181
|
trackType: trackType
|
|
128
182
|
});
|
|
@@ -157,9 +211,10 @@ const $e5be552b22401c66$export$7c03381e0d26a6c3 = (trackType, participantType)=>
|
|
|
157
211
|
};
|
|
158
212
|
|
|
159
213
|
|
|
160
|
-
|
|
214
|
+
|
|
215
|
+
const $a2a1c5f475114d56$export$b52250cb73ff4de1 = ()=>{
|
|
161
216
|
const botAudioRef = (0, $5Zyvw$react.useRef)(null);
|
|
162
|
-
const botAudioTrack = (0, $
|
|
217
|
+
const botAudioTrack = (0, $630203d8dad1dd45$export$9813dcd2d0c26814)("audio", "bot");
|
|
163
218
|
(0, $5Zyvw$react.useEffect)(()=>{
|
|
164
219
|
if (!botAudioRef.current || !botAudioTrack) return;
|
|
165
220
|
if (botAudioRef.current.srcObject) {
|
|
@@ -184,22 +239,39 @@ const $e6a9aa6ceb34e585$export$ba1245f7cbf3ae02 = ()=>{
|
|
|
184
239
|
})
|
|
185
240
|
});
|
|
186
241
|
};
|
|
187
|
-
$
|
|
242
|
+
$a2a1c5f475114d56$export$b52250cb73ff4de1.displayName = "PipecatClientAudio";
|
|
188
243
|
|
|
189
244
|
|
|
190
245
|
|
|
191
246
|
|
|
192
247
|
|
|
193
248
|
|
|
194
|
-
|
|
195
|
-
|
|
249
|
+
/**
|
|
250
|
+
* Copyright (c) 2024, Daily.
|
|
251
|
+
*
|
|
252
|
+
* SPDX-License-Identifier: BSD-2-Clause
|
|
253
|
+
*/
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
const $810478f6ae107062$var$transportStateAtom = (0, $5Zyvw$jotai.atom)("disconnected");
|
|
257
|
+
const $810478f6ae107062$export$30aee278309a867b = ()=>{
|
|
258
|
+
const [transportState, setTransportState] = (0, $5Zyvw$jotai.useAtom)($810478f6ae107062$var$transportStateAtom);
|
|
259
|
+
(0, $8a6b68ebf0332682$export$33a6ac53b8f02625)((0, $5Zyvw$pipecataiclientjs.RTVIEvent).TransportStateChanged, setTransportState);
|
|
260
|
+
return transportState;
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
const $d9b24817de62910a$export$3ea2601427f0430f = ()=>{
|
|
265
|
+
const client = (0, $172f489fc5d91d99$export$777fa8498be78705)();
|
|
196
266
|
const [isCamEnabled, setIsCamEnabled] = (0, $5Zyvw$react.useState)(client?.isCamEnabled ?? false);
|
|
267
|
+
const transportState = (0, $810478f6ae107062$export$30aee278309a867b)();
|
|
197
268
|
// Sync component state with client state initially
|
|
198
269
|
(0, $5Zyvw$react.useEffect)(()=>{
|
|
199
|
-
if (!client) return;
|
|
270
|
+
if (!client || transportState !== "initialized" || typeof client.isCamEnabled !== "boolean") return;
|
|
200
271
|
setIsCamEnabled(client.isCamEnabled);
|
|
201
272
|
}, [
|
|
202
|
-
client
|
|
273
|
+
client,
|
|
274
|
+
transportState
|
|
203
275
|
]);
|
|
204
276
|
const enableCam = (0, $5Zyvw$react.useCallback)((enabled)=>{
|
|
205
277
|
setIsCamEnabled(enabled);
|
|
@@ -214,8 +286,8 @@ const $affd351738e2f16c$export$46099a7ec2fe8ac5 = ()=>{
|
|
|
214
286
|
};
|
|
215
287
|
|
|
216
288
|
|
|
217
|
-
const $
|
|
218
|
-
const { isCamEnabled: isCamEnabled, enableCam: enableCam } = (0, $
|
|
289
|
+
const $666ceba11158b494$export$dc9a029eeca8213f = ({ onCamEnabledChanged: onCamEnabledChanged, disabled: disabled = false, children: children })=>{
|
|
290
|
+
const { isCamEnabled: isCamEnabled, enableCam: enableCam } = (0, $d9b24817de62910a$export$3ea2601427f0430f)();
|
|
219
291
|
const handleToggleCam = (0, $5Zyvw$react.useCallback)(()=>{
|
|
220
292
|
if (disabled) return;
|
|
221
293
|
const newEnabledState = !isCamEnabled;
|
|
@@ -235,22 +307,25 @@ const $e7a27a30474b270e$export$156c26e16246ae3e = ({ onCamEnabledChanged: onCamE
|
|
|
235
307
|
})
|
|
236
308
|
});
|
|
237
309
|
};
|
|
238
|
-
var $
|
|
310
|
+
var $666ceba11158b494$export$2e2bcd8739ae039 = $666ceba11158b494$export$dc9a029eeca8213f;
|
|
311
|
+
|
|
239
312
|
|
|
240
313
|
|
|
241
314
|
|
|
242
315
|
|
|
243
316
|
|
|
244
317
|
|
|
245
|
-
const $
|
|
246
|
-
const client = (0, $
|
|
318
|
+
const $4af0eba414c586fd$export$388e706586309ef0 = ()=>{
|
|
319
|
+
const client = (0, $172f489fc5d91d99$export$777fa8498be78705)();
|
|
247
320
|
const [isMicEnabled, setIsMicEnabled] = (0, $5Zyvw$react.useState)(client?.isMicEnabled ?? false);
|
|
321
|
+
const transportState = (0, $810478f6ae107062$export$30aee278309a867b)();
|
|
248
322
|
// Sync component state with client state initially
|
|
249
323
|
(0, $5Zyvw$react.useEffect)(()=>{
|
|
250
|
-
if (!client) return;
|
|
324
|
+
if (!client || transportState !== "initialized" || typeof client.isMicEnabled !== "boolean") return;
|
|
251
325
|
setIsMicEnabled(client.isMicEnabled);
|
|
252
326
|
}, [
|
|
253
|
-
client
|
|
327
|
+
client,
|
|
328
|
+
transportState
|
|
254
329
|
]);
|
|
255
330
|
const enableMic = (0, $5Zyvw$react.useCallback)((enabled)=>{
|
|
256
331
|
setIsMicEnabled(enabled);
|
|
@@ -265,8 +340,8 @@ const $b5946020fafb75c5$export$805915964ad7bc25 = ()=>{
|
|
|
265
340
|
};
|
|
266
341
|
|
|
267
342
|
|
|
268
|
-
const $
|
|
269
|
-
const { enableMic: enableMic, isMicEnabled: isMicEnabled } = (0, $
|
|
343
|
+
const $1a9931980e271aa3$export$bc8133b69ff660a2 = ({ onMicEnabledChanged: onMicEnabledChanged, disabled: disabled = false, children: children })=>{
|
|
344
|
+
const { enableMic: enableMic, isMicEnabled: isMicEnabled } = (0, $4af0eba414c586fd$export$388e706586309ef0)();
|
|
270
345
|
const handleToggleMic = (0, $5Zyvw$react.useCallback)(()=>{
|
|
271
346
|
if (disabled) return;
|
|
272
347
|
const newEnabledState = !isMicEnabled;
|
|
@@ -286,7 +361,7 @@ const $8a175691955798a2$export$bf1c2c9ca877628d = ({ onMicEnabledChanged: onMicE
|
|
|
286
361
|
})
|
|
287
362
|
});
|
|
288
363
|
};
|
|
289
|
-
var $
|
|
364
|
+
var $1a9931980e271aa3$export$2e2bcd8739ae039 = $1a9931980e271aa3$export$bc8133b69ff660a2;
|
|
290
365
|
|
|
291
366
|
|
|
292
367
|
|
|
@@ -316,8 +391,8 @@ var $a73c18d97634a8ff$export$2e2bcd8739ae039 = $a73c18d97634a8ff$var$useMergedRe
|
|
|
316
391
|
|
|
317
392
|
|
|
318
393
|
|
|
319
|
-
const $
|
|
320
|
-
const videoTrack = (0, $
|
|
394
|
+
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) {
|
|
395
|
+
const videoTrack = (0, $630203d8dad1dd45$export$9813dcd2d0c26814)(trackType, participant);
|
|
321
396
|
const videoEl = (0, $5Zyvw$react.useRef)(null);
|
|
322
397
|
const videoRef = (0, $a73c18d97634a8ff$export$2e2bcd8739ae039)(videoEl, ref);
|
|
323
398
|
/**
|
|
@@ -429,7 +504,7 @@ const $c1952f9ddec789e5$export$d090a384943608eb = /*#__PURE__*/ (0, $5Zyvw$react
|
|
|
429
504
|
...props
|
|
430
505
|
});
|
|
431
506
|
});
|
|
432
|
-
$
|
|
507
|
+
$0f97689637ada1d8$export$85974db6d0cc43b3.displayName = "PipecatClientVideo";
|
|
433
508
|
|
|
434
509
|
|
|
435
510
|
|
|
@@ -440,32 +515,31 @@ $c1952f9ddec789e5$export$d090a384943608eb.displayName = "RTVIClientVideo";
|
|
|
440
515
|
|
|
441
516
|
|
|
442
517
|
|
|
443
|
-
|
|
444
|
-
const $
|
|
445
|
-
const $
|
|
446
|
-
const $
|
|
447
|
-
const $
|
|
448
|
-
const $
|
|
449
|
-
const $
|
|
450
|
-
const $
|
|
451
|
-
const
|
|
452
|
-
const
|
|
453
|
-
const
|
|
454
|
-
const
|
|
455
|
-
const
|
|
456
|
-
const
|
|
457
|
-
const selectedSpeaker = (0, $5Zyvw$jotai.useAtomValue)($01bcacdf0a25e20c$var$selectedSpeakerAtom);
|
|
518
|
+
const $9bd3e7d3a9d7acd1$var$availableMicsAtom = (0, $5Zyvw$jotai.atom)([]);
|
|
519
|
+
const $9bd3e7d3a9d7acd1$var$availableCamsAtom = (0, $5Zyvw$jotai.atom)([]);
|
|
520
|
+
const $9bd3e7d3a9d7acd1$var$availableSpeakersAtom = (0, $5Zyvw$jotai.atom)([]);
|
|
521
|
+
const $9bd3e7d3a9d7acd1$var$selectedMicAtom = (0, $5Zyvw$jotai.atom)({});
|
|
522
|
+
const $9bd3e7d3a9d7acd1$var$selectedCamAtom = (0, $5Zyvw$jotai.atom)({});
|
|
523
|
+
const $9bd3e7d3a9d7acd1$var$selectedSpeakerAtom = (0, $5Zyvw$jotai.atom)({});
|
|
524
|
+
const $9bd3e7d3a9d7acd1$export$642bc4d2d2a376f1 = ()=>{
|
|
525
|
+
const client = (0, $172f489fc5d91d99$export$777fa8498be78705)();
|
|
526
|
+
const availableCams = (0, $5Zyvw$jotai.useAtomValue)($9bd3e7d3a9d7acd1$var$availableCamsAtom);
|
|
527
|
+
const availableMics = (0, $5Zyvw$jotai.useAtomValue)($9bd3e7d3a9d7acd1$var$availableMicsAtom);
|
|
528
|
+
const availableSpeakers = (0, $5Zyvw$jotai.useAtomValue)($9bd3e7d3a9d7acd1$var$availableSpeakersAtom);
|
|
529
|
+
const selectedCam = (0, $5Zyvw$jotai.useAtomValue)($9bd3e7d3a9d7acd1$var$selectedCamAtom);
|
|
530
|
+
const selectedMic = (0, $5Zyvw$jotai.useAtomValue)($9bd3e7d3a9d7acd1$var$selectedMicAtom);
|
|
531
|
+
const selectedSpeaker = (0, $5Zyvw$jotai.useAtomValue)($9bd3e7d3a9d7acd1$var$selectedSpeakerAtom);
|
|
458
532
|
const initDevices = (0, $5Zyvw$jotaiutils.useAtomCallback)((0, $5Zyvw$react.useCallback)(async (_get, set)=>{
|
|
459
533
|
if (!client) return;
|
|
460
534
|
const availableCams = await client.getAllCams();
|
|
461
535
|
const availableMics = await client.getAllMics();
|
|
462
536
|
const availableSpeakers = await client.getAllSpeakers();
|
|
463
|
-
set($
|
|
464
|
-
set($
|
|
465
|
-
set($
|
|
466
|
-
set($
|
|
467
|
-
set($
|
|
468
|
-
set($
|
|
537
|
+
set($9bd3e7d3a9d7acd1$var$availableCamsAtom, availableCams);
|
|
538
|
+
set($9bd3e7d3a9d7acd1$var$availableMicsAtom, availableMics);
|
|
539
|
+
set($9bd3e7d3a9d7acd1$var$availableSpeakersAtom, availableSpeakers);
|
|
540
|
+
set($9bd3e7d3a9d7acd1$var$selectedCamAtom, client.selectedCam);
|
|
541
|
+
set($9bd3e7d3a9d7acd1$var$selectedMicAtom, client.selectedMic);
|
|
542
|
+
set($9bd3e7d3a9d7acd1$var$selectedSpeakerAtom, client.selectedSpeaker);
|
|
469
543
|
}, [
|
|
470
544
|
client
|
|
471
545
|
]));
|
|
@@ -475,22 +549,22 @@ const $01bcacdf0a25e20c$export$652c54907b83a48d = ()=>{
|
|
|
475
549
|
initDevices
|
|
476
550
|
]);
|
|
477
551
|
(0, $8a6b68ebf0332682$export$33a6ac53b8f02625)((0, $5Zyvw$pipecataiclientjs.RTVIEvent).AvailableCamsUpdated, (0, $5Zyvw$jotaiutils.useAtomCallback)((0, $5Zyvw$react.useCallback)((_get, set, cams)=>{
|
|
478
|
-
set($
|
|
552
|
+
set($9bd3e7d3a9d7acd1$var$availableCamsAtom, cams);
|
|
479
553
|
}, [])));
|
|
480
554
|
(0, $8a6b68ebf0332682$export$33a6ac53b8f02625)((0, $5Zyvw$pipecataiclientjs.RTVIEvent).AvailableMicsUpdated, (0, $5Zyvw$jotaiutils.useAtomCallback)((0, $5Zyvw$react.useCallback)((_get, set, mics)=>{
|
|
481
|
-
set($
|
|
555
|
+
set($9bd3e7d3a9d7acd1$var$availableMicsAtom, mics);
|
|
482
556
|
}, [])));
|
|
483
557
|
(0, $8a6b68ebf0332682$export$33a6ac53b8f02625)((0, $5Zyvw$pipecataiclientjs.RTVIEvent).AvailableSpeakersUpdated, (0, $5Zyvw$jotaiutils.useAtomCallback)((0, $5Zyvw$react.useCallback)((_get, set, speakers)=>{
|
|
484
|
-
set($
|
|
558
|
+
set($9bd3e7d3a9d7acd1$var$availableSpeakersAtom, speakers);
|
|
485
559
|
}, [])));
|
|
486
560
|
(0, $8a6b68ebf0332682$export$33a6ac53b8f02625)((0, $5Zyvw$pipecataiclientjs.RTVIEvent).CamUpdated, (0, $5Zyvw$jotaiutils.useAtomCallback)((0, $5Zyvw$react.useCallback)((_get, set, cam)=>{
|
|
487
|
-
set($
|
|
561
|
+
set($9bd3e7d3a9d7acd1$var$selectedCamAtom, cam);
|
|
488
562
|
}, [])));
|
|
489
563
|
(0, $8a6b68ebf0332682$export$33a6ac53b8f02625)((0, $5Zyvw$pipecataiclientjs.RTVIEvent).MicUpdated, (0, $5Zyvw$jotaiutils.useAtomCallback)((0, $5Zyvw$react.useCallback)((_get, set, mic)=>{
|
|
490
|
-
set($
|
|
564
|
+
set($9bd3e7d3a9d7acd1$var$selectedMicAtom, mic);
|
|
491
565
|
}, [])));
|
|
492
566
|
(0, $8a6b68ebf0332682$export$33a6ac53b8f02625)((0, $5Zyvw$pipecataiclientjs.RTVIEvent).SpeakerUpdated, (0, $5Zyvw$jotaiutils.useAtomCallback)((0, $5Zyvw$react.useCallback)((_get, set, speaker)=>{
|
|
493
|
-
set($
|
|
567
|
+
set($9bd3e7d3a9d7acd1$var$selectedSpeakerAtom, speaker);
|
|
494
568
|
}, [])));
|
|
495
569
|
const updateCam = (0, $5Zyvw$react.useCallback)((id)=>{
|
|
496
570
|
client?.updateCam(id);
|
|
@@ -523,19 +597,6 @@ const $01bcacdf0a25e20c$export$652c54907b83a48d = ()=>{
|
|
|
523
597
|
|
|
524
598
|
|
|
525
599
|
|
|
526
|
-
/**
|
|
527
|
-
* Copyright (c) 2024, Daily.
|
|
528
|
-
*
|
|
529
|
-
* SPDX-License-Identifier: BSD-2-Clause
|
|
530
|
-
*/
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
const $6b6c1a9f794236bd$var$transportStateAtom = (0, $5Zyvw$jotai.atom)("disconnected");
|
|
534
|
-
const $6b6c1a9f794236bd$export$599fa01283bd4ece = ()=>{
|
|
535
|
-
const [transportState, setTransportState] = (0, $5Zyvw$jotai.useAtom)($6b6c1a9f794236bd$var$transportStateAtom);
|
|
536
|
-
(0, $8a6b68ebf0332682$export$33a6ac53b8f02625)((0, $5Zyvw$pipecataiclientjs.RTVIEvent).TransportStateChanged, setTransportState);
|
|
537
|
-
return transportState;
|
|
538
|
-
};
|
|
539
600
|
|
|
540
601
|
|
|
541
602
|
|
|
@@ -543,7 +604,7 @@ const $6b6c1a9f794236bd$export$599fa01283bd4ece = ()=>{
|
|
|
543
604
|
|
|
544
605
|
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 })=>{
|
|
545
606
|
const canvasRef = (0, $5Zyvw$react.useRef)(null);
|
|
546
|
-
const track = (0, $
|
|
607
|
+
const track = (0, $630203d8dad1dd45$export$9813dcd2d0c26814)("audio", participantType);
|
|
547
608
|
(0, $5Zyvw$react.useEffect)(()=>{
|
|
548
609
|
if (!canvasRef.current) return;
|
|
549
610
|
const canvasWidth = barCount * barWidth + (barCount - 1) * barGap;
|