react-select-media-devices-modal 1.1.2 → 1.1.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/dist/react-select-media-devices-modal.mjs +540 -272
- package/dist/react-select-media-devices-modal.umd.js +1 -1
- package/dist/types/SelectMediaDevicesModal/index.d.ts +13 -1
- package/dist/types/SelectMediaDevicesPreviewModal/index.d.ts +16 -1
- package/dist/types/SelectMediaDevicesRecordingModal/index.d.ts +19 -1
- package/dist/types/components/button/index.d.ts +2 -1
- package/dist/types/components/deviceItem/index.d.ts +2 -1
- package/dist/types/components/deviceList/index.d.ts +7 -1
- package/package.json +12 -11
- package/dist/style.css +0 -1
|
@@ -1,336 +1,604 @@
|
|
|
1
|
-
import
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
deviceLists: de,
|
|
6
|
-
buttons: re,
|
|
7
|
-
chancelButton: ue,
|
|
8
|
-
confirmButton: le
|
|
9
|
-
}, W = () => {
|
|
10
|
-
const [i, s] = p([]);
|
|
11
|
-
return [i, () => {
|
|
1
|
+
import c, { useState as f, useEffect as w, useRef as Z, useMemo as K } from "react";
|
|
2
|
+
const y = () => {
|
|
3
|
+
const [g, p] = f([]);
|
|
4
|
+
return [g, () => {
|
|
12
5
|
(async () => {
|
|
13
|
-
const
|
|
14
|
-
|
|
6
|
+
const o = await navigator.mediaDevices.getUserMedia({ audio: !0, video: !0 }), m = await navigator.mediaDevices.enumerateDevices();
|
|
7
|
+
p(m), o.getTracks().forEach((B) => B.stop());
|
|
15
8
|
})();
|
|
16
9
|
}];
|
|
17
|
-
},
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
10
|
+
}, ue = ({ name: g, value: p, style: L }) => /* @__PURE__ */ c.createElement("option", { style: L, value: p }, g), H = ({ devices: g, label: p, selectedDevice: L, style: o, onChange: m }) => {
|
|
11
|
+
if (g === void 0) return /* @__PURE__ */ c.createElement(c.Fragment, null);
|
|
12
|
+
const B = (E) => {
|
|
13
|
+
m(E.target.value);
|
|
14
|
+
}, G = `device-select-${p.toLowerCase().replace(/\s/g, "-")}`, I = {
|
|
15
|
+
deviceList: {
|
|
16
|
+
paddingTop: "8px"
|
|
17
|
+
},
|
|
18
|
+
label: {},
|
|
19
|
+
select: {
|
|
20
|
+
marginTop: "4px",
|
|
21
|
+
borderRadius: "4px",
|
|
22
|
+
height: "32px",
|
|
23
|
+
display: "flex",
|
|
24
|
+
alignItems: "center",
|
|
25
|
+
justifyContent: "right",
|
|
26
|
+
width: "100%"
|
|
27
|
+
},
|
|
28
|
+
deviceItems: {}
|
|
29
|
+
}, A = {
|
|
30
|
+
deviceList: o ? { ...I.deviceList, ...o.deviceList } : I.deviceList,
|
|
31
|
+
label: o ? { ...I.label, ...o.label } : I.label,
|
|
32
|
+
select: o ? { ...I.select, ...o.select } : I.select,
|
|
33
|
+
deviceItems: o ? { ...I.deviceItems, ...o.deviceItems } : I.deviceItems
|
|
34
|
+
};
|
|
35
|
+
return /* @__PURE__ */ c.createElement("div", { style: A.deviceList }, /* @__PURE__ */ c.createElement("label", { style: A.label, htmlFor: G }, p), /* @__PURE__ */ c.createElement("select", { style: A.select, id: G, onChange: B, defaultValue: L == null ? void 0 : L.deviceId }, g.map((E, e) => /* @__PURE__ */ c.createElement(ue, { style: A.deviceItems, value: E.deviceId, name: E.label, key: e }))));
|
|
36
|
+
}, J = ({ children: g, disabled: p, style: L, onClick: o }) => {
|
|
37
|
+
const m = {
|
|
38
|
+
borderRadius: "4px",
|
|
39
|
+
height: "32px",
|
|
40
|
+
paddingLeft: "16px",
|
|
41
|
+
paddingRight: "16px",
|
|
42
|
+
backgroundColor: "white",
|
|
43
|
+
borderWidth: "1px"
|
|
44
|
+
}, B = L ? { ...m, ...L } : m;
|
|
45
|
+
return /* @__PURE__ */ c.createElement("button", { onClick: o, disabled: p, style: B }, g);
|
|
46
|
+
}, ve = ({
|
|
47
|
+
isSelectAudioInput: g = !0,
|
|
48
|
+
isSelectAudioOutput: p = !0,
|
|
49
|
+
isSelectVideoInput: L = !0,
|
|
50
|
+
open: o,
|
|
51
|
+
audioInputDeviceLabel: m = "audio input device",
|
|
52
|
+
audioOutputDeviceLabel: B = "audio output device",
|
|
53
|
+
videoInputDeviceLabel: G = "video input device",
|
|
54
|
+
confirmButtonText: I = "Confirm",
|
|
55
|
+
cancelButtonText: A = "Cancel",
|
|
56
|
+
allowOutsideClick: E = !0,
|
|
57
|
+
style: e,
|
|
58
|
+
onDeviceSelected: i,
|
|
59
|
+
onDeviceSelectCanceled: $
|
|
42
60
|
}) => {
|
|
43
|
-
const [
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
61
|
+
const [k, h] = y(), [V, M] = f(), [W, R] = f(), [x, T] = f(), Q = k.filter((r) => r.kind === "audioinput"), F = k.filter((r) => r.kind === "audiooutput"), j = k.filter((r) => r.kind === "videoinput"), d = {
|
|
62
|
+
background: {
|
|
63
|
+
position: "fixed",
|
|
64
|
+
top: 0,
|
|
65
|
+
left: 0,
|
|
66
|
+
width: "100%",
|
|
67
|
+
height: "100%",
|
|
68
|
+
backgroundColor: "rgba(0, 0, 0, 0.3)",
|
|
69
|
+
display: "flex",
|
|
70
|
+
alignItems: "center",
|
|
71
|
+
justifyContent: "center"
|
|
72
|
+
},
|
|
73
|
+
modal: {
|
|
74
|
+
background: "white",
|
|
75
|
+
padding: "16px",
|
|
76
|
+
borderRadius: "8px",
|
|
77
|
+
minWidth: "270px"
|
|
78
|
+
},
|
|
79
|
+
deviceLists: { display: "grid" },
|
|
80
|
+
audioInputDeviceList: {},
|
|
81
|
+
audioOutputDeviceList: {},
|
|
82
|
+
videoInputDeviceList: {},
|
|
83
|
+
buttons: {
|
|
84
|
+
paddingTop: "16px",
|
|
85
|
+
display: "flex",
|
|
86
|
+
alignItems: "center",
|
|
87
|
+
justifyContent: "right"
|
|
88
|
+
},
|
|
89
|
+
cancelButton: {},
|
|
90
|
+
confirmButton: {
|
|
91
|
+
marginLeft: "4px"
|
|
92
|
+
}
|
|
93
|
+
}, [l, b] = f({
|
|
94
|
+
background: e ? { ...d.background, ...e.background } : d.background,
|
|
95
|
+
modal: e ? { ...d.modal, ...e.modal } : d.modal,
|
|
96
|
+
deviceLists: e ? { ...d.deviceLists, ...e.deviceLists } : d.deviceLists,
|
|
97
|
+
audioInputDeviceList: e ? { ...d.audioInputDeviceList, ...e.audioInputDeviceList } : {},
|
|
98
|
+
audioOutputDeviceList: e ? { ...d.audioOutputDeviceList, ...e.audioOutputDeviceList } : {},
|
|
99
|
+
videoInputDeviceList: e ? { ...d.videoInputDeviceList, ...e.videoInputDeviceList } : {},
|
|
100
|
+
buttons: e ? { ...d.buttons, ...e.buttons } : d.buttons,
|
|
101
|
+
cancelButton: e ? { ...d.cancelButton, ...e.cancelButton } : d.cancelButton,
|
|
102
|
+
confirmButton: e ? { ...d.confirmButton, ...e.confirmButton } : d.confirmButton
|
|
103
|
+
});
|
|
104
|
+
w(() => {
|
|
105
|
+
b({
|
|
106
|
+
background: e ? { ...d.background, ...e.background } : d.background,
|
|
107
|
+
modal: e ? { ...d.modal, ...e.modal } : d.modal,
|
|
108
|
+
deviceLists: e ? { ...d.deviceLists, ...e.deviceLists } : d.deviceLists,
|
|
109
|
+
audioInputDeviceList: e ? { ...d.audioInputDeviceList, ...e.audioInputDeviceList } : {},
|
|
110
|
+
audioOutputDeviceList: e ? { ...d.audioOutputDeviceList, ...e.audioOutputDeviceList } : {},
|
|
111
|
+
videoInputDeviceList: e ? { ...d.videoInputDeviceList, ...e.videoInputDeviceList } : {},
|
|
112
|
+
buttons: e ? { ...d.buttons, ...e.buttons } : d.buttons,
|
|
113
|
+
cancelButton: e ? { ...d.cancelButton, ...e.cancelButton } : d.cancelButton,
|
|
114
|
+
confirmButton: e ? { ...d.confirmButton, ...e.confirmButton } : d.confirmButton
|
|
52
115
|
});
|
|
53
|
-
},
|
|
54
|
-
|
|
55
|
-
},
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
116
|
+
}, [e]), w(() => {
|
|
117
|
+
o ? (navigator.mediaDevices.addEventListener("devicechange", h), h()) : navigator.mediaDevices.removeEventListener("devicechange", h);
|
|
118
|
+
}, [o]);
|
|
119
|
+
const D = () => {
|
|
120
|
+
i({
|
|
121
|
+
audioInput: V !== void 0 ? V : Q[0],
|
|
122
|
+
audioOutput: W !== void 0 ? W : F[0],
|
|
123
|
+
videoInput: x !== void 0 ? x : j[0]
|
|
124
|
+
});
|
|
125
|
+
}, _ = () => {
|
|
126
|
+
$();
|
|
127
|
+
}, n = (r) => {
|
|
128
|
+
M(Q.find((O) => O.deviceId === r));
|
|
129
|
+
}, v = (r) => {
|
|
130
|
+
R(F.find((O) => O.deviceId === r));
|
|
131
|
+
}, U = (r) => {
|
|
132
|
+
T(j.find((O) => O.deviceId === r));
|
|
133
|
+
}, q = () => {
|
|
134
|
+
$();
|
|
63
135
|
};
|
|
64
|
-
return
|
|
136
|
+
return o ? /* @__PURE__ */ c.createElement("div", { style: l.background, ...E ? { onClick: q } : {} }, /* @__PURE__ */ c.createElement(
|
|
65
137
|
"div",
|
|
66
138
|
{
|
|
67
|
-
|
|
68
|
-
...
|
|
69
|
-
onClick: (
|
|
139
|
+
style: l.modal,
|
|
140
|
+
...E ? {
|
|
141
|
+
onClick: (r) => r.stopPropagation()
|
|
70
142
|
} : {}
|
|
71
143
|
},
|
|
72
|
-
/* @__PURE__ */
|
|
73
|
-
|
|
144
|
+
/* @__PURE__ */ c.createElement("div", { style: l.deviceLists }, g && /* @__PURE__ */ c.createElement(
|
|
145
|
+
H,
|
|
74
146
|
{
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
147
|
+
style: l == null ? void 0 : l.audioInputDeviceList,
|
|
148
|
+
label: m,
|
|
149
|
+
devices: Q,
|
|
150
|
+
selectedDevice: V,
|
|
151
|
+
onChange: n
|
|
79
152
|
}
|
|
80
|
-
),
|
|
81
|
-
|
|
153
|
+
), p && /* @__PURE__ */ c.createElement(
|
|
154
|
+
H,
|
|
82
155
|
{
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
156
|
+
style: l == null ? void 0 : l.audioOutputDeviceList,
|
|
157
|
+
label: B,
|
|
158
|
+
devices: F,
|
|
159
|
+
selectedDevice: W,
|
|
160
|
+
onChange: v
|
|
87
161
|
}
|
|
88
|
-
),
|
|
89
|
-
|
|
162
|
+
), L && /* @__PURE__ */ c.createElement(
|
|
163
|
+
H,
|
|
90
164
|
{
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
165
|
+
style: l == null ? void 0 : l.videoInputDeviceList,
|
|
166
|
+
label: G,
|
|
167
|
+
devices: j,
|
|
168
|
+
selectedDevice: x,
|
|
169
|
+
onChange: U
|
|
95
170
|
}
|
|
96
171
|
)),
|
|
97
|
-
/* @__PURE__ */
|
|
98
|
-
)) : /* @__PURE__ */
|
|
99
|
-
},
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
chancelButton: Ie,
|
|
108
|
-
confirmButton: Be
|
|
109
|
-
}, Y = () => {
|
|
110
|
-
const [i, s] = p();
|
|
111
|
-
return V(() => () => {
|
|
112
|
-
i !== void 0 && i.getTracks().forEach((o) => o.stop());
|
|
113
|
-
}, []), [i, (o) => {
|
|
114
|
-
o.kind !== "audiooutput" && (async () => {
|
|
115
|
-
const f = await navigator.mediaDevices.getUserMedia(
|
|
116
|
-
o.kind === "audioinput" ? { video: !1, audio: { deviceId: o.deviceId } } : { video: { deviceId: o.deviceId }, audio: !1 }
|
|
172
|
+
/* @__PURE__ */ c.createElement("div", { style: l.buttons }, /* @__PURE__ */ c.createElement(J, { style: l.cancelButton, onClick: _ }, A), /* @__PURE__ */ c.createElement(J, { style: l.confirmButton, onClick: D }, I))
|
|
173
|
+
)) : /* @__PURE__ */ c.createElement(c.Fragment, null);
|
|
174
|
+
}, P = () => {
|
|
175
|
+
const [g, p] = f();
|
|
176
|
+
return w(() => () => {
|
|
177
|
+
g !== void 0 && g.getTracks().forEach((m) => m.stop());
|
|
178
|
+
}, []), [g, (m) => {
|
|
179
|
+
m.kind !== "audiooutput" && (async () => {
|
|
180
|
+
const B = await navigator.mediaDevices.getUserMedia(
|
|
181
|
+
m.kind === "audioinput" ? { video: !1, audio: { deviceId: m.deviceId } } : { video: { deviceId: m.deviceId }, audio: !1 }
|
|
117
182
|
);
|
|
118
|
-
|
|
183
|
+
p(B);
|
|
119
184
|
})();
|
|
120
185
|
}, () => {
|
|
121
|
-
|
|
186
|
+
g !== void 0 && (g.getTracks().forEach((m) => m.stop()), p(void 0));
|
|
122
187
|
}];
|
|
123
|
-
},
|
|
124
|
-
isSelectAudioInput:
|
|
125
|
-
isSelectAudioOutput:
|
|
126
|
-
isSelectVideoInput:
|
|
127
|
-
open:
|
|
128
|
-
audioInputDeviceLabel:
|
|
129
|
-
audioOutputDeviceLabel:
|
|
130
|
-
videoInputDeviceLabel:
|
|
131
|
-
confirmButtonText:
|
|
132
|
-
cancelButtonText:
|
|
133
|
-
allowOutsideClick:
|
|
134
|
-
|
|
135
|
-
|
|
188
|
+
}, re = ({
|
|
189
|
+
isSelectAudioInput: g = !0,
|
|
190
|
+
isSelectAudioOutput: p = !0,
|
|
191
|
+
isSelectVideoInput: L = !0,
|
|
192
|
+
open: o,
|
|
193
|
+
audioInputDeviceLabel: m = "audio input device",
|
|
194
|
+
audioOutputDeviceLabel: B = "audio output device",
|
|
195
|
+
videoInputDeviceLabel: G = "video input device",
|
|
196
|
+
confirmButtonText: I = "Confirm",
|
|
197
|
+
cancelButtonText: A = "Cancel",
|
|
198
|
+
allowOutsideClick: E = !0,
|
|
199
|
+
style: e,
|
|
200
|
+
onDeviceSelected: i,
|
|
201
|
+
onDeviceSelectCanceled: $
|
|
136
202
|
}) => {
|
|
137
|
-
const [
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
203
|
+
const [k, h] = y(), [V, M] = f(), [W, R] = f(), [x, T] = f(), [Q, F, j] = P(), d = Z(), l = K(() => k.filter((u) => u.kind === "audioinput"), [k]), b = K(() => k.filter((u) => u.kind === "audiooutput"), [k]), D = K(() => k.filter((u) => u.kind === "videoinput"), [k]), _ = matchMedia("(max-width: 640px)"), n = {
|
|
204
|
+
background: {
|
|
205
|
+
position: "fixed",
|
|
206
|
+
top: 0,
|
|
207
|
+
left: 0,
|
|
208
|
+
width: "100%",
|
|
209
|
+
height: "100%",
|
|
210
|
+
backgroundColor: "rgba(0, 0, 0, 0.3)",
|
|
211
|
+
display: "flex",
|
|
212
|
+
alignItems: "center",
|
|
213
|
+
justifyContent: "center"
|
|
214
|
+
},
|
|
215
|
+
modal: {
|
|
216
|
+
background: "white",
|
|
217
|
+
padding: "16px",
|
|
218
|
+
borderRadius: "8px"
|
|
219
|
+
},
|
|
220
|
+
deviceSelectContainer: _.matches ? {
|
|
221
|
+
display: "grid",
|
|
222
|
+
gridTemplateColumns: "100%"
|
|
223
|
+
} : {
|
|
224
|
+
display: "grid",
|
|
225
|
+
gridTemplateColumns: "50% 50%"
|
|
226
|
+
},
|
|
227
|
+
preview: {
|
|
228
|
+
minWidth: "270px",
|
|
229
|
+
minHeight: "180px",
|
|
230
|
+
maxWidth: "270px",
|
|
231
|
+
maxHeight: "180px",
|
|
232
|
+
marginRight: "4px"
|
|
233
|
+
},
|
|
234
|
+
previewVideo: {
|
|
235
|
+
width: "270px",
|
|
236
|
+
height: "180px"
|
|
237
|
+
},
|
|
238
|
+
deviceLists: {
|
|
239
|
+
display: "grid",
|
|
240
|
+
minWidth: "270px",
|
|
241
|
+
marginLeft: "8px"
|
|
242
|
+
},
|
|
243
|
+
audioInputDeviceList: {},
|
|
244
|
+
audioOutputDeviceList: {},
|
|
245
|
+
videoInputDeviceList: {},
|
|
246
|
+
buttons: {
|
|
247
|
+
paddingTop: "16px",
|
|
248
|
+
display: "flex",
|
|
249
|
+
alignItems: "center",
|
|
250
|
+
justifyContent: "right"
|
|
251
|
+
},
|
|
252
|
+
cancelButton: {},
|
|
253
|
+
confirmButton: {
|
|
254
|
+
marginLeft: "4px"
|
|
255
|
+
}
|
|
256
|
+
}, [v, U] = f({
|
|
257
|
+
background: e ? { ...n.background, ...e.background } : n.background,
|
|
258
|
+
modal: e ? { ...n.modal, ...e.modal } : n.modal,
|
|
259
|
+
deviceSelectContainer: e ? { ...n.deviceSelectContainer, ...e.deviceSelectContainer } : n.deviceSelectContainer,
|
|
260
|
+
preview: e ? { ...n.preview, ...e.preview } : n.preview,
|
|
261
|
+
previewVideo: e ? { ...n.previewVideo, ...e.previewVideo } : n.previewVideo,
|
|
262
|
+
deviceLists: e ? { ...n.deviceLists, ...e.deviceLists } : n.deviceLists,
|
|
263
|
+
audioInputDeviceList: e ? { ...n.audioInputDeviceList, ...e.audioInputDeviceList } : n.audioInputDeviceList,
|
|
264
|
+
audioOutputDeviceList: e ? { ...n.audioOutputDeviceList, ...e.audioOutputDeviceList } : n.audioOutputDeviceList,
|
|
265
|
+
videoInputDeviceList: e ? { ...n.videoInputDeviceList, ...e.videoInputDeviceList } : n.videoInputDeviceList,
|
|
266
|
+
buttons: e ? { ...n.buttons, ...e.buttons } : n.buttons,
|
|
267
|
+
cancelButton: e ? { ...n.cancelButton, ...e.cancelButton } : n.cancelButton,
|
|
268
|
+
confirmButton: e ? { ...n.confirmButton, ...e.confirmButton } : n.confirmButton
|
|
269
|
+
});
|
|
270
|
+
w(() => {
|
|
271
|
+
U({
|
|
272
|
+
background: e ? { ...n.background, ...e.background } : n.background,
|
|
273
|
+
modal: e ? { ...n.modal, ...e.modal } : n.modal,
|
|
274
|
+
deviceSelectContainer: e ? { ...n.deviceSelectContainer, ...e.deviceSelectContainer } : n.deviceSelectContainer,
|
|
275
|
+
preview: e ? { ...n.preview, ...e.preview } : n.preview,
|
|
276
|
+
previewVideo: e ? { ...n.previewVideo, ...e.previewVideo } : n.previewVideo,
|
|
277
|
+
deviceLists: e ? { ...n.deviceLists, ...e.deviceLists } : n.deviceLists,
|
|
278
|
+
audioInputDeviceList: e ? { ...n.audioInputDeviceList, ...e.audioInputDeviceList } : n.audioInputDeviceList,
|
|
279
|
+
audioOutputDeviceList: e ? { ...n.audioOutputDeviceList, ...e.audioOutputDeviceList } : n.audioOutputDeviceList,
|
|
280
|
+
videoInputDeviceList: e ? { ...n.videoInputDeviceList, ...e.videoInputDeviceList } : n.videoInputDeviceList,
|
|
281
|
+
buttons: e ? { ...n.buttons, ...e.buttons } : n.buttons,
|
|
282
|
+
cancelButton: e ? { ...n.cancelButton, ...e.cancelButton } : n.cancelButton,
|
|
283
|
+
confirmButton: e ? { ...n.confirmButton, ...e.confirmButton } : n.confirmButton
|
|
284
|
+
});
|
|
285
|
+
}, [e]), w(() => {
|
|
286
|
+
const u = () => {
|
|
287
|
+
_.matches ? U({
|
|
288
|
+
...v,
|
|
289
|
+
deviceSelectContainer: {
|
|
290
|
+
display: "grid",
|
|
291
|
+
gridTemplateColumns: "100%"
|
|
292
|
+
}
|
|
293
|
+
}) : U({
|
|
294
|
+
...v,
|
|
295
|
+
deviceSelectContainer: {
|
|
296
|
+
display: "grid",
|
|
297
|
+
gridTemplateColumns: "50% 50%"
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
};
|
|
301
|
+
return _.addEventListener("change", u), () => {
|
|
302
|
+
_.removeEventListener("change", u);
|
|
303
|
+
};
|
|
304
|
+
}, []), w(() => {
|
|
305
|
+
o ? (navigator.mediaDevices.addEventListener("devicechange", h), h()) : navigator.mediaDevices.removeEventListener("devicechange", h);
|
|
306
|
+
}, [o]), w(() => {
|
|
307
|
+
if (D.length < 1) return;
|
|
308
|
+
const u = D.find((S) => S.deviceId === (x == null ? void 0 : x.deviceId)) ?? D[0];
|
|
309
|
+
F(u);
|
|
310
|
+
}, [D]);
|
|
311
|
+
const q = () => {
|
|
312
|
+
j(), i({
|
|
313
|
+
audioInput: V !== void 0 ? V : l[0],
|
|
314
|
+
audioOutput: W !== void 0 ? W : b[0],
|
|
315
|
+
videoInput: x !== void 0 ? x : D[0]
|
|
151
316
|
});
|
|
152
|
-
},
|
|
153
|
-
|
|
154
|
-
},
|
|
155
|
-
|
|
156
|
-
},
|
|
157
|
-
|
|
158
|
-
},
|
|
159
|
-
const
|
|
160
|
-
|
|
317
|
+
}, r = () => {
|
|
318
|
+
j(), $();
|
|
319
|
+
}, O = (u) => {
|
|
320
|
+
M(l.find((S) => S.deviceId === u));
|
|
321
|
+
}, t = (u) => {
|
|
322
|
+
R(b.find((S) => S.deviceId === u));
|
|
323
|
+
}, s = (u) => {
|
|
324
|
+
const S = D.find((Y) => Y.deviceId === u);
|
|
325
|
+
T(S), F(S);
|
|
161
326
|
};
|
|
162
|
-
|
|
163
|
-
const { current:
|
|
164
|
-
|
|
165
|
-
}, [
|
|
327
|
+
w(() => {
|
|
328
|
+
const { current: u } = d;
|
|
329
|
+
u && (u.srcObject !== null && u.srcObject instanceof MediaStream && (u.srcObject.getTracks().forEach((S) => S.stop()), u.pause()), u.srcObject = Q, u.play());
|
|
330
|
+
}, [Q]);
|
|
166
331
|
const N = () => {
|
|
167
|
-
|
|
332
|
+
j(), $();
|
|
168
333
|
};
|
|
169
|
-
return
|
|
334
|
+
return o ? /* @__PURE__ */ c.createElement("div", { style: v.background, ...E ? { onClick: N } : {} }, /* @__PURE__ */ c.createElement(
|
|
170
335
|
"div",
|
|
171
336
|
{
|
|
172
|
-
|
|
173
|
-
...
|
|
174
|
-
onClick: (
|
|
337
|
+
style: v.modal,
|
|
338
|
+
...E ? {
|
|
339
|
+
onClick: (u) => u.stopPropagation()
|
|
175
340
|
} : {}
|
|
176
341
|
},
|
|
177
|
-
/* @__PURE__ */
|
|
178
|
-
|
|
342
|
+
/* @__PURE__ */ c.createElement("div", { style: v.deviceSelectContainer }, /* @__PURE__ */ c.createElement("div", { style: v.preview }, /* @__PURE__ */ c.createElement("video", { style: v.previewVideo, ref: d, autoPlay: !0, muted: !0, playsInline: !0 })), /* @__PURE__ */ c.createElement("div", { style: v.deviceLists }, g && /* @__PURE__ */ c.createElement(
|
|
343
|
+
H,
|
|
179
344
|
{
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
345
|
+
style: v.audioInputDeviceList,
|
|
346
|
+
label: m,
|
|
347
|
+
devices: l,
|
|
348
|
+
selectedDevice: V,
|
|
349
|
+
onChange: O
|
|
184
350
|
}
|
|
185
|
-
),
|
|
186
|
-
|
|
351
|
+
), p && /* @__PURE__ */ c.createElement(
|
|
352
|
+
H,
|
|
187
353
|
{
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
354
|
+
style: v == null ? void 0 : v.audioOutputDeviceList,
|
|
355
|
+
label: B,
|
|
356
|
+
devices: b,
|
|
357
|
+
selectedDevice: W,
|
|
358
|
+
onChange: t
|
|
192
359
|
}
|
|
193
|
-
),
|
|
194
|
-
|
|
360
|
+
), L && /* @__PURE__ */ c.createElement(
|
|
361
|
+
H,
|
|
195
362
|
{
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
363
|
+
style: v == null ? void 0 : v.videoInputDeviceList,
|
|
364
|
+
label: G,
|
|
365
|
+
devices: D,
|
|
366
|
+
selectedDevice: x,
|
|
367
|
+
onChange: s
|
|
200
368
|
}
|
|
201
369
|
))),
|
|
202
|
-
/* @__PURE__ */
|
|
203
|
-
)) : /* @__PURE__ */
|
|
204
|
-
},
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
isSelectVideoInput: v = !0,
|
|
220
|
-
open: c,
|
|
221
|
-
audioInputDeviceLabel: o = "audio input device",
|
|
222
|
-
audioOutputDeviceLabel: f = "audio output device",
|
|
223
|
-
videoInputDeviceLabel: k = "video input device",
|
|
224
|
-
confirmButtonText: j = "Confirm",
|
|
225
|
-
cancelButtonText: G = "Cancel",
|
|
226
|
-
recordingButtonText: A = "Recording",
|
|
227
|
-
allowOutsideClick: T = !0,
|
|
228
|
-
onDeviceSelected: y,
|
|
229
|
-
onDeviceSelectCanceled: m
|
|
370
|
+
/* @__PURE__ */ c.createElement("div", { style: v.buttons }, /* @__PURE__ */ c.createElement(J, { style: v.cancelButton, onClick: r }, A), /* @__PURE__ */ c.createElement(J, { style: v.confirmButton, onClick: q }, I))
|
|
371
|
+
)) : /* @__PURE__ */ c.createElement(c.Fragment, null);
|
|
372
|
+
}, se = ({
|
|
373
|
+
isSelectAudioInput: g = !0,
|
|
374
|
+
isSelectAudioOutput: p = !0,
|
|
375
|
+
isSelectVideoInput: L = !0,
|
|
376
|
+
open: o,
|
|
377
|
+
audioInputDeviceLabel: m = "audio input device",
|
|
378
|
+
audioOutputDeviceLabel: B = "audio output device",
|
|
379
|
+
videoInputDeviceLabel: G = "video input device",
|
|
380
|
+
confirmButtonText: I = "Confirm",
|
|
381
|
+
cancelButtonText: A = "Cancel",
|
|
382
|
+
recordingButtonText: E = "Recording",
|
|
383
|
+
allowOutsideClick: e = !0,
|
|
384
|
+
style: i,
|
|
385
|
+
onDeviceSelected: $,
|
|
386
|
+
onDeviceSelectCanceled: k
|
|
230
387
|
}) => {
|
|
231
|
-
const [
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
388
|
+
const [h, V] = y(), [M, W] = f(), [R, x] = f(), [T, Q] = f(), [F, j, d] = P(), l = Z(), b = Z(), [D, _] = f(), [n, v] = f(!1), U = K(() => h.filter((a) => a.kind === "audioinput"), [h]), q = K(() => h.filter((a) => a.kind === "audiooutput"), [h]), r = K(() => h.filter((a) => a.kind === "videoinput"), [h]), O = matchMedia("(max-width: 640px)"), t = {
|
|
389
|
+
background: {
|
|
390
|
+
position: "fixed",
|
|
391
|
+
top: 0,
|
|
392
|
+
left: 0,
|
|
393
|
+
width: "100%",
|
|
394
|
+
height: "100%",
|
|
395
|
+
backgroundColor: "rgba(0, 0, 0, 0.3)",
|
|
396
|
+
display: "flex",
|
|
397
|
+
alignItems: "center",
|
|
398
|
+
justifyContent: "center"
|
|
399
|
+
},
|
|
400
|
+
modal: {
|
|
401
|
+
background: "white",
|
|
402
|
+
padding: "16px",
|
|
403
|
+
borderRadius: "8px"
|
|
404
|
+
},
|
|
405
|
+
deviceSelectContainer: O.matches ? {
|
|
406
|
+
display: "grid",
|
|
407
|
+
gridTemplateColumns: "100%"
|
|
408
|
+
} : {
|
|
409
|
+
display: "grid",
|
|
410
|
+
gridTemplateColumns: "50% 50%"
|
|
411
|
+
},
|
|
412
|
+
preview: {
|
|
413
|
+
minWidth: "270px",
|
|
414
|
+
minHeight: "180px",
|
|
415
|
+
maxWidth: "270px",
|
|
416
|
+
marginRight: "4px"
|
|
417
|
+
},
|
|
418
|
+
previewVideo: {
|
|
419
|
+
width: "270px",
|
|
420
|
+
height: "180px"
|
|
421
|
+
},
|
|
422
|
+
previewAudio: {
|
|
423
|
+
width: "270px"
|
|
424
|
+
},
|
|
425
|
+
deviceLists: {
|
|
426
|
+
display: "grid",
|
|
427
|
+
minWidth: "270px",
|
|
428
|
+
marginLeft: "8px"
|
|
429
|
+
},
|
|
430
|
+
recordingButtons: {},
|
|
431
|
+
recordingButton: {},
|
|
432
|
+
audioInputDeviceList: {},
|
|
433
|
+
audioOutputDeviceList: {},
|
|
434
|
+
videoInputDeviceList: {},
|
|
435
|
+
buttons: {
|
|
436
|
+
paddingTop: "16px",
|
|
437
|
+
display: "flex",
|
|
438
|
+
alignItems: "center",
|
|
439
|
+
justifyContent: "right"
|
|
440
|
+
},
|
|
441
|
+
cancelButton: {},
|
|
442
|
+
confirmButton: {
|
|
443
|
+
marginLeft: "4px"
|
|
444
|
+
}
|
|
445
|
+
}, [s, N] = f({
|
|
446
|
+
background: i ? { ...t.background, ...i.background } : t.background,
|
|
447
|
+
modal: i ? { ...t.modal, ...i.modal } : t.modal,
|
|
448
|
+
deviceSelectContainer: i ? { ...t.deviceSelectContainer, ...i.deviceSelectContainer } : t.deviceSelectContainer,
|
|
449
|
+
preview: i ? { ...t.preview, ...i.preview } : t.preview,
|
|
450
|
+
previewVideo: i ? { ...t.previewVideo, ...i.previewVideo } : t.previewVideo,
|
|
451
|
+
previewAudio: i ? { ...t.previewAudio, ...i.previewAudio } : t.previewAudio,
|
|
452
|
+
deviceLists: i ? { ...t.deviceLists, ...i.deviceLists } : t.deviceLists,
|
|
453
|
+
recordingButtons: i ? { ...t.recordingButtons, ...i.recordingButtons } : t.recordingButtons,
|
|
454
|
+
recordingButton: i ? { ...t.recordingButton, ...i.recordingButton } : t.recordingButton,
|
|
455
|
+
audioInputDeviceList: i ? { ...t.audioInputDeviceList, ...i.audioInputDeviceList } : t.audioInputDeviceList,
|
|
456
|
+
audioOutputDeviceList: i ? { ...t.audioOutputDeviceList, ...i.audioOutputDeviceList } : t.audioOutputDeviceList,
|
|
457
|
+
videoInputDeviceList: i ? { ...t.videoInputDeviceList, ...i.videoInputDeviceList } : t.videoInputDeviceList,
|
|
458
|
+
buttons: i ? { ...t.buttons, ...i.buttons } : t.buttons,
|
|
459
|
+
cancelButton: i ? { ...t.cancelButton, ...i.cancelButton } : t.cancelButton,
|
|
460
|
+
confirmButton: i ? { ...t.confirmButton, ...i.confirmButton } : t.confirmButton
|
|
461
|
+
});
|
|
462
|
+
w(() => {
|
|
463
|
+
N({
|
|
464
|
+
background: i ? { ...t.background, ...i.background } : t.background,
|
|
465
|
+
modal: i ? { ...t.modal, ...i.modal } : t.modal,
|
|
466
|
+
deviceSelectContainer: i ? { ...t.deviceSelectContainer, ...i.deviceSelectContainer } : t.deviceSelectContainer,
|
|
467
|
+
preview: i ? { ...t.preview, ...i.preview } : t.preview,
|
|
468
|
+
previewVideo: i ? { ...t.previewVideo, ...i.previewVideo } : t.previewVideo,
|
|
469
|
+
previewAudio: i ? { ...t.previewAudio, ...i.previewAudio } : t.previewAudio,
|
|
470
|
+
deviceLists: i ? { ...t.deviceLists, ...i.deviceLists } : t.deviceLists,
|
|
471
|
+
recordingButtons: i ? { ...t.recordingButtons, ...i.recordingButtons } : t.recordingButtons,
|
|
472
|
+
recordingButton: i ? { ...t.recordingButton, ...i.recordingButton } : t.recordingButton,
|
|
473
|
+
audioInputDeviceList: i ? { ...t.audioInputDeviceList, ...i.audioInputDeviceList } : t.audioInputDeviceList,
|
|
474
|
+
audioOutputDeviceList: i ? { ...t.audioOutputDeviceList, ...i.audioOutputDeviceList } : t.audioOutputDeviceList,
|
|
475
|
+
videoInputDeviceList: i ? { ...t.videoInputDeviceList, ...i.videoInputDeviceList } : t.videoInputDeviceList,
|
|
476
|
+
buttons: i ? { ...t.buttons, ...i.buttons } : t.buttons,
|
|
477
|
+
cancelButton: i ? { ...t.cancelButton, ...i.cancelButton } : t.cancelButton,
|
|
478
|
+
confirmButton: i ? { ...t.confirmButton, ...i.confirmButton } : t.confirmButton
|
|
479
|
+
});
|
|
480
|
+
}, [i]), w(() => {
|
|
481
|
+
const a = () => {
|
|
482
|
+
O.matches ? N({
|
|
483
|
+
...s,
|
|
484
|
+
deviceSelectContainer: {
|
|
485
|
+
display: "grid",
|
|
486
|
+
gridTemplateColumns: "100%"
|
|
487
|
+
}
|
|
488
|
+
}) : N({
|
|
489
|
+
...s,
|
|
490
|
+
deviceSelectContainer: {
|
|
491
|
+
display: "grid",
|
|
492
|
+
gridTemplateColumns: "50% 50%"
|
|
493
|
+
}
|
|
494
|
+
});
|
|
495
|
+
};
|
|
496
|
+
return O.addEventListener("change", a), () => {
|
|
497
|
+
O.removeEventListener("change", a);
|
|
498
|
+
};
|
|
499
|
+
}, []), w(() => {
|
|
500
|
+
o ? (navigator.mediaDevices.addEventListener("devicechange", V), V()) : navigator.mediaDevices.removeEventListener("devicechange", V);
|
|
501
|
+
}, [o]), w(() => {
|
|
502
|
+
if (r.length < 1) return;
|
|
503
|
+
const a = r.find((C) => C.deviceId === (T == null ? void 0 : T.deviceId)) ?? r[0];
|
|
504
|
+
j(a);
|
|
505
|
+
}, [r]);
|
|
506
|
+
const u = () => {
|
|
507
|
+
!D || !b || (D.state === "recording" && (D.removeEventListener("dataavailable", () => {
|
|
508
|
+
}), D.removeEventListener("stop", () => {
|
|
509
|
+
}), D.stop(), D.stream.getTracks().forEach((a) => a.stop())), b.current.src = "", b.current.pause(), d());
|
|
510
|
+
}, S = () => {
|
|
511
|
+
u(), $({
|
|
512
|
+
audioInput: M !== void 0 ? M : U[0],
|
|
513
|
+
audioOutput: R !== void 0 ? R : q[0],
|
|
514
|
+
videoInput: T !== void 0 ? T : r[0]
|
|
249
515
|
});
|
|
250
|
-
},
|
|
251
|
-
|
|
252
|
-
},
|
|
253
|
-
|
|
254
|
-
},
|
|
255
|
-
|
|
256
|
-
}, te = (
|
|
257
|
-
const
|
|
258
|
-
|
|
516
|
+
}, Y = () => {
|
|
517
|
+
u(), k();
|
|
518
|
+
}, ee = (a) => {
|
|
519
|
+
W(U.find((C) => C.deviceId === a));
|
|
520
|
+
}, ie = async (a) => {
|
|
521
|
+
x(q.find((C) => C.deviceId === a)), await b.current.setSinkId(a);
|
|
522
|
+
}, te = (a) => {
|
|
523
|
+
const C = r.find((z) => z.deviceId === a);
|
|
524
|
+
Q(C), j(C);
|
|
259
525
|
}, ne = async () => {
|
|
260
|
-
const
|
|
261
|
-
audio:
|
|
262
|
-
deviceId:
|
|
526
|
+
const a = await navigator.mediaDevices.getUserMedia({
|
|
527
|
+
audio: M && M.deviceId !== "" ? {
|
|
528
|
+
deviceId: M.deviceId
|
|
263
529
|
} : !0,
|
|
264
530
|
video: !1
|
|
265
531
|
});
|
|
266
|
-
let
|
|
267
|
-
const
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
}),
|
|
271
|
-
if (
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
R.stop(), t.getTracks().forEach((J) => J.stop());
|
|
532
|
+
let C = [];
|
|
533
|
+
const z = new MediaRecorder(a);
|
|
534
|
+
z.addEventListener("dataavailable", (X) => {
|
|
535
|
+
C.push(X.data);
|
|
536
|
+
}), z.addEventListener("stop", async (X) => {
|
|
537
|
+
if (v(!1), !b.current) return;
|
|
538
|
+
const de = new Blob(C, { type: "audio/ogg; codecs=opus" });
|
|
539
|
+
C = [];
|
|
540
|
+
const ae = URL.createObjectURL(de);
|
|
541
|
+
b.current.src = ae, R && R.deviceId !== "" && await b.current.setSinkId(R.deviceId);
|
|
542
|
+
}), z.start(), _(z), v(!0), setTimeout(() => {
|
|
543
|
+
z.stop(), a.getTracks().forEach((X) => X.stop());
|
|
279
544
|
}, 5e3);
|
|
280
545
|
};
|
|
281
|
-
|
|
282
|
-
const { current:
|
|
283
|
-
|
|
284
|
-
}, [
|
|
285
|
-
const
|
|
286
|
-
|
|
546
|
+
w(() => {
|
|
547
|
+
const { current: a } = l;
|
|
548
|
+
a && (a.srcObject !== null && a.srcObject instanceof MediaStream && (a.srcObject.getTracks().forEach((C) => C.stop()), a.pause()), a.srcObject = F, a.play());
|
|
549
|
+
}, [F]);
|
|
550
|
+
const ce = () => {
|
|
551
|
+
u(), k();
|
|
287
552
|
};
|
|
288
|
-
return
|
|
553
|
+
return o ? /* @__PURE__ */ c.createElement("div", { style: s.background, ...e ? { onClick: ce } : {} }, /* @__PURE__ */ c.createElement(
|
|
289
554
|
"div",
|
|
290
555
|
{
|
|
291
|
-
|
|
292
|
-
...
|
|
293
|
-
onClick: (
|
|
556
|
+
style: s.modal,
|
|
557
|
+
...e ? {
|
|
558
|
+
onClick: (a) => a.stopPropagation()
|
|
294
559
|
} : {}
|
|
295
560
|
},
|
|
296
|
-
/* @__PURE__ */
|
|
297
|
-
|
|
561
|
+
/* @__PURE__ */ c.createElement("div", { style: s.deviceSelectContainer }, /* @__PURE__ */ c.createElement("div", { style: s.preview }, /* @__PURE__ */ c.createElement("video", { style: s.previewVideo, ref: l, autoPlay: !0, muted: !0, playsInline: !0 }), /* @__PURE__ */ c.createElement("audio", { style: s.previewAudio, ref: b, autoPlay: !0, playsInline: !0, controls: !0 })), /* @__PURE__ */ c.createElement("div", { style: s.deviceLists }, g && /* @__PURE__ */ c.createElement(c.Fragment, null, /* @__PURE__ */ c.createElement(
|
|
562
|
+
H,
|
|
298
563
|
{
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
564
|
+
style: s.audioInputDeviceList,
|
|
565
|
+
label: m,
|
|
566
|
+
devices: U,
|
|
567
|
+
selectedDevice: M,
|
|
568
|
+
onChange: ee
|
|
303
569
|
}
|
|
304
|
-
), /* @__PURE__ */
|
|
305
|
-
|
|
570
|
+
), /* @__PURE__ */ c.createElement("div", { style: s.recordingButtons }, /* @__PURE__ */ c.createElement(
|
|
571
|
+
J,
|
|
306
572
|
{
|
|
307
|
-
|
|
573
|
+
style: s.recordingButton,
|
|
308
574
|
onClick: ne,
|
|
309
|
-
disabled:
|
|
575
|
+
disabled: n
|
|
310
576
|
},
|
|
311
|
-
|
|
312
|
-
))),
|
|
313
|
-
|
|
577
|
+
E
|
|
578
|
+
))), p && /* @__PURE__ */ c.createElement(
|
|
579
|
+
H,
|
|
314
580
|
{
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
581
|
+
style: s == null ? void 0 : s.audioOutputDeviceList,
|
|
582
|
+
label: B,
|
|
583
|
+
devices: q,
|
|
584
|
+
selectedDevice: R,
|
|
585
|
+
onChange: ie
|
|
319
586
|
}
|
|
320
|
-
),
|
|
321
|
-
|
|
587
|
+
), L && /* @__PURE__ */ c.createElement(
|
|
588
|
+
H,
|
|
322
589
|
{
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
590
|
+
style: s == null ? void 0 : s.videoInputDeviceList,
|
|
591
|
+
label: G,
|
|
592
|
+
devices: r,
|
|
593
|
+
selectedDevice: T,
|
|
326
594
|
onChange: te
|
|
327
595
|
}
|
|
328
596
|
))),
|
|
329
|
-
/* @__PURE__ */
|
|
330
|
-
)) : /* @__PURE__ */
|
|
597
|
+
/* @__PURE__ */ c.createElement("div", { style: s.buttons }, /* @__PURE__ */ c.createElement(J, { style: s.cancelButton, onClick: Y }, A), /* @__PURE__ */ c.createElement(J, { style: s.confirmButton, onClick: S }, I))
|
|
598
|
+
)) : /* @__PURE__ */ c.createElement(c.Fragment, null);
|
|
331
599
|
};
|
|
332
600
|
export {
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
601
|
+
ve as SelectMediaDevicesModal,
|
|
602
|
+
re as SelectMediaDevicesPreviewModal,
|
|
603
|
+
se as SelectMediaDevicesRecordingModal
|
|
336
604
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(S,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],e):(S=typeof globalThis<"u"?globalThis:S||self,e(S.ReactSelectMediaDevicesModal={},S.React))})(this,function(S,e){"use strict";const T={background:"_background_1djbv_1",modal:"_modal_1djbv_13",deviceLists:"_deviceLists_1djbv_20",buttons:"_buttons_1djbv_24",chancelButton:"_chancelButton_1djbv_31",confirmButton:"_confirmButton_1djbv_33"},J=()=>{const[n,d]=e.useState([]);return[n,()=>{(async()=>{const o=await navigator.mediaDevices.getUserMedia({audio:!0,video:!0}),c=await navigator.mediaDevices.enumerateDevices();d(c),o.getTracks().forEach(p=>p.stop())})()}]},X=({name:n,value:d})=>e.createElement("option",{value:d},n),Q={deviceList:"_deviceList_1bfq1_1",select:"_select_1bfq1_5"},B=({devices:n,label:d,selectedDevice:v,onChange:o})=>{if(n===void 0)return e.createElement(e.Fragment,null);const c=E=>{o(E.target.value)},p=`device-select-${d.toLowerCase().replace(/\s/g,"-")}`;return e.createElement("div",{className:Q.deviceList},e.createElement("label",{htmlFor:p},d),e.createElement("select",{className:Q.select,id:p,onChange:c,defaultValue:v==null?void 0:v.deviceId},n.map((E,y)=>e.createElement(X,{value:E.deviceId,name:E.label,key:y}))))},Y={button:"_button_keu24_1"},V=({className:n,children:d,disabled:v,onClick:o})=>e.createElement("button",{onClick:o,disabled:v,className:[Y.button,n].filter(Boolean).join(" ")},d),Z=({isSelectAudioInput:n=!0,isSelectAudioOutput:d=!0,isSelectVideoInput:v=!0,open:o,audioInputDeviceLabel:c="audio input device",audioOutputDeviceLabel:p="audio output device",videoInputDeviceLabel:E="video input device",confirmButtonText:y="Confirm",cancelButtonText:q="Cancel",allowOutsideClick:j=!0,onDeviceSelected:F,onDeviceSelectCanceled:A})=>{const[m,r]=J(),[b,k]=e.useState(),[L,D]=e.useState(),[g,C]=e.useState(),N=m.filter(s=>s.kind==="audioinput"),$=m.filter(s=>s.kind==="audiooutput"),I=m.filter(s=>s.kind==="videoinput");e.useEffect(()=>{o?(navigator.mediaDevices.addEventListener("devicechange",r),r()):navigator.mediaDevices.removeEventListener("devicechange",r)},[o]);const U=()=>{F({audioInput:b!==void 0?b:N[0],audioOutput:L!==void 0?L:$[0],videoInput:g!==void 0?g:I[0]})},O=()=>{A()},u=s=>{k(N.find(h=>h.deviceId===s))},a=s=>{D($.find(h=>h.deviceId===s))},G=s=>{C(I.find(h=>h.deviceId===s))},x=()=>{A()};return o?e.createElement("div",{className:T.background,...j?{onClick:x}:{}},e.createElement("div",{className:T.modal,...j?{onClick:s=>s.stopPropagation()}:{}},e.createElement("div",{className:T.deviceLists},n&&e.createElement(B,{label:c,devices:N,selectedDevice:b,onChange:u}),d&&e.createElement(B,{label:p,devices:$,selectedDevice:L,onChange:a}),v&&e.createElement(B,{label:E,devices:I,selectedDevice:g,onChange:G})),e.createElement("div",{className:T.buttons},e.createElement(V,{className:T.cancelButton,onClick:O},q),e.createElement(V,{className:T.confirmButton,onClick:U},y)))):e.createElement(e.Fragment,null)},w={background:"_background_kb025_1",modal:"_modal_kb025_13",deviceSelectContainer:"_deviceSelectContainer_kb025_19",preview:"_preview_kb025_31",previewVideo:"_previewVideo_kb025_39",deviceLists:"_deviceLists_kb025_44",buttons:"_buttons_kb025_50",chancelButton:"_chancelButton_kb025_57",confirmButton:"_confirmButton_kb025_59"},W=()=>{const[n,d]=e.useState();return e.useEffect(()=>()=>{n!==void 0&&n.getTracks().forEach(c=>c.stop())},[]),[n,c=>{c.kind!=="audiooutput"&&(async()=>{const p=await navigator.mediaDevices.getUserMedia(c.kind==="audioinput"?{video:!1,audio:{deviceId:c.deviceId}}:{video:{deviceId:c.deviceId},audio:!1});d(p)})()},()=>{n!==void 0&&(n.getTracks().forEach(c=>c.stop()),d(void 0))}]},R=({isSelectAudioInput:n=!0,isSelectAudioOutput:d=!0,isSelectVideoInput:v=!0,open:o,audioInputDeviceLabel:c="audio input device",audioOutputDeviceLabel:p="audio output device",videoInputDeviceLabel:E="video input device",confirmButtonText:y="Confirm",cancelButtonText:q="Cancel",allowOutsideClick:j=!0,onDeviceSelected:F,onDeviceSelectCanceled:A})=>{const[m,r]=J(),[b,k]=e.useState(),[L,D]=e.useState(),[g,C]=e.useState(),[N,$,I]=W(),U=e.useRef(),O=e.useMemo(()=>m.filter(i=>i.kind==="audioinput"),[m]),u=e.useMemo(()=>m.filter(i=>i.kind==="audiooutput"),[m]),a=e.useMemo(()=>m.filter(i=>i.kind==="videoinput"),[m]);e.useEffect(()=>{o?(navigator.mediaDevices.addEventListener("devicechange",r),r()):navigator.mediaDevices.removeEventListener("devicechange",r)},[o]),e.useEffect(()=>{if(a.length<1)return;const i=a.find(_=>_.deviceId===(g==null?void 0:g.deviceId))??a[0];$(i)},[a]);const G=()=>{I(),F({audioInput:b!==void 0?b:O[0],audioOutput:L!==void 0?L:u[0],videoInput:g!==void 0?g:a[0]})},x=()=>{I(),A()},s=i=>{k(O.find(_=>_.deviceId===i))},h=i=>{D(u.find(_=>_.deviceId===i))},z=i=>{const _=a.find(K=>K.deviceId===i);C(_),$(_)};e.useEffect(()=>{const{current:i}=U;i&&(i.srcObject!==null&&i.srcObject instanceof MediaStream&&(i.srcObject.getTracks().forEach(_=>_.stop()),i.pause()),i.srcObject=N,i.play())},[N]);const M=()=>{I(),A()};return o?e.createElement("div",{className:w.background,...j?{onClick:M}:{}},e.createElement("div",{className:w.modal,...j?{onClick:i=>i.stopPropagation()}:{}},e.createElement("div",{className:w.deviceSelectContainer},e.createElement("div",{className:w.preview},e.createElement("video",{className:w.previewVideo,ref:U,autoPlay:!0,muted:!0,playsInline:!0})),e.createElement("div",{className:w.deviceLists},n&&e.createElement(B,{label:c,devices:O,selectedDevice:b,onChange:s}),d&&e.createElement(B,{label:p,devices:u,selectedDevice:L,onChange:h}),v&&e.createElement(B,{label:E,devices:a,selectedDevice:g,onChange:z}))),e.createElement("div",{className:w.buttons},e.createElement(V,{className:w.cancelButton,onClick:x},q),e.createElement(V,{className:w.confirmButton,onClick:G},y)))):e.createElement(e.Fragment,null)},f={background:"_background_1s81f_1",modal:"_modal_1s81f_13",deviceSelectContainer:"_deviceSelectContainer_1s81f_19",preview:"_preview_1s81f_31",previewVideo:"_previewVideo_1s81f_39",previewAudio:"_previewAudio_1s81f_44",deviceLists:"_deviceLists_1s81f_48",buttons:"_buttons_1s81f_54",chancelButton:"_chancelButton_1s81f_61",confirmButton:"_confirmButton_1s81f_63",recordingButton:"_recordingButton_1s81f_67"},ee=({isSelectAudioInput:n=!0,isSelectAudioOutput:d=!0,isSelectVideoInput:v=!0,open:o,audioInputDeviceLabel:c="audio input device",audioOutputDeviceLabel:p="audio output device",videoInputDeviceLabel:E="video input device",confirmButtonText:y="Confirm",cancelButtonText:q="Cancel",recordingButtonText:j="Recording",allowOutsideClick:F=!0,onDeviceSelected:A,onDeviceSelectCanceled:m})=>{const[r,b]=J(),[k,L]=e.useState(),[D,g]=e.useState(),[C,N]=e.useState(),[$,I,U]=W(),O=e.useRef(),u=e.useRef(),[a,G]=e.useState(),[x,s]=e.useState(!1),h=e.useMemo(()=>r.filter(t=>t.kind==="audioinput"),[r]),z=e.useMemo(()=>r.filter(t=>t.kind==="audiooutput"),[r]),M=e.useMemo(()=>r.filter(t=>t.kind==="videoinput"),[r]);e.useEffect(()=>{o?(navigator.mediaDevices.addEventListener("devicechange",b),b()):navigator.mediaDevices.removeEventListener("devicechange",b)},[o]),e.useEffect(()=>{if(M.length<1)return;const t=M.find(l=>l.deviceId===(C==null?void 0:C.deviceId))??M[0];I(t)},[M]);const i=()=>{!a||!u||(a.state==="recording"&&(a.removeEventListener("dataavailable",()=>{}),a.removeEventListener("stop",()=>{}),a.stop(),a.stream.getTracks().forEach(t=>t.stop())),u.current.src="",u.current.pause(),U())},_=()=>{i(),A({audioInput:k!==void 0?k:h[0],audioOutput:D!==void 0?D:z[0],videoInput:C!==void 0?C:M[0]})},K=()=>{i(),m()},te=t=>{L(h.find(l=>l.deviceId===t))},ie=async t=>{g(z.find(l=>l.deviceId===t)),await u.current.setSinkId(t)},ne=t=>{const l=M.find(P=>P.deviceId===t);N(l),I(l)},oe=async()=>{const t=await navigator.mediaDevices.getUserMedia({audio:k&&k.deviceId!==""?{deviceId:k.deviceId}:!0,video:!1});let l=[];const P=new MediaRecorder(t);P.addEventListener("dataavailable",H=>{l.push(H.data)}),P.addEventListener("stop",async H=>{if(s(!1),!u.current)return;const se=new Blob(l,{type:"audio/ogg; codecs=opus"});l=[];const de=URL.createObjectURL(se);u.current.src=de,D&&D.deviceId!==""&&await u.current.setSinkId(D.deviceId)}),P.start(),G(P),s(!0),setTimeout(()=>{P.stop(),t.getTracks().forEach(H=>H.stop())},5e3)};e.useEffect(()=>{const{current:t}=O;t&&(t.srcObject!==null&&t.srcObject instanceof MediaStream&&(t.srcObject.getTracks().forEach(l=>l.stop()),t.pause()),t.srcObject=$,t.play())},[$]);const ce=()=>{i(),m()};return o?e.createElement("div",{className:f.background,...F?{onClick:ce}:{}},e.createElement("div",{className:f.modal,...F?{onClick:t=>t.stopPropagation()}:{}},e.createElement("div",{className:f.deviceSelectContainer},e.createElement("div",{className:f.preview},e.createElement("video",{className:f.previewVideo,ref:O,autoPlay:!0,muted:!0,playsInline:!0}),e.createElement("audio",{className:f.previewAudio,ref:u,autoPlay:!0,playsInline:!0,controls:!0})),e.createElement("div",{className:f.deviceLists},n&&e.createElement(e.Fragment,null,e.createElement(B,{label:c,devices:h,selectedDevice:k,onChange:te}),e.createElement("div",{className:f.buttons},e.createElement(V,{className:f.recordingButton,onClick:oe,disabled:x},j))),d&&e.createElement(B,{label:p,devices:z,selectedDevice:D,onChange:ie}),v&&e.createElement(B,{label:E,devices:M,selectedDevice:C,onChange:ne}))),e.createElement("div",{className:f.buttons},e.createElement(V,{className:f.cancelButton,onClick:K},q),e.createElement(V,{className:f.confirmButton,onClick:_},y)))):e.createElement(e.Fragment,null)};S.SelectMediaDevicesModal=Z,S.SelectMediaDevicesPreviewModal=R,S.SelectMediaDevicesRecordingModal=ee,Object.defineProperty(S,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(j,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],e):(j=typeof globalThis<"u"?globalThis:j||self,e(j.ReactSelectMediaDevicesModal={},j.React))})(this,function(j,e){"use strict";const X=()=>{const[g,f]=e.useState([]);return[g,()=>{(async()=>{const a=await navigator.mediaDevices.getUserMedia({audio:!0,video:!0}),m=await navigator.mediaDevices.enumerateDevices();f(m),a.getTracks().forEach(C=>C.stop())})()}]},y=({name:g,value:f,style:p})=>e.createElement("option",{style:p,value:f},g),W=({devices:g,label:f,selectedDevice:p,style:a,onChange:m})=>{if(g===void 0)return e.createElement(e.Fragment,null);const C=E=>{m(E.target.value)},G=`device-select-${f.toLowerCase().replace(/\s/g,"-")}`,L={deviceList:{paddingTop:"8px"},label:{},select:{marginTop:"4px",borderRadius:"4px",height:"32px",display:"flex",alignItems:"center",justifyContent:"right",width:"100%"},deviceItems:{}},O={deviceList:a?{...L.deviceList,...a.deviceList}:L.deviceList,label:a?{...L.label,...a.label}:L.label,select:a?{...L.select,...a.select}:L.select,deviceItems:a?{...L.deviceItems,...a.deviceItems}:L.deviceItems};return e.createElement("div",{style:O.deviceList},e.createElement("label",{style:O.label,htmlFor:G},f),e.createElement("select",{style:O.select,id:G,onChange:C,defaultValue:p==null?void 0:p.deviceId},g.map((E,i)=>e.createElement(y,{style:O.deviceItems,value:E.deviceId,name:E.label,key:i}))))},_=({children:g,disabled:f,style:p,onClick:a})=>{const m={borderRadius:"4px",height:"32px",paddingLeft:"16px",paddingRight:"16px",backgroundColor:"white",borderWidth:"1px"},C=p?{...m,...p}:m;return e.createElement("button",{onClick:a,disabled:f,style:C},g)},R=({isSelectAudioInput:g=!0,isSelectAudioOutput:f=!0,isSelectVideoInput:p=!0,open:a,audioInputDeviceLabel:m="audio input device",audioOutputDeviceLabel:C="audio output device",videoInputDeviceLabel:G="video input device",confirmButtonText:L="Confirm",cancelButtonText:O="Cancel",allowOutsideClick:E=!0,style:i,onDeviceSelected:t,onDeviceSelectCanceled:$})=>{const[B,I]=X(),[x,M]=e.useState(),[F,V]=e.useState(),[k,T]=e.useState(),Q=B.filter(r=>r.kind==="audioinput"),U=B.filter(r=>r.kind==="audiooutput"),A=B.filter(r=>r.kind==="videoinput"),c={background:{position:"fixed",top:0,left:0,width:"100%",height:"100%",backgroundColor:"rgba(0, 0, 0, 0.3)",display:"flex",alignItems:"center",justifyContent:"center"},modal:{background:"white",padding:"16px",borderRadius:"8px",minWidth:"270px"},deviceLists:{display:"grid"},audioInputDeviceList:{},audioOutputDeviceList:{},videoInputDeviceList:{},buttons:{paddingTop:"16px",display:"flex",alignItems:"center",justifyContent:"right"},cancelButton:{},confirmButton:{marginLeft:"4px"}},[l,h]=e.useState({background:i?{...c.background,...i.background}:c.background,modal:i?{...c.modal,...i.modal}:c.modal,deviceLists:i?{...c.deviceLists,...i.deviceLists}:c.deviceLists,audioInputDeviceList:i?{...c.audioInputDeviceList,...i.audioInputDeviceList}:{},audioOutputDeviceList:i?{...c.audioOutputDeviceList,...i.audioOutputDeviceList}:{},videoInputDeviceList:i?{...c.videoInputDeviceList,...i.videoInputDeviceList}:{},buttons:i?{...c.buttons,...i.buttons}:c.buttons,cancelButton:i?{...c.cancelButton,...i.cancelButton}:c.cancelButton,confirmButton:i?{...c.confirmButton,...i.confirmButton}:c.confirmButton});e.useEffect(()=>{h({background:i?{...c.background,...i.background}:c.background,modal:i?{...c.modal,...i.modal}:c.modal,deviceLists:i?{...c.deviceLists,...i.deviceLists}:c.deviceLists,audioInputDeviceList:i?{...c.audioInputDeviceList,...i.audioInputDeviceList}:{},audioOutputDeviceList:i?{...c.audioOutputDeviceList,...i.audioOutputDeviceList}:{},videoInputDeviceList:i?{...c.videoInputDeviceList,...i.videoInputDeviceList}:{},buttons:i?{...c.buttons,...i.buttons}:c.buttons,cancelButton:i?{...c.cancelButton,...i.cancelButton}:c.cancelButton,confirmButton:i?{...c.confirmButton,...i.confirmButton}:c.confirmButton})},[i]),e.useEffect(()=>{a?(navigator.mediaDevices.addEventListener("devicechange",I),I()):navigator.mediaDevices.removeEventListener("devicechange",I)},[a]);const D=()=>{t({audioInput:x!==void 0?x:Q[0],audioOutput:F!==void 0?F:U[0],videoInput:k!==void 0?k:A[0]})},q=()=>{$()},d=r=>{M(Q.find(w=>w.deviceId===r))},v=r=>{V(U.find(w=>w.deviceId===r))},H=r=>{T(A.find(w=>w.deviceId===r))},z=()=>{$()};return a?e.createElement("div",{style:l.background,...E?{onClick:z}:{}},e.createElement("div",{style:l.modal,...E?{onClick:r=>r.stopPropagation()}:{}},e.createElement("div",{style:l.deviceLists},g&&e.createElement(W,{style:l==null?void 0:l.audioInputDeviceList,label:m,devices:Q,selectedDevice:x,onChange:d}),f&&e.createElement(W,{style:l==null?void 0:l.audioOutputDeviceList,label:C,devices:U,selectedDevice:F,onChange:v}),p&&e.createElement(W,{style:l==null?void 0:l.videoInputDeviceList,label:G,devices:A,selectedDevice:k,onChange:H})),e.createElement("div",{style:l.buttons},e.createElement(_,{style:l.cancelButton,onClick:q},O),e.createElement(_,{style:l.confirmButton,onClick:D},L)))):e.createElement(e.Fragment,null)},Z=()=>{const[g,f]=e.useState();return e.useEffect(()=>()=>{g!==void 0&&g.getTracks().forEach(m=>m.stop())},[]),[g,m=>{m.kind!=="audiooutput"&&(async()=>{const C=await navigator.mediaDevices.getUserMedia(m.kind==="audioinput"?{video:!1,audio:{deviceId:m.deviceId}}:{video:{deviceId:m.deviceId},audio:!1});f(C)})()},()=>{g!==void 0&&(g.getTracks().forEach(m=>m.stop()),f(void 0))}]},P=({isSelectAudioInput:g=!0,isSelectAudioOutput:f=!0,isSelectVideoInput:p=!0,open:a,audioInputDeviceLabel:m="audio input device",audioOutputDeviceLabel:C="audio output device",videoInputDeviceLabel:G="video input device",confirmButtonText:L="Confirm",cancelButtonText:O="Cancel",allowOutsideClick:E=!0,style:i,onDeviceSelected:t,onDeviceSelectCanceled:$})=>{const[B,I]=X(),[x,M]=e.useState(),[F,V]=e.useState(),[k,T]=e.useState(),[Q,U,A]=Z(),c=e.useRef(),l=e.useMemo(()=>B.filter(o=>o.kind==="audioinput"),[B]),h=e.useMemo(()=>B.filter(o=>o.kind==="audiooutput"),[B]),D=e.useMemo(()=>B.filter(o=>o.kind==="videoinput"),[B]),q=matchMedia("(max-width: 640px)"),d={background:{position:"fixed",top:0,left:0,width:"100%",height:"100%",backgroundColor:"rgba(0, 0, 0, 0.3)",display:"flex",alignItems:"center",justifyContent:"center"},modal:{background:"white",padding:"16px",borderRadius:"8px"},deviceSelectContainer:q.matches?{display:"grid",gridTemplateColumns:"100%"}:{display:"grid",gridTemplateColumns:"50% 50%"},preview:{minWidth:"270px",minHeight:"180px",maxWidth:"270px",maxHeight:"180px",marginRight:"4px"},previewVideo:{width:"270px",height:"180px"},deviceLists:{display:"grid",minWidth:"270px",marginLeft:"8px"},audioInputDeviceList:{},audioOutputDeviceList:{},videoInputDeviceList:{},buttons:{paddingTop:"16px",display:"flex",alignItems:"center",justifyContent:"right"},cancelButton:{},confirmButton:{marginLeft:"4px"}},[v,H]=e.useState({background:i?{...d.background,...i.background}:d.background,modal:i?{...d.modal,...i.modal}:d.modal,deviceSelectContainer:i?{...d.deviceSelectContainer,...i.deviceSelectContainer}:d.deviceSelectContainer,preview:i?{...d.preview,...i.preview}:d.preview,previewVideo:i?{...d.previewVideo,...i.previewVideo}:d.previewVideo,deviceLists:i?{...d.deviceLists,...i.deviceLists}:d.deviceLists,audioInputDeviceList:i?{...d.audioInputDeviceList,...i.audioInputDeviceList}:d.audioInputDeviceList,audioOutputDeviceList:i?{...d.audioOutputDeviceList,...i.audioOutputDeviceList}:d.audioOutputDeviceList,videoInputDeviceList:i?{...d.videoInputDeviceList,...i.videoInputDeviceList}:d.videoInputDeviceList,buttons:i?{...d.buttons,...i.buttons}:d.buttons,cancelButton:i?{...d.cancelButton,...i.cancelButton}:d.cancelButton,confirmButton:i?{...d.confirmButton,...i.confirmButton}:d.confirmButton});e.useEffect(()=>{H({background:i?{...d.background,...i.background}:d.background,modal:i?{...d.modal,...i.modal}:d.modal,deviceSelectContainer:i?{...d.deviceSelectContainer,...i.deviceSelectContainer}:d.deviceSelectContainer,preview:i?{...d.preview,...i.preview}:d.preview,previewVideo:i?{...d.previewVideo,...i.previewVideo}:d.previewVideo,deviceLists:i?{...d.deviceLists,...i.deviceLists}:d.deviceLists,audioInputDeviceList:i?{...d.audioInputDeviceList,...i.audioInputDeviceList}:d.audioInputDeviceList,audioOutputDeviceList:i?{...d.audioOutputDeviceList,...i.audioOutputDeviceList}:d.audioOutputDeviceList,videoInputDeviceList:i?{...d.videoInputDeviceList,...i.videoInputDeviceList}:d.videoInputDeviceList,buttons:i?{...d.buttons,...i.buttons}:d.buttons,cancelButton:i?{...d.cancelButton,...i.cancelButton}:d.cancelButton,confirmButton:i?{...d.confirmButton,...i.confirmButton}:d.confirmButton})},[i]),e.useEffect(()=>{const o=()=>{q.matches?H({...v,deviceSelectContainer:{display:"grid",gridTemplateColumns:"100%"}}):H({...v,deviceSelectContainer:{display:"grid",gridTemplateColumns:"50% 50%"}})};return q.addEventListener("change",o),()=>{q.removeEventListener("change",o)}},[]),e.useEffect(()=>{a?(navigator.mediaDevices.addEventListener("devicechange",I),I()):navigator.mediaDevices.removeEventListener("devicechange",I)},[a]),e.useEffect(()=>{if(D.length<1)return;const o=D.find(S=>S.deviceId===(k==null?void 0:k.deviceId))??D[0];U(o)},[D]);const z=()=>{A(),t({audioInput:x!==void 0?x:l[0],audioOutput:F!==void 0?F:h[0],videoInput:k!==void 0?k:D[0]})},r=()=>{A(),$()},w=o=>{M(l.find(S=>S.deviceId===o))},n=o=>{V(h.find(S=>S.deviceId===o))},s=o=>{const S=D.find(Y=>Y.deviceId===o);T(S),U(S)};e.useEffect(()=>{const{current:o}=c;o&&(o.srcObject!==null&&o.srcObject instanceof MediaStream&&(o.srcObject.getTracks().forEach(S=>S.stop()),o.pause()),o.srcObject=Q,o.play())},[Q]);const K=()=>{A(),$()};return a?e.createElement("div",{style:v.background,...E?{onClick:K}:{}},e.createElement("div",{style:v.modal,...E?{onClick:o=>o.stopPropagation()}:{}},e.createElement("div",{style:v.deviceSelectContainer},e.createElement("div",{style:v.preview},e.createElement("video",{style:v.previewVideo,ref:c,autoPlay:!0,muted:!0,playsInline:!0})),e.createElement("div",{style:v.deviceLists},g&&e.createElement(W,{style:v.audioInputDeviceList,label:m,devices:l,selectedDevice:x,onChange:w}),f&&e.createElement(W,{style:v==null?void 0:v.audioOutputDeviceList,label:C,devices:h,selectedDevice:F,onChange:n}),p&&e.createElement(W,{style:v==null?void 0:v.videoInputDeviceList,label:G,devices:D,selectedDevice:k,onChange:s}))),e.createElement("div",{style:v.buttons},e.createElement(_,{style:v.cancelButton,onClick:r},O),e.createElement(_,{style:v.confirmButton,onClick:z},L)))):e.createElement(e.Fragment,null)},ee=({isSelectAudioInput:g=!0,isSelectAudioOutput:f=!0,isSelectVideoInput:p=!0,open:a,audioInputDeviceLabel:m="audio input device",audioOutputDeviceLabel:C="audio output device",videoInputDeviceLabel:G="video input device",confirmButtonText:L="Confirm",cancelButtonText:O="Cancel",recordingButtonText:E="Recording",allowOutsideClick:i=!0,style:t,onDeviceSelected:$,onDeviceSelectCanceled:B})=>{const[I,x]=X(),[M,F]=e.useState(),[V,k]=e.useState(),[T,Q]=e.useState(),[U,A,c]=Z(),l=e.useRef(),h=e.useRef(),[D,q]=e.useState(),[d,v]=e.useState(!1),H=e.useMemo(()=>I.filter(u=>u.kind==="audioinput"),[I]),z=e.useMemo(()=>I.filter(u=>u.kind==="audiooutput"),[I]),r=e.useMemo(()=>I.filter(u=>u.kind==="videoinput"),[I]),w=matchMedia("(max-width: 640px)"),n={background:{position:"fixed",top:0,left:0,width:"100%",height:"100%",backgroundColor:"rgba(0, 0, 0, 0.3)",display:"flex",alignItems:"center",justifyContent:"center"},modal:{background:"white",padding:"16px",borderRadius:"8px"},deviceSelectContainer:w.matches?{display:"grid",gridTemplateColumns:"100%"}:{display:"grid",gridTemplateColumns:"50% 50%"},preview:{minWidth:"270px",minHeight:"180px",maxWidth:"270px",marginRight:"4px"},previewVideo:{width:"270px",height:"180px"},previewAudio:{width:"270px"},deviceLists:{display:"grid",minWidth:"270px",marginLeft:"8px"},recordingButtons:{},recordingButton:{},audioInputDeviceList:{},audioOutputDeviceList:{},videoInputDeviceList:{},buttons:{paddingTop:"16px",display:"flex",alignItems:"center",justifyContent:"right"},cancelButton:{},confirmButton:{marginLeft:"4px"}},[s,K]=e.useState({background:t?{...n.background,...t.background}:n.background,modal:t?{...n.modal,...t.modal}:n.modal,deviceSelectContainer:t?{...n.deviceSelectContainer,...t.deviceSelectContainer}:n.deviceSelectContainer,preview:t?{...n.preview,...t.preview}:n.preview,previewVideo:t?{...n.previewVideo,...t.previewVideo}:n.previewVideo,previewAudio:t?{...n.previewAudio,...t.previewAudio}:n.previewAudio,deviceLists:t?{...n.deviceLists,...t.deviceLists}:n.deviceLists,recordingButtons:t?{...n.recordingButtons,...t.recordingButtons}:n.recordingButtons,recordingButton:t?{...n.recordingButton,...t.recordingButton}:n.recordingButton,audioInputDeviceList:t?{...n.audioInputDeviceList,...t.audioInputDeviceList}:n.audioInputDeviceList,audioOutputDeviceList:t?{...n.audioOutputDeviceList,...t.audioOutputDeviceList}:n.audioOutputDeviceList,videoInputDeviceList:t?{...n.videoInputDeviceList,...t.videoInputDeviceList}:n.videoInputDeviceList,buttons:t?{...n.buttons,...t.buttons}:n.buttons,cancelButton:t?{...n.cancelButton,...t.cancelButton}:n.cancelButton,confirmButton:t?{...n.confirmButton,...t.confirmButton}:n.confirmButton});e.useEffect(()=>{K({background:t?{...n.background,...t.background}:n.background,modal:t?{...n.modal,...t.modal}:n.modal,deviceSelectContainer:t?{...n.deviceSelectContainer,...t.deviceSelectContainer}:n.deviceSelectContainer,preview:t?{...n.preview,...t.preview}:n.preview,previewVideo:t?{...n.previewVideo,...t.previewVideo}:n.previewVideo,previewAudio:t?{...n.previewAudio,...t.previewAudio}:n.previewAudio,deviceLists:t?{...n.deviceLists,...t.deviceLists}:n.deviceLists,recordingButtons:t?{...n.recordingButtons,...t.recordingButtons}:n.recordingButtons,recordingButton:t?{...n.recordingButton,...t.recordingButton}:n.recordingButton,audioInputDeviceList:t?{...n.audioInputDeviceList,...t.audioInputDeviceList}:n.audioInputDeviceList,audioOutputDeviceList:t?{...n.audioOutputDeviceList,...t.audioOutputDeviceList}:n.audioOutputDeviceList,videoInputDeviceList:t?{...n.videoInputDeviceList,...t.videoInputDeviceList}:n.videoInputDeviceList,buttons:t?{...n.buttons,...t.buttons}:n.buttons,cancelButton:t?{...n.cancelButton,...t.cancelButton}:n.cancelButton,confirmButton:t?{...n.confirmButton,...t.confirmButton}:n.confirmButton})},[t]),e.useEffect(()=>{const u=()=>{w.matches?K({...s,deviceSelectContainer:{display:"grid",gridTemplateColumns:"100%"}}):K({...s,deviceSelectContainer:{display:"grid",gridTemplateColumns:"50% 50%"}})};return w.addEventListener("change",u),()=>{w.removeEventListener("change",u)}},[]),e.useEffect(()=>{a?(navigator.mediaDevices.addEventListener("devicechange",x),x()):navigator.mediaDevices.removeEventListener("devicechange",x)},[a]),e.useEffect(()=>{if(r.length<1)return;const u=r.find(b=>b.deviceId===(T==null?void 0:T.deviceId))??r[0];A(u)},[r]);const o=()=>{!D||!h||(D.state==="recording"&&(D.removeEventListener("dataavailable",()=>{}),D.removeEventListener("stop",()=>{}),D.stop(),D.stream.getTracks().forEach(u=>u.stop())),h.current.src="",h.current.pause(),c())},S=()=>{o(),$({audioInput:M!==void 0?M:H[0],audioOutput:V!==void 0?V:z[0],videoInput:T!==void 0?T:r[0]})},Y=()=>{o(),B()},ie=u=>{F(H.find(b=>b.deviceId===u))},te=async u=>{k(z.find(b=>b.deviceId===u)),await h.current.setSinkId(u)},ne=u=>{const b=r.find(J=>J.deviceId===u);Q(b),A(b)},de=async()=>{const u=await navigator.mediaDevices.getUserMedia({audio:M&&M.deviceId!==""?{deviceId:M.deviceId}:!0,video:!1});let b=[];const J=new MediaRecorder(u);J.addEventListener("dataavailable",N=>{b.push(N.data)}),J.addEventListener("stop",async N=>{if(v(!1),!h.current)return;const ue=new Blob(b,{type:"audio/ogg; codecs=opus"});b=[];const oe=URL.createObjectURL(ue);h.current.src=oe,V&&V.deviceId!==""&&await h.current.setSinkId(V.deviceId)}),J.start(),q(J),v(!0),setTimeout(()=>{J.stop(),u.getTracks().forEach(N=>N.stop())},5e3)};e.useEffect(()=>{const{current:u}=l;u&&(u.srcObject!==null&&u.srcObject instanceof MediaStream&&(u.srcObject.getTracks().forEach(b=>b.stop()),u.pause()),u.srcObject=U,u.play())},[U]);const ce=()=>{o(),B()};return a?e.createElement("div",{style:s.background,...i?{onClick:ce}:{}},e.createElement("div",{style:s.modal,...i?{onClick:u=>u.stopPropagation()}:{}},e.createElement("div",{style:s.deviceSelectContainer},e.createElement("div",{style:s.preview},e.createElement("video",{style:s.previewVideo,ref:l,autoPlay:!0,muted:!0,playsInline:!0}),e.createElement("audio",{style:s.previewAudio,ref:h,autoPlay:!0,playsInline:!0,controls:!0})),e.createElement("div",{style:s.deviceLists},g&&e.createElement(e.Fragment,null,e.createElement(W,{style:s.audioInputDeviceList,label:m,devices:H,selectedDevice:M,onChange:ie}),e.createElement("div",{style:s.recordingButtons},e.createElement(_,{style:s.recordingButton,onClick:de,disabled:d},E))),f&&e.createElement(W,{style:s==null?void 0:s.audioOutputDeviceList,label:C,devices:z,selectedDevice:V,onChange:te}),p&&e.createElement(W,{style:s==null?void 0:s.videoInputDeviceList,label:G,devices:r,selectedDevice:T,onChange:ne}))),e.createElement("div",{style:s.buttons},e.createElement(_,{style:s.cancelButton,onClick:Y},O),e.createElement(_,{style:s.confirmButton,onClick:S},L)))):e.createElement(e.Fragment,null)};j.SelectMediaDevicesModal=R,j.SelectMediaDevicesPreviewModal=P,j.SelectMediaDevicesRecordingModal=ee,Object.defineProperty(j,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import DeviceList from '../components/deviceList';
|
|
2
3
|
interface SelectMediaDevicesModalProps {
|
|
3
4
|
isSelectAudioInput?: boolean;
|
|
4
5
|
isSelectAudioOutput?: boolean;
|
|
@@ -10,6 +11,17 @@ interface SelectMediaDevicesModalProps {
|
|
|
10
11
|
confirmButtonText?: string;
|
|
11
12
|
cancelButtonText?: string;
|
|
12
13
|
allowOutsideClick?: boolean;
|
|
14
|
+
style?: {
|
|
15
|
+
background?: React.CSSProperties;
|
|
16
|
+
modal?: React.CSSProperties;
|
|
17
|
+
deviceLists?: React.CSSProperties;
|
|
18
|
+
audioInputDeviceList?: Parameters<typeof DeviceList>[0]['style'];
|
|
19
|
+
audioOutputDeviceList?: Parameters<typeof DeviceList>[0]['style'];
|
|
20
|
+
videoInputDeviceList?: Parameters<typeof DeviceList>[0]['style'];
|
|
21
|
+
buttons?: React.CSSProperties;
|
|
22
|
+
cancelButton?: React.CSSProperties;
|
|
23
|
+
confirmButton?: React.CSSProperties;
|
|
24
|
+
};
|
|
13
25
|
onDeviceSelected: (devices: {
|
|
14
26
|
audioInput?: MediaDeviceInfo;
|
|
15
27
|
audioOutput?: MediaDeviceInfo;
|
|
@@ -17,5 +29,5 @@ interface SelectMediaDevicesModalProps {
|
|
|
17
29
|
}) => void;
|
|
18
30
|
onDeviceSelectCanceled: () => void;
|
|
19
31
|
}
|
|
20
|
-
declare const SelectMediaDevicesModal: ({ isSelectAudioInput, isSelectAudioOutput, isSelectVideoInput, open, audioInputDeviceLabel, audioOutputDeviceLabel, videoInputDeviceLabel, confirmButtonText, cancelButtonText, allowOutsideClick, onDeviceSelected, onDeviceSelectCanceled, }: SelectMediaDevicesModalProps) => React.JSX.Element;
|
|
32
|
+
declare const SelectMediaDevicesModal: ({ isSelectAudioInput, isSelectAudioOutput, isSelectVideoInput, open, audioInputDeviceLabel, audioOutputDeviceLabel, videoInputDeviceLabel, confirmButtonText, cancelButtonText, allowOutsideClick, style: styleProps, onDeviceSelected, onDeviceSelectCanceled, }: SelectMediaDevicesModalProps) => React.JSX.Element;
|
|
21
33
|
export default SelectMediaDevicesModal;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import DeviceList from '../components/deviceList';
|
|
2
3
|
interface SelectMediaDevicesPreviewModalProps {
|
|
3
4
|
isSelectAudioInput?: boolean;
|
|
4
5
|
isSelectAudioOutput?: boolean;
|
|
@@ -10,6 +11,20 @@ interface SelectMediaDevicesPreviewModalProps {
|
|
|
10
11
|
confirmButtonText?: string;
|
|
11
12
|
cancelButtonText?: string;
|
|
12
13
|
allowOutsideClick?: boolean;
|
|
14
|
+
style?: {
|
|
15
|
+
background?: React.CSSProperties;
|
|
16
|
+
modal?: React.CSSProperties;
|
|
17
|
+
deviceSelectContainer?: React.CSSProperties;
|
|
18
|
+
preview?: React.CSSProperties;
|
|
19
|
+
previewVideo?: React.CSSProperties;
|
|
20
|
+
deviceLists?: React.CSSProperties;
|
|
21
|
+
audioInputDeviceList?: Parameters<typeof DeviceList>[0]['style'];
|
|
22
|
+
audioOutputDeviceList?: Parameters<typeof DeviceList>[0]['style'];
|
|
23
|
+
videoInputDeviceList?: Parameters<typeof DeviceList>[0]['style'];
|
|
24
|
+
buttons?: React.CSSProperties;
|
|
25
|
+
cancelButton?: React.CSSProperties;
|
|
26
|
+
confirmButton?: React.CSSProperties;
|
|
27
|
+
};
|
|
13
28
|
onDeviceSelected: (devices: {
|
|
14
29
|
audioInput?: MediaDeviceInfo;
|
|
15
30
|
audioOutput?: MediaDeviceInfo;
|
|
@@ -17,5 +32,5 @@ interface SelectMediaDevicesPreviewModalProps {
|
|
|
17
32
|
}) => void;
|
|
18
33
|
onDeviceSelectCanceled: () => void;
|
|
19
34
|
}
|
|
20
|
-
declare const SelectMediaDevicesPreviewModal: ({ isSelectAudioInput, isSelectAudioOutput, isSelectVideoInput, open, audioInputDeviceLabel, audioOutputDeviceLabel, videoInputDeviceLabel, confirmButtonText, cancelButtonText, allowOutsideClick, onDeviceSelected, onDeviceSelectCanceled, }: SelectMediaDevicesPreviewModalProps) => React.JSX.Element;
|
|
35
|
+
declare const SelectMediaDevicesPreviewModal: ({ isSelectAudioInput, isSelectAudioOutput, isSelectVideoInput, open, audioInputDeviceLabel, audioOutputDeviceLabel, videoInputDeviceLabel, confirmButtonText, cancelButtonText, allowOutsideClick, style: styleProps, onDeviceSelected, onDeviceSelectCanceled, }: SelectMediaDevicesPreviewModalProps) => React.JSX.Element;
|
|
21
36
|
export default SelectMediaDevicesPreviewModal;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import DeviceList from '../components/deviceList';
|
|
2
3
|
interface SelectMediaDevicesRecordingModalProps {
|
|
3
4
|
isSelectAudioInput?: boolean;
|
|
4
5
|
isSelectAudioOutput?: boolean;
|
|
@@ -11,6 +12,23 @@ interface SelectMediaDevicesRecordingModalProps {
|
|
|
11
12
|
cancelButtonText?: string;
|
|
12
13
|
recordingButtonText?: string;
|
|
13
14
|
allowOutsideClick?: boolean;
|
|
15
|
+
style?: {
|
|
16
|
+
background?: React.CSSProperties;
|
|
17
|
+
modal?: React.CSSProperties;
|
|
18
|
+
deviceSelectContainer?: React.CSSProperties;
|
|
19
|
+
preview?: React.CSSProperties;
|
|
20
|
+
previewVideo?: React.CSSProperties;
|
|
21
|
+
previewAudio?: React.CSSProperties;
|
|
22
|
+
deviceLists?: React.CSSProperties;
|
|
23
|
+
recordingButtons?: React.CSSProperties;
|
|
24
|
+
recordingButton?: React.CSSProperties;
|
|
25
|
+
audioInputDeviceList?: Parameters<typeof DeviceList>[0]['style'];
|
|
26
|
+
audioOutputDeviceList?: Parameters<typeof DeviceList>[0]['style'];
|
|
27
|
+
videoInputDeviceList?: Parameters<typeof DeviceList>[0]['style'];
|
|
28
|
+
buttons?: React.CSSProperties;
|
|
29
|
+
cancelButton?: React.CSSProperties;
|
|
30
|
+
confirmButton?: React.CSSProperties;
|
|
31
|
+
};
|
|
14
32
|
onDeviceSelected: (devices: {
|
|
15
33
|
audioInput?: MediaDeviceInfo;
|
|
16
34
|
audioOutput?: MediaDeviceInfo;
|
|
@@ -18,5 +36,5 @@ interface SelectMediaDevicesRecordingModalProps {
|
|
|
18
36
|
}) => void;
|
|
19
37
|
onDeviceSelectCanceled: () => void;
|
|
20
38
|
}
|
|
21
|
-
declare const SelectMediaDevicesRecordingModal: ({ isSelectAudioInput, isSelectAudioOutput, isSelectVideoInput, open, audioInputDeviceLabel, audioOutputDeviceLabel, videoInputDeviceLabel, confirmButtonText, cancelButtonText, recordingButtonText, allowOutsideClick, onDeviceSelected, onDeviceSelectCanceled, }: SelectMediaDevicesRecordingModalProps) => React.JSX.Element;
|
|
39
|
+
declare const SelectMediaDevicesRecordingModal: ({ isSelectAudioInput, isSelectAudioOutput, isSelectVideoInput, open, audioInputDeviceLabel, audioOutputDeviceLabel, videoInputDeviceLabel, confirmButtonText, cancelButtonText, recordingButtonText, allowOutsideClick, style: styleProps, onDeviceSelected, onDeviceSelectCanceled, }: SelectMediaDevicesRecordingModalProps) => React.JSX.Element;
|
|
22
40
|
export default SelectMediaDevicesRecordingModal;
|
|
@@ -3,7 +3,8 @@ interface ButtonProps {
|
|
|
3
3
|
className?: string;
|
|
4
4
|
children: ReactNode;
|
|
5
5
|
disabled?: boolean;
|
|
6
|
+
style?: React.CSSProperties;
|
|
6
7
|
onClick: () => void;
|
|
7
8
|
}
|
|
8
|
-
declare const Button: ({
|
|
9
|
+
declare const Button: ({ children, disabled, style: styleProps, onClick }: ButtonProps) => React.JSX.Element;
|
|
9
10
|
export default Button;
|
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
interface DeviceItemProps {
|
|
3
3
|
name: string;
|
|
4
4
|
value: string;
|
|
5
|
+
style?: React.CSSProperties;
|
|
5
6
|
}
|
|
6
|
-
declare const DeviceItem: ({ name, value }: DeviceItemProps) => React.JSX.Element;
|
|
7
|
+
declare const DeviceItem: ({ name, value, style }: DeviceItemProps) => React.JSX.Element;
|
|
7
8
|
export default DeviceItem;
|
|
@@ -3,7 +3,13 @@ interface DeviceListProps {
|
|
|
3
3
|
devices: MediaDeviceInfo[];
|
|
4
4
|
label: string;
|
|
5
5
|
selectedDevice?: MediaDeviceInfo;
|
|
6
|
+
style?: {
|
|
7
|
+
deviceList?: React.CSSProperties;
|
|
8
|
+
label?: React.CSSProperties;
|
|
9
|
+
select?: React.CSSProperties;
|
|
10
|
+
deviceItems?: React.CSSProperties;
|
|
11
|
+
};
|
|
6
12
|
onChange: (deviceId: string) => void;
|
|
7
13
|
}
|
|
8
|
-
declare const DeviceList: ({ devices, label, selectedDevice, onChange }: DeviceListProps) => React.JSX.Element;
|
|
14
|
+
declare const DeviceList: ({ devices, label, selectedDevice, style: styleProps, onChange }: DeviceListProps) => React.JSX.Element;
|
|
9
15
|
export default DeviceList;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-select-media-devices-modal",
|
|
3
3
|
"description": "A React component library for select media devices",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.4",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"dev": "vite serve example",
|
|
36
36
|
"build": "vite build",
|
|
37
37
|
"test": "vitest run",
|
|
38
|
+
"test:watch": "vitest",
|
|
38
39
|
"coverage": "vitest run --coverage",
|
|
39
40
|
"test:e2e": "vitest run -c vitest.e2e.config.ts",
|
|
40
41
|
"test:e2e:watch": "vitest watch -c vitest.e2e.config.ts"
|
|
@@ -45,24 +46,24 @@
|
|
|
45
46
|
"react-router-dom": "^6.14.0"
|
|
46
47
|
},
|
|
47
48
|
"devDependencies": {
|
|
48
|
-
"@mdx-js/react": "^
|
|
49
|
+
"@mdx-js/react": "^3.0.1",
|
|
49
50
|
"@playwright/test": "^1.35.1",
|
|
50
51
|
"@rollup/plugin-typescript": "^11.1.1",
|
|
51
|
-
"@testing-library/jest-dom": "^
|
|
52
|
-
"@testing-library/react": "^
|
|
52
|
+
"@testing-library/jest-dom": "^6.4.6",
|
|
53
|
+
"@testing-library/react": "^16.0.0",
|
|
53
54
|
"@testing-library/user-event": "^14.4.3",
|
|
54
55
|
"@types/node": "^20.3.1",
|
|
55
56
|
"@types/react": "^18.2.14",
|
|
56
57
|
"@vitejs/plugin-react": "^4.0.1",
|
|
57
|
-
"@vitest/coverage-
|
|
58
|
-
"@vitest/ui": "^
|
|
59
|
-
"jsdom": "^
|
|
58
|
+
"@vitest/coverage-v8": "^1.6.0",
|
|
59
|
+
"@vitest/ui": "^1.6.0",
|
|
60
|
+
"jsdom": "^24.1.0",
|
|
60
61
|
"playwright": "^1.35.1",
|
|
61
62
|
"rimraf": "^5.0.1",
|
|
62
63
|
"serve": "^14.2.0",
|
|
63
|
-
"vite": "^
|
|
64
|
-
"vite-pages-theme-doc": "^
|
|
65
|
-
"vite-plugin-react-pages": "^
|
|
66
|
-
"vitest": "^
|
|
64
|
+
"vite": "^5.3.1",
|
|
65
|
+
"vite-pages-theme-doc": "^5.0.0",
|
|
66
|
+
"vite-plugin-react-pages": "^5.0.0",
|
|
67
|
+
"vitest": "^1.6.0"
|
|
67
68
|
}
|
|
68
69
|
}
|
package/dist/style.css
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
._background_1djbv_1{position:fixed;top:0;left:0;width:100%;height:100%;background-color:#0000004d;display:flex;align-items:center;justify-content:center}._modal_1djbv_13{background:white;padding:16px;border-radius:8px;min-width:270px}._deviceLists_1djbv_20{display:grid}._buttons_1djbv_24{padding-top:16px;display:flex;align-items:center;justify-content:right}._confirmButton_1djbv_33{margin-left:4px}._deviceList_1bfq1_1{padding-top:8px}._select_1bfq1_5{margin-top:4px;border-radius:4px;height:32px;display:flex;align-items:center;justify-content:right;width:100%}._button_keu24_1{border-radius:4px;height:32px;padding-left:16px;padding-right:16px;background-color:#fff;border-width:1px}._background_kb025_1{position:fixed;top:0;left:0;width:100%;height:100%;background-color:#0000004d;display:flex;align-items:center;justify-content:center}._modal_kb025_13{background:white;padding:16px;border-radius:8px}._deviceSelectContainer_kb025_19{display:grid;grid-template-columns:50% 50%}@media (max-width: 640px){._deviceSelectContainer_kb025_19{display:grid;grid-template-columns:100%}}._preview_kb025_31{min-width:270px;min-height:180px;max-width:270px;max-height:180px;margin-right:4px}._previewVideo_kb025_39{width:270px;height:180px}._deviceLists_kb025_44{display:grid;min-width:270px;margin-left:8px}._buttons_kb025_50{padding-top:16px;display:flex;align-items:center;justify-content:right}._confirmButton_kb025_59{margin-left:4px}._background_1s81f_1{position:fixed;top:0;left:0;width:100%;height:100%;background-color:#0000004d;display:flex;align-items:center;justify-content:center}._modal_1s81f_13{background:white;padding:16px;border-radius:8px}._deviceSelectContainer_1s81f_19{display:grid;grid-template-columns:50% 50%}@media (max-width: 640px){._deviceSelectContainer_1s81f_19{display:grid;grid-template-columns:100%}}._preview_1s81f_31{min-width:270px;min-height:180px;max-width:270px;max-height:180px;margin-right:4px}._previewVideo_1s81f_39{width:270px;height:180px}._previewAudio_1s81f_44{width:270px}._deviceLists_1s81f_48{display:grid;min-width:270px;margin-left:8px}._buttons_1s81f_54{padding-top:16px;display:flex;align-items:center;justify-content:right}._confirmButton_1s81f_63{margin-left:4px}
|