Fix audio recordings
This commit is contained in:
parent
95d404c70b
commit
5246698541
1 changed files with 7 additions and 11 deletions
|
@ -25,18 +25,17 @@
|
||||||
this.start();
|
this.start();
|
||||||
},
|
},
|
||||||
events: {
|
events: {
|
||||||
'click .close': 'close',
|
'click .close': 'remove',
|
||||||
'click .finish': 'finish',
|
'click .finish': 'finish',
|
||||||
close: 'close',
|
close: 'remove',
|
||||||
},
|
},
|
||||||
onSwitchAway() {
|
onSwitchAway() {
|
||||||
this.lostFocus = true;
|
this.lostFocus = true;
|
||||||
this.recorder.finishRecording();
|
this.recorder.finishRecording();
|
||||||
this.close();
|
|
||||||
},
|
},
|
||||||
handleKeyDown(event) {
|
handleKeyDown(event) {
|
||||||
if (event.key === 'Escape') {
|
if (event.key === 'Escape') {
|
||||||
this.close();
|
this.remove();
|
||||||
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
@ -51,7 +50,7 @@
|
||||||
}
|
}
|
||||||
this.$('.time').text(`${minutes}:${seconds}`);
|
this.$('.time').text(`${minutes}:${seconds}`);
|
||||||
},
|
},
|
||||||
close() {
|
remove() {
|
||||||
// Note: the 'close' event can be triggered by InboxView, when the user clicks
|
// Note: the 'close' event can be triggered by InboxView, when the user clicks
|
||||||
// anywhere outside the recording pane.
|
// anywhere outside the recording pane.
|
||||||
|
|
||||||
|
@ -81,7 +80,7 @@
|
||||||
}
|
}
|
||||||
this.context = null;
|
this.context = null;
|
||||||
|
|
||||||
this.remove();
|
Whisper.View.prototype.remove.call(this);
|
||||||
this.trigger('closed');
|
this.trigger('closed');
|
||||||
|
|
||||||
$(window).off('blur', this.onSwitchAwayBound);
|
$(window).off('blur', this.onSwitchAwayBound);
|
||||||
|
@ -91,16 +90,14 @@
|
||||||
finish() {
|
finish() {
|
||||||
this.clickedFinish = true;
|
this.clickedFinish = true;
|
||||||
this.recorder.finishRecording();
|
this.recorder.finishRecording();
|
||||||
this.close();
|
|
||||||
},
|
},
|
||||||
handleBlob(recorder, blob) {
|
handleBlob(recorder, blob) {
|
||||||
if (blob && this.clickedFinish) {
|
if (blob && this.clickedFinish) {
|
||||||
this.trigger('send', blob);
|
this.trigger('send', blob);
|
||||||
} else if (blob) {
|
} else if (blob) {
|
||||||
this.trigger('confirm', blob, this.lostFocus);
|
this.trigger('confirm', blob, this.lostFocus);
|
||||||
} else {
|
|
||||||
this.close();
|
|
||||||
}
|
}
|
||||||
|
this.remove();
|
||||||
},
|
},
|
||||||
start() {
|
start() {
|
||||||
this.lostFocus = false;
|
this.lostFocus = false;
|
||||||
|
@ -126,7 +123,6 @@
|
||||||
},
|
},
|
||||||
onTimeout() {
|
onTimeout() {
|
||||||
this.recorder.finishRecording();
|
this.recorder.finishRecording();
|
||||||
this.close();
|
|
||||||
},
|
},
|
||||||
onError(error) {
|
onError(error) {
|
||||||
// Protect against out-of-band errors, which can happen if the user revokes media
|
// Protect against out-of-band errors, which can happen if the user revokes media
|
||||||
|
@ -135,7 +131,7 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.close();
|
this.remove();
|
||||||
|
|
||||||
if (error && error.name === 'NotAllowedError') {
|
if (error && error.name === 'NotAllowedError') {
|
||||||
window.log.warn(
|
window.log.warn(
|
||||||
|
|
Loading…
Reference in a new issue