我的HTML5应用程序遇到了使用JavaScript解码条形码的问题。出于测试原因,我针对具有1055张图片的数据库(Muenster BarcodeDB,分辨率为600x800px)运行实现的算法。它适用于Windows上的Chrome和iPad 2上的Safari。但我的Moto G(Android)上的Chrome在20-30张图片后崩溃,没有任何消息。当我使用带有相机照片的HTML5 Media Capture时,它会在拍摄几张图片后崩溃,并且Chrome报告说,以前的操作没有足够的内存。当拍摄照片并关闭相机应用程序时,它会直接崩溃。然后再次显示浏览器,其中包含页面的简单信息。
有没有人面临同样的问题?下面是一些如何使用图片的代码。
HTML媒体捕获输入:
<input id="upload" type="file" accept="image/*" capture style="display:none;">
JavaScript Handler(用于旋转/缩放图像的exif.js,megapixImg.js):
fileInput.onchange = function () {
var file = fileInput.files[0];
imgOrientation = null;
// get orientation of image from exif data
EXIF.getData(file, function () {
imgOrientation = EXIF.getTag(this, "Orientation");
});
// MegaPixImage constructor accepts File/Blob object.
megapixImg = new MegaPixImage(file);
// Render resized image into image element using quality option.
// Quality option is valid when rendering into image element.
megapixImg.render(tempImg, { maxWidth: maxDimension, maxHeight: maxDimension, quality: 1.0 });
};
tempImg.onload = function () {
// Render resized image into canvas element.
megapixImg.render(tempCanvas, { maxWidth: maxDimension, maxHeight: maxDimension, orientation: imgOrientation });
// TRIGGER ALGORITHM
};
答案 0 :(得分:0)
对于HTML5媒体捕获问题,您可能会遇到以下错误: https://code.google.com/p/android/issues/detail?id=53088
不幸的是,Android开发人员已经将问题标记为过时,但事实并非如此。在上述主题中讨论了一些可能的解决方法,但它们都不能满足我的需求。也许你会有更好的运气。 :)