Skip to content

Commit

Permalink
This should eliminate this race condition by using
Browse files Browse the repository at this point in the history
the seconds length value provided by the API
rather than trying to pull the time from the video
element. This is related to FreeTubeApp#2492 and
#9.
  • Loading branch information
MarmadileManteater committed Aug 17, 2022
1 parent e22e39c commit a151085
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/renderer/components/ft-video-player/ft-video-player.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ export default Vue.extend({
videoId: {
type: String,
required: true
},
lengthSeconds: {
type: Number,
required: true
}
},
data: function () {
Expand Down Expand Up @@ -566,6 +570,10 @@ export default Vue.extend({
})
})
})
}).catch((error) => {
this.showToast({
message: error.message
})
})
},

Expand Down Expand Up @@ -627,8 +635,8 @@ export default Vue.extend({
markerDiv.style.position = 'absolute'
markerDiv.style.opacity = '0.6'
markerDiv.style['background-color'] = marker.color
markerDiv.style.width = (marker.duration / this.player.duration()) * 100 + '%'
markerDiv.style.marginLeft = (marker.time / this.player.duration()) * 100 + '%'
markerDiv.style.width = (marker.duration / this.lengthSeconds) * 100 + '%'
markerDiv.style.marginLeft = (marker.time / this.lengthSeconds) * 100 + '%'
markerDiv.title = this.sponsorBlockTranslatedCategory(marker.category)

this.player.el().querySelector('.vjs-progress-holder').appendChild(markerDiv)
Expand Down
1 change: 1 addition & 0 deletions src/renderer/views/Watch/Watch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
:format="activeFormat"
:thumbnail="thumbnail"
:video-id="videoId"
:length-seconds="videoLengthSeconds"
class="videoPlayer"
:class="{ theatrePlayer: useTheatreMode }"
@ready="checkIfWatched"
Expand Down

0 comments on commit a151085

Please sign in to comment.