-
Notifications
You must be signed in to change notification settings - Fork 887
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Eliminating a race condition with SponsorBlock markers #2493
Eliminating a race condition with SponsorBlock markers #2493
Conversation
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.
Tested using a live video, a video with sponsors and a video without sponsors and it worked fine for me (tested with both invidious and local api) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally but not sure where to find a live video to test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was only able to review the code as it looks like the SponsorBlock API is ratelimiting me.
}).catch((error) => { | ||
this.showToast({ | ||
message: error.message | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MarmadileManteater This just shows and empty toast, I don't think that error
object has a message
property.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are correct. This was a mistake on my part.
@MarmadileManteater Could you please create a follow up PR that fixes the empty toast. If the SponsorBlock API doesn't have any segments for a video it 404s. The better option would be to show a toast that says something along the lines of no sponsorblock segments or even better don't show anything at all if no SponsorBlock segments are available. |
This was introduced by my last pull FreeTubeApp#2493
I made a PR to remove the toast. It is just something I whipped up, but as stated, it would make more sense to opt for a solution which involves making the toast message meaningful. |
Eliminating a race condition with SponsorBlock markers
Pull Request Type
Please select what type of pull request this is:
Related issue
closes #2492
Description
This modifies the SponsorBlock markers to use the
lengthSeconds
already provided by the API to calculate their size and position instead of usingthis.player.duration()
.this.player.duration()
is 0 when the view loads and only obtains a value some time after.lengthSeconds
should never be 0 unless the API is giving a strange response. Because of this, changingthis.player.duration()
tolengthSeconds
should eliminate the race condition wherethis.player.duration()
is 0 at the time whenaddSponsorBlockMarker
is called.Screenshots
(These are with Invidious API selected as primary)
Before:
After:
Desktop (please complete the following information):