|
|
|
@ -86,7 +86,7 @@
|
|
|
|
|
<hr />
|
|
|
|
|
<img id="idCard" width="102" height="126" alt="" />
|
|
|
|
|
<script>
|
|
|
|
|
var appBasePath = navigator.userAgent.split('|')[1];
|
|
|
|
|
var appBasePath = window.chrome.webview.hostObjects.sync.dotnet.GetAppPath();
|
|
|
|
|
//window.chrome.webview.postMessage({ command: "setStatus", message: `start at ${appBasePath}` });
|
|
|
|
|
|
|
|
|
|
function onIdCardRead(card) {
|
|
|
|
@ -213,30 +213,33 @@
|
|
|
|
|
var context = canvas.getContext('2d');
|
|
|
|
|
context.drawImage(video, (video.width - width) / 2, (video.height - height) / 2, width, height, 0, 0, width, height);
|
|
|
|
|
};
|
|
|
|
|
function init() {
|
|
|
|
|
select.onchange = function (event) {
|
|
|
|
|
var hdConstraints = {
|
|
|
|
|
audio: false,
|
|
|
|
|
video: {
|
|
|
|
|
width: { min: 640, ideal: 1280, max: 1920 },
|
|
|
|
|
height: { min: 360, ideal: 720, max: 1080 },
|
|
|
|
|
deviceId: event.target.value
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
navigator.mediaDevices.getUserMedia(hdConstraints).then(function (mediaStream) {
|
|
|
|
|
video.srcObject = mediaStream;
|
|
|
|
|
video.addEventListener("loadedmetadata", function (e) {
|
|
|
|
|
video.width = e.srcElement.videoWidth;
|
|
|
|
|
video.height = e.srcElement.videoHeight;
|
|
|
|
|
//var wrapper = document.querySelector('.videoWrapper');
|
|
|
|
|
//wrapper.style.width = video.width + 'px';
|
|
|
|
|
//wrapper.style.height = video.height + 'px';
|
|
|
|
|
video.play();
|
|
|
|
|
});
|
|
|
|
|
}, function (err) {
|
|
|
|
|
console.error('getUserMediaErrorCallback')
|
|
|
|
|
});
|
|
|
|
|
select.onchange = function (event) {
|
|
|
|
|
var hdConstraints = {
|
|
|
|
|
audio: false,
|
|
|
|
|
video: {
|
|
|
|
|
width: { min: 640, ideal: 1280, max: 1920 },
|
|
|
|
|
height: { min: 360, ideal: 720, max: 1080 },
|
|
|
|
|
deviceId: event.target.value
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
navigator.mediaDevices.getUserMedia(hdConstraints).then(function (mediaStream) {
|
|
|
|
|
video.srcObject = mediaStream;
|
|
|
|
|
video.addEventListener("loadedmetadata", function (e) {
|
|
|
|
|
video.width = e.srcElement.videoWidth;
|
|
|
|
|
video.height = e.srcElement.videoHeight;
|
|
|
|
|
//var wrapper = document.querySelector('.videoWrapper');
|
|
|
|
|
//wrapper.style.width = video.width + 'px';
|
|
|
|
|
//wrapper.style.height = video.height + 'px';
|
|
|
|
|
video.play();
|
|
|
|
|
});
|
|
|
|
|
}, function (err) {
|
|
|
|
|
console.error('getUserMediaErrorCallback')
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
function init() {
|
|
|
|
|
if (video.srcObject&&video.srcObject.active) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
navigator.mediaDevices.enumerateDevices()
|
|
|
|
|
.then(function (devices) {
|
|
|
|
|
select.innerHTML = "";
|
|
|
|
@ -255,7 +258,8 @@
|
|
|
|
|
console.log(err.name + ": " + err.message);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
init();
|
|
|
|
|
setInterval(init, 5000);
|
|
|
|
|
//init();
|
|
|
|
|
</script>
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|