This should eliminate this race condition by using (#2493)

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
MarmadileManteater#9.
This commit is contained in:
MarmadileManteater 2022-08-20 08:49:41 -04:00 committed by GitHub
parent bc3aaa4536
commit 166fe004b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

View File

@ -73,6 +73,10 @@ export default Vue.extend({
videoId: {
type: String,
required: true
},
lengthSeconds: {
type: Number,
required: true
}
},
data: function () {
@ -566,6 +570,10 @@ export default Vue.extend({
})
})
})
}).catch((error) => {
this.showToast({
message: error.message
})
})
},
@ -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)

View File

@ -27,6 +27,7 @@
:format="activeFormat"
:thumbnail="thumbnail"
:video-id="videoId"
:length-seconds="videoLengthSeconds"
class="videoPlayer"
:class="{ theatrePlayer: useTheatreMode }"
@ready="checkIfWatched"