@@ -40,7 +40,7 @@ var isSecureOrigin = location.protocol === 'https:' ||
40
40
location . host === 'localhost' ;
41
41
if ( ! isSecureOrigin ) {
42
42
alert ( 'getUserMedia() must be run from a secure origin: HTTPS or localhost.' +
43
- '\n\nChanging protocol to HTTPS' ) ;
43
+ '\n\nChanging protocol to HTTPS' ) ;
44
44
location . protocol = 'HTTPS' ;
45
45
}
46
46
@@ -80,21 +80,28 @@ function toggleRecording() {
80
80
}
81
81
}
82
82
83
+ // The nested try blocks will be simplified when Chrome 47 moves to Stable
83
84
function startRecording ( ) {
84
85
var options = { mimeType : 'video/vp9' } ;
86
+ recordedBlobs = [ ] ;
85
87
try {
86
- recordedBlobs = [ ] ;
87
88
mediaRecorder = new MediaRecorder ( window . stream , options ) ;
88
- } catch ( e ) {
89
+ } catch ( e0 ) {
90
+ console . log ( 'Unable to create MediaRecorder with options Object: ' , e0 ) ;
89
91
try {
90
- console . log ( 'Unable to create MediaRecorder with options Object: ' , e ) ;
91
- options = 'video/vp8' ; // Chrome 47
92
+ options = { mimeType : 'video/vp9' } ;
92
93
mediaRecorder = new MediaRecorder ( window . stream , options ) ;
93
- } catch ( exc ) {
94
- alert ( 'MediaRecorder is not supported by this browser.\n\n' +
95
- 'Try Firefox 29 or later, or Chrome 47 or later, with Enable experimental Web Platform features enabled from chrome://flags.' ) ;
96
- console . error ( 'Exception while creating MediaRecorder:' , exc ) ;
97
- return ;
94
+ } catch ( e1 ) {
95
+ console . log ( 'Unable to create MediaRecorder with options Object: ' , e1 ) ;
96
+ try {
97
+ options = 'video/vp8' ; // Chrome 47
98
+ mediaRecorder = new MediaRecorder ( window . stream , options ) ;
99
+ } catch ( e2 ) {
100
+ alert ( 'MediaRecorder is not supported by this browser.\n\n' +
101
+ 'Try Firefox 29 or later, or Chrome 47 or later, with Enable experimental Web Platform features enabled from chrome://flags.' ) ;
102
+ console . error ( 'Exception while creating MediaRecorder:' , e2 ) ;
103
+ return ;
104
+ }
98
105
}
99
106
}
100
107
console . log ( 'Created MediaRecorder' , mediaRecorder , 'with options' , options ) ;
0 commit comments