mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-07-12 12:21:34 +00:00
Add seek support to transcriptions
This commit is contained in:
parent
8e5fc4a411
commit
ee8e7cf958
3 changed files with 17 additions and 4 deletions
|
|
@ -56,7 +56,10 @@
|
||||||
@showTranscription="showTranscriptionUi = !showTranscriptionUi"
|
@showTranscription="showTranscriptionUi = !showTranscriptionUi"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<transcription-ui v-if="showTranscriptionUi"></transcription-ui>
|
<transcription-ui
|
||||||
|
v-if="showTranscriptionUi"
|
||||||
|
@seek="seek"
|
||||||
|
/>
|
||||||
|
|
||||||
<modals-bookmarks-modal v-model="showBookmarksModal" :bookmarks="bookmarks" :current-time="bookmarkCurrentTime" :library-item-id="libraryItemId" @select="selectBookmark" />
|
<modals-bookmarks-modal v-model="showBookmarksModal" :bookmarks="bookmarks" :current-time="bookmarkCurrentTime" :library-item-id="libraryItemId" @select="selectBookmark" />
|
||||||
|
|
||||||
|
|
@ -95,8 +98,8 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
'playerHandler.playerState': function (newVal, oldVal) {
|
'playerHandler.playerState': function (newVal) {
|
||||||
// Refresh the transcription UI when the player is changed
|
// Refresh the transcription UI when the audio track is changed
|
||||||
if (newVal === 'LOADED') {
|
if (newVal === 'LOADED') {
|
||||||
this.showTranscriptionUi = false;
|
this.showTranscriptionUi = false;
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<div :class="{ 'text-warning': isActive }">
|
<div :class="{ 'text-warning': isActive }" class="cursor-pointer" @click.stop="clickSeek">
|
||||||
<div v-html="cue.text"></div>
|
<div v-html="cue.text"></div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -14,6 +14,12 @@ export default {
|
||||||
isActive: false
|
isActive: false
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
methods: {
|
||||||
|
clickSeek() {
|
||||||
|
const time = this.cue.startTime;
|
||||||
|
this.$emit('seek', time);
|
||||||
|
}
|
||||||
|
},
|
||||||
created() {
|
created() {
|
||||||
this.cue.onenter = () => (this.isActive = true);
|
this.cue.onenter = () => (this.isActive = true);
|
||||||
this.cue.onexit = () => (this.isActive = false);
|
this.cue.onexit = () => (this.isActive = false);
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
:key="index"
|
:key="index"
|
||||||
:cue="cue"
|
:cue="cue"
|
||||||
ref="transcriptionLine + index"
|
ref="transcriptionLine + index"
|
||||||
|
@seek="seek"
|
||||||
></transcription-line>
|
></transcription-line>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -29,6 +30,9 @@ export default {
|
||||||
const trackElement = document.getElementById("transcription-track");
|
const trackElement = document.getElementById("transcription-track");
|
||||||
this.cues = trackElement.track.cues;
|
this.cues = trackElement.track.cues;
|
||||||
},
|
},
|
||||||
|
seek(time) {
|
||||||
|
this.$emit('seek', time)
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue