Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix issue with tracks not always being reactive
Property track was not properly declared, and sometimes was not
reactive. E.g. closing and re-opening the player would make
subtitles disappear.

Fixing entails declaring tracks in the data() function associated
with the Videos vue.

Signed-off-by: Frederic Ruget <[email protected]>
  • Loading branch information
douzebis authored and beardhatcode committed May 25, 2021
commit d4c9014526f7da8b3f850c8072ed017a801fe9ff
4 changes: 2 additions & 2 deletions js/viewer-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/viewer-main.js.map

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion src/components/Videos.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
@canplay="doneLoading"
@loadedmetadata="onLoadedMetadata">

{{ fetchTracks() }}

<track v-for="track in tracks"
:key="track"
:src="track.src"
Expand Down Expand Up @@ -76,6 +78,12 @@ Vue.use(VuePlyr)
export default {
name: 'Videos',

data: () => ({
// This is required so that tracks is declared and reactive
// Otherwise updates may fail to make it to plyr
tracks: [],
}),

computed: {
livePhoto() {
return this.fileList.find(file => {
Expand All @@ -92,7 +100,6 @@ export default {
return this.$refs.plyr.player
},
options() {
this.fetchTracks()
return {
autoplay: this.active === true,
captions: { active: false, language: 'auto', update: true },
Expand Down