Skip to content
Closed
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 CarlSchwan committed Sep 1, 2022
commit 5798ae1aa756c3ab37093368e99dbba765df931e
9 changes: 8 additions & 1 deletion src/components/Videos.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
@canplay="doneLoading"
@loadedmetadata="onLoadedMetadata">

{{ fetchTracks() }}

<track v-for="track in tracks"
:key="track"
:src="track.src"
Expand Down Expand Up @@ -79,6 +81,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 @@ -95,7 +103,6 @@ export default {
return this.$refs.plyr.player
},
options() {
this.fetchTracks()
return {
autoplay: this.active === true,
<<<<<<< HEAD
Expand Down