diff --git a/src/components/NewMessageForm/AudioRecorder/AudioRecorder.vue b/src/components/NewMessageForm/AudioRecorder/AudioRecorder.vue index ca5bd15d59f..6353bce707d 100644 --- a/src/components/NewMessageForm/AudioRecorder/AudioRecorder.vue +++ b/src/components/NewMessageForm/AudioRecorder/AudioRecorder.vue @@ -28,6 +28,7 @@ content: startRecordingTooltip, delay: tooltipDelay, }" + :disabled="!encoderReady" class="audio-recorder__trigger nc-button nc-button__main" @click="start"> + * + * @author Marco Ambrosini + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ + +import { register } from 'extendable-media-recorder' +import { connect } from 'extendable-media-recorder-wav-encoder' + +const state = () => ({ + encoderReady: false, +}) + +const getters = { + encoderReady: state => { + return state.encoderReady + }, +} + +const mutations = { + encoderReady: (state) => { + state.encoderReady = true + }, +} + +const actions = { + async initializeAudioEncoder({ commit, state }) { + if (!state.encoderReady) { + register(await connect()) + commit('encoderReady') + } + }, +} + +export default { state, mutations, getters, actions } diff --git a/src/store/storeConfig.js b/src/store/storeConfig.js index a5c73c6993f..aeeeb19e277 100644 --- a/src/store/storeConfig.js +++ b/src/store/storeConfig.js @@ -21,6 +21,7 @@ */ import actorStore from './actorStore' +import audioRecorderStore from './audioRecorderStore' import callViewStore from './callViewStore' import conversationsStore from './conversationsStore' import fileUploadStore from './fileUploadStore' @@ -40,6 +41,7 @@ import messageActionsStore from './messageActionsStore' export default { modules: { actorStore, + audioRecorderStore, callViewStore, conversationsStore, fileUploadStore,