那年夏天
那年夏天
  • 发布:2017-04-24 18:10
  • 更新:2017-04-24 20:28
  • 阅读:1523

【报Bug】Barcode中的闪光灯打不开

分类:HTML5+

就是做一个扫描二维码的例子,照着官方文档的例子运行,结果可以扫描二维码,但是闪光灯打不开,还一直报错:

Uncaught TypeError: Cannot read property 'runtime' of undefined
Uncaught TypeError: Cannot call method 'removeAttribute' of null

2017-04-24 18:10 负责人:无 分享
已邀请:
LLgg

LLgg

这是开启闪光灯的代码,你看一下,记得引用mui.min.js,open_camera_flash.js文件,案例和文件我已经打包在附件里面了,记得下载(ps:附件在最下面)

<!DOCTYPE html>  
<html>  
<head>  
    <meta charset="utf-8">  
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />  
    <title>开启闪光灯和关闭闪光灯</title>  
    <link rel="stylesheet" href="css/mui.min.css" />  
    <script type="text/javascript" src="js/mui.min.js" ></script>  
    <script type="text/javascript" src="js/open_camera_flash.js" ></script>  
    <style type="text/css">  
    	p{  
    		width:100%;  
    		height: 60px;  
    		line-height: 60px;  
    		text-align: center;  
    		border:1px red solid;  
    	}  
    	p:active{opacity: .6;}  
    </style>  
</head>  
<body>  
	<p id="p1">开启闪光灯</p>  
	<p id="p2">关闭闪光灯</p>  
	<p id="p3">释放资源(界面关闭需释放)</p>  
	<script>  
		mui.plusReady(function(){  
			p1.addEventListener('tap',function(){  
				if(FlashControl)FlashControl.open();  
			});  
			p2.addEventListener('tap',function(){  
				if(FlashControl)FlashControl.close();  
			});  
			p3.addEventListener('tap',function(){  
				if(FlashControl)FlashControl.release();  
			});  
		});  
	</script>  
</body>  
</html>

这是我的网站,O(∩_∩)O谢谢支持----->>中旋网ZxlmWeb

该问题目前已经被锁定, 无法添加新回复