title: Angular5 Instascan - Open Camera Not Working <video>
body: <p>Angular5 - Instascan - Show Camera View (video tag) Not Working. But my camera is open.</p>
  
  <hr>
  
  <p>app.component.ts</p>
  
  <pre><code>constructor(){    
  this.Instascan= require('instascan'); 
  
  let scanner = new this.Instascan.Scanner({ video: document.getElementById("preview") });
  
  scanner.addListener('scan', function (content) {
    console.log(content);
  });
  this.Instascan.Camera.getCameras().then(function (cameras) {
    if (cameras.length &gt; 0) {
      scanner.start(cameras[0]);
    } else {
      console.error('No cameras found.');
    }
  }).catch(function (e) {
    console.error(e);
  });
  }
  </code></pre>
  
  <p>app.component.html</p>
  
  <pre><code>&lt;video id="preview"&gt;&lt;/video&gt;
  </code></pre>
  
  <p>Instascan --- <a href="https://github.com/schmich/instascan" rel="nofollow noreferrer">https://github.com/schmich/instascan</a></p>