Resolve "press+hold audio recording is broken"

This commit is contained in:
N Pex 2023-10-25 20:59:56 +00:00
parent 4bc4a8d8e5
commit 758201e2eb
4 changed files with 27 additions and 7 deletions

View file

@ -34,8 +34,12 @@ export default {
info: this.install(),
};
},
mounted() {
this.event.on("Event.localEventIdReplaced", this.onLocalEventIdReplaced);
},
beforeDestroy() {
this.$audioPlayer.removeListener(this._uid);
this.event.off("Event.localEventIdReplaced", this.onLocalEventIdReplaced);
},
computed: {
currentTime() {
@ -62,6 +66,12 @@ export default {
},
seeked(percent) {
this.$audioPlayer.seek(this.event, percent);
},
onLocalEventIdReplaced() {
// This happens when we are the sending party and the message has been sent and the local echo has been updated with the new real id.
// Since we use the event id to register with the audio player, we need to update.
this.$audioPlayer.removeListener(this._uid);
this.info = this.$audioPlayer.addListener(this._uid, this.event);
}
},
};