我在Index.html文件中导入了 instascan库,
<script type="text/javascript" src="https://rawgit.com/schmich/instascan-builds/master/instascan.min.js"> </script>
我的 app.component.html 中有如下代码,
<video id="preview"></video>
我的 app.component.ts 中有如下代码,
let scanner = new Instascan.Scanner({
video: document.getElementById('preview'),
mirror: false,
facingMode: { exact: 'environment' }});
Instascan.Camera.getCameras().then(cameras => {
if (cameras.length > 0) {
this.scanner.start(cameras[1]);
} else {
alert("Camera Permission denied");
window.location.reload();
}
}).catch(error => {
console.log(error);
window.location.reload();
})
Instascan面临问题,编译时出现如下错误, 找不到名称“Instascan”。