code: function startStreaming(errorCallback, onStreaming, okCallback) {
  
          var videoElement;
          var cameraStream;
          var attempts = 0;
          var readyListener = function(event) {
  
              findVideoSize();
  
          };
          var findVideoSize = function() {
  
              if(videoElement.videoWidth > 0 && videoElement.videoHeight > 0) {
  
                  videoElement.removeEventListener('loadeddata', readyListener);
                  onDimensionsReady(videoElement.videoWidth, videoElement.videoHeight);
  
              } else {
  
                  if(attempts < 10) {
  
                      attempts++;
                      setTimeout(findVideoSize, 200);
  
                  } else {
  
                      onDimensionsReady(640, 480);
  
                  }
  
              }
  
          };
          var onDimensionsReady = function(width, height) {
              okCallback(cameraStream, videoElement, width, height);
          };
          
          videoElement = document.createElement('video');
          videoElement.autoplay = true;
  
          videoElement.addEventListener('loadeddata', readyListener);
  
          navigator.getMedia({ video: true }, function (stream) {
  
              onStreaming();
  
              if(videoElement.mozSrcObject) {
                  videoElement.mozSrcObject = stream;
              } else {
                  videoElement.src = window.URL.createObjectURL(stream);
              }
  
              cameraStream = stream;
              videoElement.play();
  
          }, errorCallback);
  
      }
docs: Requests permission for using the user's camera,
  starts reading video from the selected camera, and calls
  `okCallback` when the video dimensions are known (with a fallback
  for when the dimensions are not reported on time),
  or calls `errorCallback` if something goes wrong