mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-07-12 12:21:34 +00:00
Avoid error: "Cannot read properties of null (reading 'track')"
This commit is contained in:
parent
282203a30a
commit
68d4dac4a2
2 changed files with 16 additions and 4 deletions
|
|
@ -101,9 +101,9 @@ export default {
|
||||||
'playerHandler.playerState': function (newVal) {
|
'playerHandler.playerState': function (newVal) {
|
||||||
// Refresh the transcription UI when the audio track 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(() => {
|
||||||
this.showTranscriptionUi = true;
|
this.showTranscriptionUi = true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -507,6 +507,7 @@ export default {
|
||||||
this.$eventBus.$on('playback-time-update', this.playbackTimeUpdate)
|
this.$eventBus.$on('playback-time-update', this.playbackTimeUpdate)
|
||||||
this.$eventBus.$on('play-item', this.playLibraryItem)
|
this.$eventBus.$on('play-item', this.playLibraryItem)
|
||||||
this.$eventBus.$on('pause-item', this.pauseItem)
|
this.$eventBus.$on('pause-item', this.pauseItem)
|
||||||
|
this.showTranscriptionUi = false
|
||||||
},
|
},
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
this.$eventBus.$off('cast-session-active', this.castSessionActive)
|
this.$eventBus.$off('cast-session-active', this.castSessionActive)
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,15 @@ export default {
|
||||||
components: {
|
components: {
|
||||||
TranscriptionLine
|
TranscriptionLine
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
trackElement() {
|
||||||
|
this.setCues();
|
||||||
|
}
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
cues: [],
|
cues: [],
|
||||||
|
trackElement: null
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
|
@ -27,12 +33,17 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
init() {
|
init() {
|
||||||
const trackElement = document.getElementById("transcription-track");
|
this.trackElement = document.getElementById("transcription-track")
|
||||||
this.cues = trackElement.track.cues;
|
if (this.trackElement && this.trackElement.track) {
|
||||||
|
this.setCues()
|
||||||
|
}
|
||||||
},
|
},
|
||||||
seek(time) {
|
seek(time) {
|
||||||
this.$emit('seek', time)
|
this.$emit('seek', time)
|
||||||
},
|
},
|
||||||
|
setCues() {
|
||||||
|
this.cues = this.trackElement.track.cues
|
||||||
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue