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-30 18:02:34 +0300
committerJoas Schilling <coding@schilljs.com>2021-07-01 17:06:00 +0300
commit63fe1ac0d71cd660bee3df5ff3d304d5aca4871e (patch)
tree456eb80f1cb7a1e20f9bfb439a81f0e63e55ac09 /src/components/NewMessageForm
parentd2e2b14ced1ffa6f9f51f11d0233b038826fc31e (diff)
Use extended mediarecorder
Signed-off-by: Marco Ambrosini <marcoambrosini@pm.me>
Diffstat (limited to 'src/components/NewMessageForm')
-rw-r--r--src/components/NewMessageForm/AudioRecorder/AudioRecorder.vue24
1 files changed, 11 insertions, 13 deletions
diff --git a/src/components/NewMessageForm/AudioRecorder/AudioRecorder.vue b/src/components/NewMessageForm/AudioRecorder/AudioRecorder.vue
index a243950fa..f0e47bb47 100644
--- a/src/components/NewMessageForm/AudioRecorder/AudioRecorder.vue
+++ b/src/components/NewMessageForm/AudioRecorder/AudioRecorder.vue
@@ -78,6 +78,8 @@ import Check from 'vue-material-design-icons/Check'
import Tooltip from '@nextcloud/vue/dist/Directives/Tooltip'
import { mediaDevicesManager } from '../../../utils/webrtc/index'
import { showError } from '@nextcloud/dialogs'
+import { MediaRecorder, register } from 'extendable-media-recorder'
+import { connect } from 'extendable-media-recorder-wav-encoder'
export default {
name: 'AudioRecorder',
@@ -154,13 +156,15 @@ export default {
},
},
+ async mounted() {
+ await register(await connect())
+ },
+
methods: {
/**
* Initialize the media stream and start capturing the audio
*/
async start() {
- const useSafariFallback = MediaRecorder.isTypeSupported('video/mp4; codecs="mp4a.40.2"')
-
// Create new audio stream
try {
this.audioStream = await mediaDevicesManager.getUserMedia({
@@ -179,15 +183,9 @@ export default {
// Create a mediarecorder to capture the stream
try {
- if (useSafariFallback) {
- this.mediaRecorder = new MediaRecorder(this.audioStream, {
- audioBitsPerSecond: 128000,
- videoBitsPerSecond: 0,
- mimeType: 'video/mp4; codecs="mp4a.40.2"',
- })
- } else {
- this.mediaRecorder = new MediaRecorder(this.audioStream)
- }
+ this.mediaRecorder = new MediaRecorder(this.audioStream, {
+ mimeType: 'audio/wav',
+ })
} catch (exception) {
console.debug(exception)
this.audioStream.getTracks().forEach(track => track.stop())
@@ -246,7 +244,7 @@ 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/wav' })
// Generate file name
const fileName = this.generateFileName()
// Convert blob to file
@@ -288,7 +286,7 @@ export default {
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'
+ return t('spreed', 'Talk recording from {time} ({conversation})', { time, conversation }) + '.wav'
},
},
}