Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Ambrosini <marcoambrosini@pm.me>2021-06-09 16:35:47 +0300
committerMarco Ambrosini <marcoambrosini@pm.me>2021-06-11 15:25:52 +0300
commite4ee98c30d4041c47c2ee2b100cc2f0d9be1148c (patch)
treebaf2848cd86b5edc7c93dd2950ff2df8fe1d0734 /src/components/NewMessageForm
parent6a3bee4113af96a9cd3d523bdadeb1e2f2eb3911 (diff)
Generate proper file name
Signed-off-by: Marco Ambrosini <marcoambrosini@pm.me>
Diffstat (limited to 'src/components/NewMessageForm')
-rw-r--r--src/components/NewMessageForm/AudioRecorder/AudioRecorder.vue13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/components/NewMessageForm/AudioRecorder/AudioRecorder.vue b/src/components/NewMessageForm/AudioRecorder/AudioRecorder.vue
index f65c9d6a5..74b31da29 100644
--- a/src/components/NewMessageForm/AudioRecorder/AudioRecorder.vue
+++ b/src/components/NewMessageForm/AudioRecorder/AudioRecorder.vue
@@ -238,8 +238,10 @@ export default {
this.audioStream.getTracks().forEach(track => track.stop())
if (!this.aborted) {
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], `${Date.now()}.mp3`)
+ const audioFile = new File([this.blob], fileName)
this.$emit('audioFile', audioFile)
this.$emit('recording', false)
this.URL = window.URL.createObjectURL(this.blob)
@@ -270,6 +272,15 @@ export default {
seconds: 0,
}
},
+
+ generateFileName() {
+ const token = this.$store.getters.getToken()
+ const conversation = this.$store.getters.conversation(token).name
+ const today = new Date()
+ let time = today.getFullYear() + '-' + ('0' + today.getMonth()).slice(-2) + '-' + ('0' + today.getDay()).slice(-2)
+ time += ' ' + ('0' + today.getHours()).slice(-2) + '-' + ('0' + today.getMinutes()).slice(-2) + '-' + ('0' + today.getSeconds()).slice(-2)
+ return t('spreed', 'Talk recording from {time} ({conversation})', { time, conversation }) + '.mp3'
+ },
},
}
</script>