-
Notifications
You must be signed in to change notification settings - Fork 75
/
Copy pathCameraImplementation.html
39 lines (32 loc) · 1.21 KB
/
CameraImplementation.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<!DOCTYPE html>
<html>
<head>
<title>Hello Camera</title>
<script src="https://unpkg.com/[email protected]/dist/dce.js"></script>
</head>
<body>
<button id="capture">Capture</button>
<div id="enhancerUIContainer" style="height: 100vh;"></div>
<script>
let enhancer = null;
(async () => {
enhancer = await Dynamsoft.DCE.CameraEnhancer.createInstance();
document.getElementById("enhancerUIContainer").appendChild(enhancer.getUIElement());
await enhancer.open(true);
})();
document.getElementById('capture').onclick = () => {
if (enhancer) {
let frame = enhancer.getFrame();
let width = screen.availWidth;
let height = screen.availHeight;
let popW = 640, popH = 640;
let left = (width - popW) / 2;
let top = (height - popH) / 2;
popWindow = window.open('', 'popup', 'width=' + popW + ',height=' + popH +
',top=' + top + ',left=' + left + ', scrollbars=yes');
popWindow.document.body.appendChild(frame.canvas);
}
};
</script>
</body>
</html>