Skip to content
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

[Bug]: SponsorBlock segments don't always display in the timeline when using the Invidious API #2492

Closed
3 of 4 tasks
MarmadileManteater opened this issue Aug 17, 2022 · 4 comments · Fixed by #2493
Closed
3 of 4 tasks
Labels
B: race condition bug Something isn't working

Comments

@MarmadileManteater
Copy link
Contributor

Guidelines

  • I have encountered this bug in the latest release of FreeTube.
  • I have searched the issue tracker for a bug report that matches the one I want to file, without success.
  • I have searched the documentation for information that matches the description of the bug I want to file, without success.

Describe the bug

  1. Enable "Sponsor Block" in the settings
  2. Select "Invidious API" as your default API
  3. Navigate to a video which has sponsored segments (ex: 2Q0bLo5nSsU)
  4. Sponsor block segments are not visible, but the player does still skip the segments when they would occur.
    image

Expected Behavior

The sponsored segments should display on the timeline in the color selected in the settings. This is what the video looks like when the local API is selected.
image

Issue Labels

race condition

FreeTube Version

v0.17.1

Operating System Version

Windows 10 Pro Version 21H2 Installed on 4/‎3/‎2022 OS build 19044.1889 Experience Windows Feature Experience Pack 120.2212.4180.0

Installation Method

.exe

Primary API used

Invidious API

Last Known Working FreeTube Version (If Any)

No response

Additional Information

This issue seems to be occurring because this.player.duration() is often 0 at the time when addSponsorBlockMarker is called (especially when the Invidious API is preferred), and this.player.duration() only becomes the length of the video after addSponsorBlockMarker is called. This causes a division by zero where the width and positioning of the sponsored segments would normally be set.

// line 630 of src\renderer\components\ft-video-player\ft-video-player.js
markerDiv.style.width = (marker.duration / this.player.duration()) * 100 + '%'
markerDiv.style.marginLeft = (marker.time / this.player.duration()) * 100 + '%'

JavaScript evaulates the strings as Infinity%, and the result is that the sponsored segments do not always appear when the Invidious API is selected as the preferred API.

Nightly Build

@MarmadileManteater MarmadileManteater added the bug Something isn't working label Aug 17, 2022
@efb4f5ff-1298-471a-8973-3d47447115dc

Did u also had issue with the local api like in #1439

@MarmadileManteater
Copy link
Contributor Author

MarmadileManteater commented Aug 17, 2022

I am unsure. It is totally possible. It is very likely that it is less pronounced for the Local API because it is taking less time with each request.

MarmadileManteater added a commit to MarmadileManteater/FreeTubeAndroid that referenced this issue Aug 17, 2022
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.
@efb4f5ff-1298-471a-8973-3d47447115dc

Is it possible for u to look into. If u want and have the time for it?

@MarmadileManteater
Copy link
Contributor Author

I believe my pull request will fix this issue. I do not know for sure if it will fix the other issue, but it might from the looks of it.

PrestonN pushed a commit that referenced this issue Aug 20, 2022
the seconds length value provided by the API
rather than trying to pull the time from the video
element. This is related to #2492 and
MarmadileManteater#9.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B: race condition bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants