function startFrameCapture(videoTag, duration) {
  var inputElement = document.getElementById('local-view');
  var width = inputElement.videoWidth;
  var height = inputElement.videoHeight;

  // |videoBitsPerSecond| is set to a large number to indicate VP8 to throw as
  // little information away as possible.
  var mediaRecorderOptions = {'videoBitsPerSecond': 4 * width * height * gFps};
  var stream = getStreamFromElement_(videoTag);
  gCaptureDuration = 1000 * duration;

  var mediaRecorder = new MediaRecorder(stream, mediaRecorderOptions);

  mediaRecorder.ondataavailable = function(recording) {
    gChunks.push(recording.data);
  }
  mediaRecorder.onstop = function() {
    var videoBlob = new Blob(gChunks, {type: "video/webm"});
    gChunks = [];
    var reader = new FileReader();
    reader.onloadend = function() {
      gVideoBase64 = reader.result.substr(reader.result.indexOf(',') + 1);
      gCapturingStatus = 'done-capturing';
      debug('done-capturing');
    }
    reader.readAsDataURL(videoBlob);
  }

  mediaRecorder.start();
  setTimeout(function() { mediaRecorder.stop(); }, gCaptureDuration);
  gCapturingStatus = 'still-capturing';
}
/**
 * Starts the frame capturing.
 *
 * @param {!Object} The video tag from which the height and width parameters are
 *                  to be extracted.
 * @param {Number} The duration of the frame capture in seconds.
 */
Starts the frame capturing.
@param {!Object} The video tag from which the height and width parameters are
to be extracted.
@param {Number} The duration of the frame capture in seconds.
Starts the frame capturing . @param { !Object } The video tag from which the height and width parameters are to be extracted . @param { Number } The duration of the frame capture in seconds .
function startFrameCapture(videoTag, duration) {
  var inputElement = document.getElementById('local-view');
  var width = inputElement.videoWidth;
  var height = inputElement.videoHeight;
  var mediaRecorderOptions = {'videoBitsPerSecond': 4 * width * height * gFps};
  var stream = getStreamFromElement_(videoTag);
  gCaptureDuration = 1000 * duration;
  var mediaRecorder = new MediaRecorder(stream, mediaRecorderOptions);
  mediaRecorder.ondataavailable = function(recording) {
    gChunks.push(recording.data);
  }
  mediaRecorder.onstop = function() {
    var videoBlob = new Blob(gChunks, {type: "video/webm"});
    gChunks = [];
    var reader = new FileReader();
    reader.onloadend = function() {
      gVideoBase64 = reader.result.substr(reader.result.indexOf(',') + 1);
      gCapturingStatus = 'done-capturing';
      debug('done-capturing');
    }
    reader.readAsDataURL(videoBlob);
  }
  mediaRecorder.start();
  setTimeout(function() { mediaRecorder.stop(); }, gCaptureDuration);
  gCapturingStatus = 'still-capturing';
}
function startFrameCapture ( videoTag , duration ) { var inputElement = document . getElementById ( 'local-view' ) ; var width = inputElement . videoWidth ; var height = inputElement . videoHeight ; var mediaRecorderOptions = { 'videoBitsPerSecond' : 4 * width * height * gFps } ; var stream = getStreamFromElement_ ( videoTag ) ; gCaptureDuration = 1000 * duration ; var mediaRecorder = new MediaRecorder ( stream , mediaRecorderOptions ) ; mediaRecorder . ondataavailable = function ( recording ) { gChunks . push ( recording . data ) ; } mediaRecorder . onstop = function ( ) { var videoBlob = new Blob ( gChunks , { type : "video/webm" } ) ; gChunks = [ ] ; var reader = new FileReader ( ) ; reader . onloadend = function ( ) { gVideoBase64 = reader . result . substr ( reader . result . indexOf ( ',' ) + 1 ) ; gCapturingStatus = 'done-capturing' ; debug ( 'done-capturing' ) ; } reader . readAsDataURL ( videoBlob ) ; } mediaRecorder . start ( ) ; setTimeout ( function ( ) { mediaRecorder . stop ( ) ; } , gCaptureDuration ) ; gCapturingStatus = 'still-capturing' ; }
Starts the frame capturing.
Starts the frame capturing .
// |videoBitsPerSecond| is set to a large number to indicate VP8 to throw as // little information away as possible.