简体   繁体   English

读取QR码后如何在浏览器中关闭相机?

[英]How I can switch off camera in browser when I read a QR code?

Firstly sorry for my English. 首先,抱歉我的英语。

Well, my problem is this. 好吧,我的问题是这个。 I'm using this library for read QRcodes in my WebApp. 我正在使用此库在WebApp中读取QR码。 My QR codes contain links to other parts of my application, but when it redirect me, the camera is not turned off because (I think) that is using AngularJS routes. 我的QR代码包含到应用程序其他部分的链接,但是当它重定向我时,由于(我认为)正在使用AngularJS路由,因此相机未关闭。 My question is, how I can force to reload the page when it redirect me ? 我的问题是,当我重定向页面时,如何强制重新加载该页面? By this way the camera will be turn off. 这样,相机将关闭。

This is my code for turn on the cámera and read the QR: 这是我打开cámera并阅读QR的代码:

        app.controller("ReadQRCtrl", function() {
          $(document).ready(function() {
            $('#reader').html5_qrcode(function(data) {
                 window.location.href ="http://localhost/SCTraker/Application/appIndex#/"+data;
            },
            function(error) {
                 console.log(error);
            }, function(videoError) {
                 console.log(videoError);
            }
         );
      });
  });

Resolved!! 解决!! It a bug of the library, I uploaded the library to my GitHub: https://github.com/emilioxiri/html5_qrcode 这是一个库的错误,我将库上传到了我的GitHub: https : //github.com/emilioxiri/html5_qrcode

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM