diff options
author | Marco Ambrosini <marcoambrosini@pm.me> | 2021-06-16 20:38:59 +0300 |
---|---|---|
committer | Marco Ambrosini <marcoambrosini@pm.me> | 2021-06-16 20:38:59 +0300 |
commit | 289b7a84076af78a08584c8f7d45ae98399624a2 (patch) | |
tree | 912aba95ff2ba41b5a1f39f9c4353c860f0c6116 /src/components/NewMessageForm | |
parent | 8bbf42e984c8568f2f9b26b40272ad4b6abe217a (diff) |
Display voice message preview before uploading
Signed-off-by: Marco Ambrosini <marcoambrosini@pm.me>
Diffstat (limited to 'src/components/NewMessageForm')
-rw-r--r-- | src/components/NewMessageForm/AudioRecorder/AudioRecorder.vue | 6 | ||||
-rw-r--r-- | src/components/NewMessageForm/NewMessageForm.vue | 2 |
2 files changed, 3 insertions, 5 deletions
diff --git a/src/components/NewMessageForm/AudioRecorder/AudioRecorder.vue b/src/components/NewMessageForm/AudioRecorder/AudioRecorder.vue index 74b31da29..75db41114 100644 --- a/src/components/NewMessageForm/AudioRecorder/AudioRecorder.vue +++ b/src/components/NewMessageForm/AudioRecorder/AudioRecorder.vue @@ -102,8 +102,6 @@ export default { chunks: [], // The final audio file blob blob: null, - // The blob url - URL: '', // Switched to true if the recording is aborted aborted: false, // recordTimer @@ -237,14 +235,14 @@ export default { generateFile() { this.audioStream.getTracks().forEach(track => track.stop()) if (!this.aborted) { - this.blob = new Blob(this.chunks, { 'type': 'audio/mpeg-3' }) + this.blob = new Blob(this.chunks, { type: 'audio/mpeg-3' }) // Generate file name const fileName = this.generateFileName() // Convert blob to file const audioFile = new File([this.blob], fileName) + audioFile.localURL = window.URL.createObjectURL(this.blob) this.$emit('audioFile', audioFile) this.$emit('recording', false) - this.URL = window.URL.createObjectURL(this.blob) } this.resetComponentData() }, diff --git a/src/components/NewMessageForm/NewMessageForm.vue b/src/components/NewMessageForm/NewMessageForm.vue index a21b2cebc..d1fd2064b 100644 --- a/src/components/NewMessageForm/NewMessageForm.vue +++ b/src/components/NewMessageForm/NewMessageForm.vue @@ -170,7 +170,7 @@ export default { }, }, - data: function() { + data() { return { text: '', parsedText: '', |