我的目标是通过 iPhone 或 iPad 上的前置摄像头使用英特尔 XDK 条码扫描仪。请帮助我目前有简单的代码片段
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0" />
<style type="text/css">
* { -webkit-user-select:none; -webkit-tap-highlight-color:rgba(0, 0, 0, 0);
</style>
<script src='intelxdk.js'></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript">
var onDeviceReady=function(){
//hide splash screen
intel.xdk.device.hideSplashScreen();
//intel.xdk.device.scanBarcode();
};
document.addEventListener("intel.xdk.device.ready",onDeviceReady,false);
document.addEventListener("intel.xdk.device.barcode.scan", barcodeScanned, false);
function barcodeScanned(evt) {
intel.xdk.notification.beep(1);
if (evt.type == "intel.xdk.device.barcode.scan") {
if (evt.success == true) {
var url = evt.codedata;
//intel.xdk.device.showRemoteSite(url, 264, 0,56, 48)
alert(evt.codedata);
} else {
//scan cancelled
}
}
}
$(document).ready(function(){
$("#scanBtn").click(function(){
intel.xdk.device.scanBarcode();
});
});
</script>
</head>
<body>
<a href="javascript:void(0);" id="scanBtn" style="color:red">Scan Now</a>
</body>
</html>