Remove recorder UI when we fail to 'getUserMedia'
FREEBIE
This commit is contained in:
parent
475ae469f1
commit
98f88607a0
1 changed files with 5 additions and 2 deletions
|
@ -34,7 +34,9 @@
|
||||||
if (this.interval) {
|
if (this.interval) {
|
||||||
clearInterval(this.interval);
|
clearInterval(this.interval);
|
||||||
}
|
}
|
||||||
|
if (this.source) {
|
||||||
this.source.disconnect();
|
this.source.disconnect();
|
||||||
|
}
|
||||||
if (this.context) {
|
if (this.context) {
|
||||||
this.context.close().then(function() {
|
this.context.close().then(function() {
|
||||||
console.log('audio context closed');
|
console.log('audio context closed');
|
||||||
|
@ -64,11 +66,12 @@
|
||||||
navigator.webkitGetUserMedia({ audio: true }, function(stream) {
|
navigator.webkitGetUserMedia({ audio: true }, function(stream) {
|
||||||
this.source = this.context.createMediaStreamSource(stream);
|
this.source = this.context.createMediaStreamSource(stream);
|
||||||
this.source.connect(this.input);
|
this.source.connect(this.input);
|
||||||
}.bind(this), this.onError);
|
}.bind(this), this.onError.bind(this));
|
||||||
this.recorder.startRecording();
|
this.recorder.startRecording();
|
||||||
},
|
},
|
||||||
onError: function(error) {
|
onError: function(error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
|
this.close();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
})();
|
})();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue