wip
This commit is contained in:
parent
10e71fc550
commit
8aa3de3204
@ -67,14 +67,25 @@ try {
|
|||||||
"src_components_faceRecognition_FaceRecognition_tsx-src_components_shared_organisms_Player_Ove-59cc90",
|
"src_components_faceRecognition_FaceRecognition_tsx-src_components_shared_organisms_Player_Ove-59cc90",
|
||||||
],
|
],
|
||||||
{
|
{
|
||||||
98024: (e, t, n) => {
|
98024: setupCameraDevice,
|
||||||
n.d(t, { B: () => o });
|
81801: _81801,
|
||||||
|
77177: _77177,
|
||||||
|
60616: _60616,
|
||||||
|
21721: _21721,
|
||||||
|
41233: _41233,
|
||||||
|
58169: _58169,
|
||||||
|
49474: _49474,
|
||||||
|
26237: _26237,
|
||||||
|
},
|
||||||
|
]);
|
||||||
|
|
||||||
function o({ disabled: e = !1, storedDevice: t } = {}) {
|
function setupCameraDevice(e, t, n) {
|
||||||
|
n.d(t, { B: () => setupCameraDeviceImpl });
|
||||||
|
|
||||||
|
function setupCameraDeviceImpl({ disabled = !1, storedDevice } = {}) {
|
||||||
const [error, setError] = useState(null);
|
const [error, setError] = useState(null);
|
||||||
const [inputDevices, setInputDevices] = useState<MediaDeviceInfo[]>([]);
|
const [inputDevices, setInputDevices] = useState<MediaDeviceInfo[]>([]);
|
||||||
const [mediaDeviceInfo, setMediaDeviceInfo] =
|
const [mediaDeviceInfo, setMediaDeviceInfo] = useState<MediaDeviceInfo>();
|
||||||
useState<MediaDeviceInfo>();
|
|
||||||
|
|
||||||
const l = useCallback(async () => {
|
const l = useCallback(async () => {
|
||||||
try {
|
try {
|
||||||
@ -93,16 +104,14 @@ try {
|
|||||||
|
|
||||||
const videoInputDevices = MediaDevices.filter(
|
const videoInputDevices = MediaDevices.filter(
|
||||||
(mediaDevice) =>
|
(mediaDevice) =>
|
||||||
mediaDevice.kind === "videoinput" &&
|
mediaDevice.kind === "videoinput" && mediaDevice.label !== "",
|
||||||
mediaDevice.label !== "",
|
|
||||||
);
|
);
|
||||||
if (
|
if (
|
||||||
(setInputDevices(videoInputDevices),
|
(setInputDevices(videoInputDevices),
|
||||||
!mediaDeviceInfo ||
|
!mediaDeviceInfo ||
|
||||||
!videoInputDevices.some(
|
!videoInputDevices.some(
|
||||||
(videoInputDevice) =>
|
(videoInputDevice) =>
|
||||||
videoInputDevice.deviceId ===
|
videoInputDevice.deviceId === mediaDeviceInfo.deviceId ||
|
||||||
mediaDeviceInfo.deviceId ||
|
|
||||||
videoInputDevice.label === mediaDeviceInfo.label,
|
videoInputDevice.label === mediaDeviceInfo.label,
|
||||||
))
|
))
|
||||||
) {
|
) {
|
||||||
@ -114,12 +123,18 @@ try {
|
|||||||
null !==
|
null !==
|
||||||
(r = videoInputDevices.find(
|
(r = videoInputDevices.find(
|
||||||
({ deviceId: e }) =>
|
({ deviceId: e }) =>
|
||||||
e === (null == t ? void 0 : t.deviceId),
|
e ===
|
||||||
|
(null == storedDevice
|
||||||
|
? void 0
|
||||||
|
: storedDevice.deviceId),
|
||||||
)) && void 0 !== r
|
)) && void 0 !== r
|
||||||
? r
|
? r
|
||||||
: videoInputDevices.find(
|
: videoInputDevices.find(
|
||||||
({ label: e }) =>
|
({ label: e }) =>
|
||||||
e === (null == t ? void 0 : t.label),
|
e ===
|
||||||
|
(null == storedDevice
|
||||||
|
? void 0
|
||||||
|
: storedDevice.label),
|
||||||
)) && void 0 !== a
|
)) && void 0 !== a
|
||||||
? a
|
? a
|
||||||
: videoInputDevices[0];
|
: videoInputDevices[0];
|
||||||
@ -133,8 +148,8 @@ try {
|
|||||||
}
|
}
|
||||||
}, [
|
}, [
|
||||||
mediaDeviceInfo,
|
mediaDeviceInfo,
|
||||||
null == t ? void 0 : t.deviceId,
|
null == storedDevice ? void 0 : storedDevice.deviceId,
|
||||||
null == t ? void 0 : t.label,
|
null == storedDevice ? void 0 : storedDevice.label,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const d = useCallback(
|
const d = useCallback(
|
||||||
@ -142,9 +157,7 @@ try {
|
|||||||
setMediaDeviceInfo(
|
setMediaDeviceInfo(
|
||||||
null == inputDevices
|
null == inputDevices
|
||||||
? void 0
|
? void 0
|
||||||
: inputDevices.find(
|
: inputDevices.find((inputDevice) => inputDevice.deviceId === e),
|
||||||
(inputDevice) => inputDevice.deviceId === e,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
[inputDevices],
|
[inputDevices],
|
||||||
@ -153,7 +166,7 @@ try {
|
|||||||
return (
|
return (
|
||||||
useEffect(
|
useEffect(
|
||||||
() =>
|
() =>
|
||||||
e
|
disabled
|
||||||
? (setError(null),
|
? (setError(null),
|
||||||
setInputDevices([]),
|
setInputDevices([]),
|
||||||
setMediaDeviceInfo(void 0),
|
setMediaDeviceInfo(void 0),
|
||||||
@ -161,11 +174,8 @@ try {
|
|||||||
: (l(),
|
: (l(),
|
||||||
navigator.mediaDevices.addEventListener("devicechange", l),
|
navigator.mediaDevices.addEventListener("devicechange", l),
|
||||||
() =>
|
() =>
|
||||||
navigator.mediaDevices.removeEventListener(
|
navigator.mediaDevices.removeEventListener("devicechange", l)),
|
||||||
"devicechange",
|
[disabled, l],
|
||||||
l,
|
|
||||||
)),
|
|
||||||
[e, l],
|
|
||||||
),
|
),
|
||||||
{
|
{
|
||||||
error: error,
|
error: error,
|
||||||
@ -175,12 +185,13 @@ try {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
81801: (e, t, n) => {
|
|
||||||
n.d(t, { y: () => i });
|
function _81801(e, t, n) {
|
||||||
|
n.d(t, { y: () => impl });
|
||||||
const o = n(78685);
|
const o = n(78685);
|
||||||
const r = "camera-device";
|
const r = "camera-device";
|
||||||
function i() {
|
function impl() {
|
||||||
const [e, t] = (0, o.A)(r, void 0, {
|
const [e, t] = (0, o.A)(r, void 0, {
|
||||||
raw: !1,
|
raw: !1,
|
||||||
serializer: (e) => JSON.stringify(e),
|
serializer: (e) => JSON.stringify(e),
|
||||||
@ -189,17 +200,20 @@ try {
|
|||||||
const n = useCallback((e) => t(e), [t]);
|
const n = useCallback((e) => t(e), [t]);
|
||||||
return { device: e, save: n };
|
return { device: e, save: n };
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
77177: (e, t, n) => {
|
|
||||||
|
function _77177(e, t, n) {
|
||||||
n.d(t, { j: () => C });
|
n.d(t, { j: () => C });
|
||||||
const o = n(98024);
|
const o: typeof setupCameraDevice = n(98024);
|
||||||
const r = n(81801);
|
const r: typeof _81801 = n(81801);
|
||||||
const i = Math.floor(25.5); // 25
|
const i = Math.floor(25.5); // 25
|
||||||
const s = { width: 440, height: 440, type: "image/jpeg" };
|
const s = { width: 440, height: 440, type: "image/jpeg" };
|
||||||
function c({ status: e, onStatusChanged: t, onCapture: n, onError: c }) {
|
function c({ status: e, onStatusChanged: t, onCapture: n, onError: c }) {
|
||||||
const { device: storedDevice } = (0, r.y)();
|
const { device: storedDevice } = (0, r.y)();
|
||||||
|
|
||||||
|
// setupCameraDevice
|
||||||
const { currentDevice } = (0, o.B)({ storedDevice: storedDevice });
|
const { currentDevice } = (0, o.B)({ storedDevice: storedDevice });
|
||||||
const { captureImage: u } = (({ deviceId: e }) => ({
|
const { captureImage } = (({ deviceId }) => ({
|
||||||
captureImage: useCallback(
|
captureImage: useCallback(
|
||||||
async ({
|
async ({
|
||||||
width: outputWidth,
|
width: outputWidth,
|
||||||
@ -215,7 +229,7 @@ try {
|
|||||||
}) => {
|
}) => {
|
||||||
const cameraStream = await navigator.mediaDevices.getUserMedia({
|
const cameraStream = await navigator.mediaDevices.getUserMedia({
|
||||||
video: {
|
video: {
|
||||||
deviceId: e ? { exact: e } : void 0,
|
deviceId: deviceId ? { exact: deviceId } : void 0,
|
||||||
width: outputWidth,
|
width: outputWidth,
|
||||||
height: outputHeight,
|
height: outputHeight,
|
||||||
},
|
},
|
||||||
@ -305,11 +319,13 @@ try {
|
|||||||
break;
|
break;
|
||||||
await new Promise((e) => setTimeout(e, 100));
|
await new Promise((e) => setTimeout(e, 100));
|
||||||
}
|
}
|
||||||
const f = await new Promise((e) =>
|
|
||||||
canvasElement.toBlob(e, outputFormat, outputQuality),
|
const captureImage = await new Promise((res) =>
|
||||||
|
canvasElement.toBlob(res, outputFormat, outputQuality),
|
||||||
);
|
);
|
||||||
if (!f) throw new Error("Blobデータの生成に失敗しました");
|
if (!captureImage)
|
||||||
return f;
|
throw new Error("Blobデータの生成に失敗しました");
|
||||||
|
return captureImage;
|
||||||
} finally {
|
} finally {
|
||||||
// biome-ignore lint/complexity/noForEach: <explanation>
|
// biome-ignore lint/complexity/noForEach: <explanation>
|
||||||
cameraStream.getTracks().forEach((e) => {
|
cameraStream.getTracks().forEach((e) => {
|
||||||
@ -317,7 +333,7 @@ try {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[e],
|
[deviceId],
|
||||||
),
|
),
|
||||||
}))({
|
}))({
|
||||||
deviceId: null == currentDevice ? void 0 : currentDevice.deviceId,
|
deviceId: null == currentDevice ? void 0 : currentDevice.deviceId,
|
||||||
@ -328,7 +344,7 @@ try {
|
|||||||
null == (null == currentDevice ? void 0 : currentDevice.deviceId) ||
|
null == (null == currentDevice ? void 0 : currentDevice.deviceId) ||
|
||||||
"progress" !== e ||
|
"progress" !== e ||
|
||||||
h ||
|
h ||
|
||||||
u(s)
|
captureImage(s)
|
||||||
.then((e) => {
|
.then((e) => {
|
||||||
t("success"), n(e);
|
t("success"), n(e);
|
||||||
})
|
})
|
||||||
@ -339,7 +355,7 @@ try {
|
|||||||
p(!0);
|
p(!0);
|
||||||
});
|
});
|
||||||
}, [
|
}, [
|
||||||
u,
|
captureImage,
|
||||||
null == currentDevice ? void 0 : currentDevice.deviceId,
|
null == currentDevice ? void 0 : currentDevice.deviceId,
|
||||||
h,
|
h,
|
||||||
n,
|
n,
|
||||||
@ -478,9 +494,7 @@ try {
|
|||||||
}
|
}
|
||||||
})(
|
})(
|
||||||
x,
|
x,
|
||||||
null !== (e = null == d ? void 0 : d.label) && void 0 !== e
|
null !== (e = null == d ? void 0 : d.label) && void 0 !== e ? e : "",
|
||||||
? e
|
|
||||||
: "",
|
|
||||||
n,
|
n,
|
||||||
).then((e) => {
|
).then((e) => {
|
||||||
w(e), e || s("failed");
|
w(e), e || s("failed");
|
||||||
@ -496,9 +510,7 @@ try {
|
|||||||
const b = useCallback(
|
const b = useCallback(
|
||||||
async (e) => {
|
async (e) => {
|
||||||
if (!g)
|
if (!g)
|
||||||
throw (
|
throw (s("failed"), new Error("本人認証のセッションIDが不正です"));
|
||||||
(s("failed"), new Error("本人認証のセッションIDが不正です"))
|
|
||||||
);
|
|
||||||
e &&
|
e &&
|
||||||
(await (async (e, t) => {
|
(await (async (e, t) => {
|
||||||
try {
|
try {
|
||||||
@ -531,16 +543,18 @@ try {
|
|||||||
children: [_, i && jsx(h, { status: i, horizontalAlign: t })],
|
children: [_, i && jsx(h, { status: i, horizontalAlign: t })],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
60616: (e, t, n) => {
|
|
||||||
|
function _60616(e, t, n) {
|
||||||
n.d(t, { v: () => r });
|
n.d(t, { v: () => r });
|
||||||
const a = n(35830);
|
const a = n(35830);
|
||||||
const o = n(62851);
|
const o = n(62851);
|
||||||
const r = (0, a.default)(o.A).withConfig({ componentId: "sc-131fzem-0" })(
|
const r = (0, a.default)(o.A).withConfig({ componentId: "sc-131fzem-0" })([
|
||||||
["font-size:40px;opacity:1;&:hover{cursor:pointer;}"],
|
"font-size:40px;opacity:1;&:hover{cursor:pointer;}",
|
||||||
);
|
]);
|
||||||
},
|
}
|
||||||
21721: (e, t, n) => {
|
|
||||||
|
function _21721(e, t, n) {
|
||||||
n.d(t, { b: () => p });
|
n.d(t, { b: () => p });
|
||||||
const a = n(63998);
|
const a = n(63998);
|
||||||
const o = n(35830);
|
const o = n(35830);
|
||||||
@ -615,7 +629,7 @@ try {
|
|||||||
const d = (0, o.default)(a.so).withConfig({ componentId: "sc-v2jbux-0" })(
|
const d = (0, o.default)(a.so).withConfig({ componentId: "sc-v2jbux-0" })(
|
||||||
(e) => ({ display: e.$_css }),
|
(e) => ({ display: e.$_css }),
|
||||||
);
|
);
|
||||||
const u = n(60616);
|
const u: typeof _60616 = n(60616);
|
||||||
const h = (0, o.default)(u.v).withConfig({ componentId: "sc-16km7w-0" })(
|
const h = (0, o.default)(u.v).withConfig({ componentId: "sc-16km7w-0" })(
|
||||||
["color:", ";&:hover{color:", ";}"],
|
["color:", ";&:hover{color:", ";}"],
|
||||||
({ theme: e }) => e.colors.white,
|
({ theme: e }) => e.colors.white,
|
||||||
@ -672,8 +686,9 @@ try {
|
|||||||
],
|
],
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
},
|
}
|
||||||
41233: (e, t, n) => {
|
|
||||||
|
function _41233(e, t, n) {
|
||||||
n.d(t, { y: () => o });
|
n.d(t, { y: () => o });
|
||||||
const a: typeof React = n(96540);
|
const a: typeof React = n(96540);
|
||||||
function o({ changePlaybackRate: e }) {
|
function o({ changePlaybackRate: e }) {
|
||||||
@ -699,8 +714,9 @@ try {
|
|||||||
}, []),
|
}, []),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
58169: (e, t, n) => {
|
|
||||||
|
function _58169(e, t, n) {
|
||||||
n.d(t, { A: () => c });
|
n.d(t, { A: () => c });
|
||||||
const a = n(57097);
|
const a = n(57097);
|
||||||
const o = n(53110);
|
const o = n(53110);
|
||||||
@ -734,8 +750,9 @@ try {
|
|||||||
});
|
});
|
||||||
return { addLearningAmounts: n };
|
return { addLearningAmounts: n };
|
||||||
};
|
};
|
||||||
},
|
}
|
||||||
49474: (e, t, n) => {
|
|
||||||
|
function _49474(e, t, n) {
|
||||||
n.d(t, { J: () => o });
|
n.d(t, { J: () => o });
|
||||||
const a: typeof React = n(96540);
|
const a: typeof React = n(96540);
|
||||||
function o(e) {
|
function o(e) {
|
||||||
@ -760,8 +777,9 @@ try {
|
|||||||
!1 === e || "prompt" !== t
|
!1 === e || "prompt" !== t
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
26237: (e, t, n) => {
|
|
||||||
|
function _26237(e, t, n) {
|
||||||
function a({
|
function a({
|
||||||
courseId,
|
courseId,
|
||||||
chapterId,
|
chapterId,
|
||||||
@ -839,6 +857,4 @@ try {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
n.d(t, { d: () => a });
|
n.d(t, { d: () => a });
|
||||||
},
|
}
|
||||||
},
|
|
||||||
]);
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user