docs/index.js
function gotMedia(mediaStream) {
  // Extract video track.
  videoDevice = mediaStream.getVideoTracks()[0];
  log('Using camera', videoDevice.label);

  const captureDevice = new ImageCapture(videoDevice, mediaStream);
  interval = setInterval(function () {
    captureDevice.grabFrame().then(processFrame).catch(error => {
      err((new Date()).toISOString(), 'Error while grabbing frame:', error);
    });

    captureDevice.takePhoto().then(processPhoto).catch(error => {
      err((new Date()).toISOString(), 'Error while taking photo:', error);
    });
  }, 300);
}
function gotMedia(mediaStream) {
  // Extract video track.
  videoDevice = mediaStream.getVideoTracks()[0];
  log('Using camera', videoDevice.label);

  const captureDevice = new ImageCapture(videoDevice, mediaStream);
  interval = setInterval(function () {
    captureDevice.grabFrame().then(processFrame).catch(error => {
      err((new Date()).toISOString(), 'Error while grabbing frame:', error);
    });

    captureDevice.takePhoto().then(processPhoto).catch(error => {
      err((new Date()).toISOString(), 'Error while taking photo:', error);
    });
  }, 300);
}
function gotMedia ( mediaStream ) { // Extract video track. videoDevice = mediaStream . getVideoTracks ( ) [ 0 ] ; log ( 'Using camera' , videoDevice . label ) ; const captureDevice = new ImageCapture ( videoDevice , mediaStream ) ; interval = setInterval ( function ( ) { captureDevice . grabFrame ( ) . then ( processFrame ) . catch ( error => { err ( ( new Date ( ) ) . toISOString ( ) , 'Error while grabbing frame:' , error ) ; } ) ; captureDevice . takePhoto ( ) . then ( processPhoto ) . catch ( error => { err ( ( new Date ( ) ) . toISOString ( ) , 'Error while taking photo:' , error ) ; } ) ; } , 300 ) ; }
We have a video capture device. Exercise various capturing modes.
@param {MediaStream} mediaStream
We have a video capture device . Exercise various capturing modes .