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-07-01 18:24:28 +0300
committerMarco Ambrosini <marcoambrosini@pm.me>2021-07-01 18:24:28 +0300
commit200bf7f1834574cba362f3b5442eead11f3e5904 (patch)
tree9329ba4663cbab41ba57ab971598c26536929061 /src/components/NewMessageForm
parent96b89c0f2150aac5e7ea8f1392f6c9224349524e (diff)
Always stop audio streams
Signed-off-by: Marco Ambrosini <marcoambrosini@pm.me>
Diffstat (limited to 'src/components/NewMessageForm')
-rw-r--r--src/components/NewMessageForm/AudioRecorder/AudioRecorder.vue18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/components/NewMessageForm/AudioRecorder/AudioRecorder.vue b/src/components/NewMessageForm/AudioRecorder/AudioRecorder.vue
index f0e47bb47..f4a46b67d 100644
--- a/src/components/NewMessageForm/AudioRecorder/AudioRecorder.vue
+++ b/src/components/NewMessageForm/AudioRecorder/AudioRecorder.vue
@@ -160,6 +160,10 @@ export default {
await register(await connect())
},
+ beforeDestroy() {
+ this.killStreams()
+ },
+
methods: {
/**
* Initialize the media stream and start capturing the audio
@@ -173,6 +177,7 @@ export default {
})
} catch (exception) {
console.debug(exception)
+ this.killStreams()
if (exception.name === 'NotAllowedError') {
showError(t('spreed', 'Access to the microphone was denied'))
} else {
@@ -188,7 +193,7 @@ export default {
})
} catch (exception) {
console.debug(exception)
- this.audioStream.getTracks().forEach(track => track.stop())
+ this.killStreams()
this.audioStream = null
showError(t('spreed', 'Error while recording audio'))
return
@@ -209,6 +214,7 @@ export default {
console.debug(exception)
this.aborted = true
this.stop()
+ this.killStreams()
this.resetComponentData()
showError(t('spreed', 'Error while recording audio'))
return
@@ -242,7 +248,7 @@ export default {
* Generate the file
*/
generateFile() {
- this.audioStream.getTracks().forEach(track => track.stop())
+ this.killStreams()
if (!this.aborted) {
this.blob = new Blob(this.chunks, { type: 'audio/wav' })
// Generate file name
@@ -288,7 +294,15 @@ export default {
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 }) + '.wav'
},
+
+ /**
+ * Stop the audio streams
+ */
+ killStreams() {
+ this.audioStream?.getTracks().forEach(track => track.stop())
+ },
},
+
}
</script>