function startRecording() {
  var options = {mimeType: 'video/webm', bitsPerSecond: 100000};
  recordedBlobs = [];
  try {
    mediaRecorder = new MediaRecorder(window.stream, options);
  } catch (e0) {
    console.log('Unable to create MediaRecorder with options Object: ', e0);
    try {
      options = {mimeType: 'video/webm,codecs=vp9', bitsPerSecond: 100000};
      mediaRecorder = new MediaRecorder(window.stream, options);
    } catch (e1) {
      console.log('Unable to create MediaRecorder with options Object: ', e1);
      try {
        options = 'video/vp8'; // Chrome 47
        mediaRecorder = new MediaRecorder(window.stream, options);
      } catch (e2) {
        alert('MediaRecorder is not supported by this browser.\n\n' +
            'Try Firefox 29 or later, or Chrome 47 or later, with Enable experimental Web Platform features enabled from chrome://flags.');
        console.error('Exception while creating MediaRecorder:', e2);
        return;
      }
    }
  }
  console.log('Created MediaRecorder', mediaRecorder, 'with options', options);
  recordButton.textContent = 'Stop Recording';
  playButton.disabled = true;
  downloadButton.disabled = true;
  mediaRecorder.onstop = handleStop;
  mediaRecorder.ondataavailable = handleDataAvailable;
  mediaRecorder.start(10); // collect 10ms of data
  console.log('MediaRecorder started', mediaRecorder);
}
// The nested try blocks will be simplified when Chrome 47 moves to Stable
The nested try blocks will be simplified when Chrome 47 moves to Stable
The nested try blocks will be simplified when Chrome 47 moves to Stable
function startRecording() {
  var options = {mimeType: 'video/webm', bitsPerSecond: 100000};
  recordedBlobs = [];
  try {
    mediaRecorder = new MediaRecorder(window.stream, options);
  } catch (e0) {
    console.log('Unable to create MediaRecorder with options Object: ', e0);
    try {
      options = {mimeType: 'video/webm,codecs=vp9', bitsPerSecond: 100000};
      mediaRecorder = new MediaRecorder(window.stream, options);
    } catch (e1) {
      console.log('Unable to create MediaRecorder with options Object: ', e1);
      try {
        options = 'video/vp8'; 
        mediaRecorder = new MediaRecorder(window.stream, options);
      } catch (e2) {
        alert('MediaRecorder is not supported by this browser.\n\n' +
            'Try Firefox 29 or later, or Chrome 47 or later, with Enable experimental Web Platform features enabled from chrome://flags.');
        console.error('Exception while creating MediaRecorder:', e2);
        return;
      }
    }
  }
  console.log('Created MediaRecorder', mediaRecorder, 'with options', options);
  recordButton.textContent = 'Stop Recording';
  playButton.disabled = true;
  downloadButton.disabled = true;
  mediaRecorder.onstop = handleStop;
  mediaRecorder.ondataavailable = handleDataAvailable;
  mediaRecorder.start(10); 
  console.log('MediaRecorder started', mediaRecorder);
}
function startRecording ( ) { var options = { mimeType : 'video/webm' , bitsPerSecond : 100000 } ; recordedBlobs = [ ] ; try { mediaRecorder = new MediaRecorder ( window . stream , options ) ; } catch ( e0 ) { console . log ( 'Unable to create MediaRecorder with options Object: ' , e0 ) ; try { options = { mimeType : 'video/webm,codecs=vp9' , bitsPerSecond : 100000 } ; mediaRecorder = new MediaRecorder ( window . stream , options ) ; } catch ( e1 ) { console . log ( 'Unable to create MediaRecorder with options Object: ' , e1 ) ; try { options = 'video/vp8' ; mediaRecorder = new MediaRecorder ( window . stream , options ) ; } catch ( e2 ) { alert ( 'MediaRecorder is not supported by this browser.\n\n' + 'Try Firefox 29 or later, or Chrome 47 or later, with Enable experimental Web Platform features enabled from chrome://flags.' ) ; console . error ( 'Exception while creating MediaRecorder:' , e2 ) ; return ; } } } console . log ( 'Created MediaRecorder' , mediaRecorder , 'with options' , options ) ; recordButton . textContent = 'Stop Recording' ; playButton . disabled = true ; downloadButton . disabled = true ; mediaRecorder . onstop = handleStop ; mediaRecorder . ondataavailable = handleDataAvailable ; mediaRecorder . start ( 10 ) ; console . log ( 'MediaRecorder started' , mediaRecorder ) ; }
The nested try blocks will be simplified when Chrome 47 moves to Stable
The nested try blocks will be simplified when Chrome 47 moves to Stable
// Chrome 47 // collect 10ms of data