Skip to content

Commit cb4f77e

Browse files
committed
refactor: 更新脚本
1 parent 21d216c commit cb4f77e

File tree

1 file changed

+6
-7
lines changed
  • src/BootstrapBlazor/wwwroot/modules

1 file changed

+6
-7
lines changed

src/BootstrapBlazor/wwwroot/modules/media.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
import { drawImage } from "./utility.js"
2-
3-
window.BootstrapBlazor = window.BootstrapBlazor || {};
4-
window.BootstrapBlazor[name] = window.BootstrapBlazor[name] || {
5-
1+
import { drawImage, registerBootstrapBlazorModule } from "./utility.js"
62

73
export async function enumerateDevices() {
84
let ret = null;
@@ -20,7 +16,7 @@ export async function enumerateDevices() {
2016
export async function open(options) {
2117
const constrains = {
2218
video: {
23-
facingMode: options.facingMode || "environment",
19+
facingMode: { exact: options.facingMode || "environment" },
2420
deviceId: options.deviceId ? { exact: options.deviceId } : null,
2521
},
2622
audio: false
@@ -61,7 +57,10 @@ export async function capture(videoSelector) {
6157
const blob = await capture.takePhoto();
6258
const image = await createImageBitmap(blob);
6359
const { offsetWidth, offsetHeight } = video;
64-
drawImage(document.querySelector(".b-video-image"), image, offsetWidth, offsetHeight);
60+
drawImage(document.querySelector(".bb-video-image"), image, offsetWidth, offsetHeight);
61+
62+
const img = document.querySelector(".bb-image");
63+
img.src = URL.createObjectURL(blob);
6564
}
6665
}
6766
}

0 commit comments

Comments
 (0)