title: Typescript/Angular2 getUserMedia is not defined
body: <p>I have an Ionic 2 App which uses <a href="https://github.com/serratus/quaggaJS" rel="nofollow noreferrer">QuaggaJS Github</a> to Stream the Camera to my View (Div Container) like Snapchat to scan QR Codes. In the browser, it all works like a charm but, the moment it gets built as APK or IPA file I'm getting the Error:</p>
  
  <pre><code>chromium: [INFO:CONSOLE(76955)] "Error: getUserMedia is not defined"
  </code></pre>
  
  <p>I used ADB and a Virutal Android Device to get the logcat output.
  <strong>Important Info: Yes I have Camera Permission!</strong></p>
  
  <p>Just in case you cant visualize what I'm talking about ,here is a Screenshot of my Page View:
  <a href="https://i.stack.imgur.com/tWB6C.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tWB6C.jpg" alt="Screenshot of Scanner"></a></p>
  
  <p>And this is my Typescript code:</p>
  
  <pre><code>import { Component, OnInit } from '@angular/core';
  import { IonicPage, NavController, NavParams, MenuController } from 'ionic-angular';
  import Quagga from 'quagga';
  declare var Quagga:any;
  
  @Component({
    selector: 'page-scanner',
    templateUrl: 'scanner.html',
  })
  export class Scanner implements OnInit {
  
    constructor(public navCtrl: NavController,
      public navParams: NavParams,
      public menu: MenuController) {
    }
     ngOnInit() {
       //WARNING:
       //Error: Types of property 'lift' are incompatible -&gt; means
       //that the used typescript version is too high. Works with: 2.3.4 atm
  
       Quagga.init({
           inputStream : {
               name : "Live",
               type : "LiveStream",
               constraints: {
                 width:  window.innerWidth,
                 height: window.innerHeight,
                 facingMode: "environment"
               },
               area: {
                  top: "0%",
                  right: "0%",
                  left: "0%",
                  bottom: "0%"
              },
              // Or '#yourElement' (optional)
             target: document.querySelector('#scanner')
           },
           locator: {
             patchSize: "medium",
             halfSample: true
           },
           numOfWorkers: (navigator.hardwareConcurrency ? navigator.hardwareConcurrency : 4),
           decoder : {
            //Change Reader for the right Codes
            readers: [ "code_128_reader",
                       "ean_reader",
                       "ean_8_reader",
                       "code_39_reader",
                       "code_39_vin_reader",
                       "codabar_reader",
                       "upc_reader",
                       "upc_e_reader",
                       "i2of5_reader" ],
           },
           locate: true
         }, function(err) {
             if (err) {
                 console.log(err);
                 return
             }
             console.log("Initialization finished. Ready to start");
             Quagga.start();
         });
         // Make sure, QuaggaJS draws frames an lines around possible
          // barcodes on the live stream
          Quagga.onProcessed(function(result) {
              var drawingCtx = Quagga.canvas.ctx.overlay,
                  drawingCanvas = Quagga.canvas.dom.overlay;
  
              if (result) {
                  if (result.boxes) {
                      drawingCtx.clearRect(0, 0, parseInt(drawingCanvas.getAttribute("width")), parseInt(drawingCanvas.getAttribute("height")));
                      result.boxes.filter(function (box) {
                          return box !== result.box;
                      }).forEach(function (box) {
                          Quagga.ImageDebug.drawPath(box, {x: 0, y: 1}, drawingCtx, {color: "green", lineWidth: 2});
                      });
                  }
  
                  if (result.box) {
                      Quagga.ImageDebug.drawPath(result.box, {x: 0, y: 1}, drawingCtx, {color: "#00F", lineWidth: 2});
                  }
  
                  if (result.codeResult &amp;&amp; result.codeResult.code) {
                      Quagga.ImageDebug.drawPath(result.line, {x: 'x', y: 'y'}, drawingCtx, {color: 'red', lineWidth: 3});
                  }
              }
          });
        // Once a barcode had been read successfully, stop quagga and
        // close the modal after a second to let the user notice where
        // the barcode had actually been found.
        Quagga.onDetected(function(result) {
          if (result.codeResult.code){
          // Was passieren soll wenn ein Code gescannt wurde
          //  $('#scanner_input').val(result.codeResult.code);
          }
        });
     }
     ionViewWillLeave(){
       Quagga.stop();
     }
  }
  </code></pre>