diff --git a/src/components/AudioWrapper.vue b/src/components/AudioWrapper.vue index 459e3936..e7d7abb4 100644 --- a/src/components/AudioWrapper.vue +++ b/src/components/AudioWrapper.vue @@ -3,9 +3,14 @@
- 00:00 + 00:00
- {{ durationTime }} + + {{ + durationTime + }}
@@ -114,6 +123,7 @@ export default { data: () => ({ wavesurfer: null, volume: 20, + currentProgress: 0, }), watch: { triggerSave: function (oldValue, newValue) { @@ -123,6 +133,13 @@ export default { }, }, computed: { + currentTheme() { + if (this.$vuetify.theme.dark) { + return this.$vuetify.theme.themes.dark; + } else { + return this.$vuetify.theme.themes.light; + } + }, isPlaying() { if (!this.wavesurfer) return false; @@ -141,22 +158,11 @@ export default { duration = parseFloat(this.wavesurfer.getDuration()).toFixed(2); } - duration = 0; - const date = new Date(null); date.setSeconds(duration); const result = date.toISOString().substr(14, 5); return result; }, - currentTime() { - if (!this.wavesurfer) return 0; - - // return this.wavesurfer.getCurrentTime(); - const duration = parseInt(this.wavesurfer.getDuration()); - const current = parseInt(this.wavesurfer.getCurrentTime()); - const result = Math.round((current / duration) * 100); - return result; - }, }, mounted() { if (!this.wavesurfer) { @@ -176,6 +182,21 @@ export default { barWidth: 3, }); this.wavesurfer.load(`file://${this.item.filePath}`); + this.wavesurfer.on("audioprocess", () => { + this.setCurrentProgress(); + }); + }, + setCurrentProgress() { + if (!this.wavesurfer) return 0; + + // return this.wavesurfer.getCurrentTime(); + const duration = parseFloat(this.wavesurfer.getDuration()); + const current = parseFloat(this.wavesurfer.getCurrentTime()); + const result = Math.round((current / duration) * 100); + this.currentProgress = result; + }, + syncSlideWithAudio() { + this.wavesurfer.seekTo(this.currentProgress / 100); }, setVolume() { const volume = Math.round(this.volume); diff --git a/src/components/dialogs/AudioRecordingDialog.vue b/src/components/dialogs/AudioRecordingDialog.vue deleted file mode 100644 index e169f020..00000000 --- a/src/components/dialogs/AudioRecordingDialog.vue +++ /dev/null @@ -1,89 +0,0 @@ - - - - -