我正在尋找掃描條形碼並根據是否收到條形碼返回響應的方式。我可以找到唯一的結果指向英特爾XDK。我不能在這個特定的項目中使用它,所以沒有它可以做到這一點? 如何使用HTML5/JavaScript掃描條形碼?在HTML5/JavaScript中掃描條形碼
Here is the link I found originally,看起來如果我能夠使用英特爾XDK,它可以完成這項工作。讓我知道我可以在這個問題上增加更多的內容,我只需要指出正確的方向,因爲我不知道從何處開始或者在訪問相機後如何進行實際掃描。下面是我使用的訪問和顯示設備攝像頭的代碼:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta content="stuff, to, help, search, engines, not" name="keywords">
<meta content="What this page is about." name="description">
<meta content="Display Webcam Stream" name="title">
<title>Display Webcam Stream</title>
<style>
#container {
margin: 0px auto;
width: 500px;
height: 375px;
border: 10px #333 solid;
}
#videoElement {
width: 500px;
height: 375px;
background-color: #666;
}
</style>
</head>
<body>
<div id="container">
<video autoplay="true" id="videoElement" controls="true">
</video>
</div>
<script>
var video = document.querySelector("#videoElement");
navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia || navigator.oGetUserMedia;
if (navigator.getUserMedia)
{
navigator.getUserMedia({video: true}, handleVideo, videoError);
}
function handleVideo(stream)
{
video.src = window.URL.createObjectURL(stream);
}
function videoError(e)
{
alert("I don't understand. Why did you not allow it?");
}
</script>
</body>
</html>
我想我半小時前也看到了這個問題,但無法再找到它。你重做了你的問題嗎? –