This is a good extension, but there is no perfect software, so here are some thoughts about SponsorBlock and how to make it better. At this point, I don't know which of these are worthy of opening actual bugs and which are "won't fix".
Potential Bugs
Extension prompts me to vote on my own submission
Or is this a feature?
Technical debt
These are purely technical issues that do not affect the UX too much but would be nice to resolve going forward.
Overall
Does not declare "strict mode"
I'm not sure if browsers assume strict mode in extensions or not. Better not to risk it.
Does not use const
/let
when it can
Also, uses var
.
Embeds popup into the YouTube sidebar with innerHTML
This code is fragile, as demonstrated by popup.css
needing to reset styles:
reset some properties to default (youtube messes with them
It's not YouTube messing with styles, it's the extension messing with YouTube. Why not use an iframe? Is this some kind of optimization to reuse tabs' own process? If so, is it really worth potential breakage on every minor YouTube update?
Needs linter
Come on, man... the tabs vs. spaces thing. Choose a side. :)
Video times are stored as floats
I'm not sure this is a big deal, but this might be important later on for more advanced things I describe later (which require precise timing). Floating-point numbers have an inconsistent resolution on the number line (are logarithmically distributed). I personally would use integers just scaled appropriately to have required resolution. E.g., store the number milliseconds from the beginning of the video, then just convert them to floats or whatever YouTube needs.
Client-Server API
Uses "GET" HTTP method for submitting data to server
"GET" is supposed to be a "safe" method, so it should not change the server state.
/api/postVideoSponsorTimes
TL;DR: Use JSON instead of URL decorations when appropriate.
- API can submit only one sponsor at a time, so extension makes multiple requests if a video has multiple sponsor sections.
background.js
literally has a for loop making request for each reported video segment.
- If you send a JSON, you can submit an object containing an array of videos (all at once); also, you won't need to "unpack" every parameter individually on the server.
- Poor error handling
What happens if the user submits multiple times, some of which succeed and one fails? Currently, you just drop the error message into the DOM. If there are multiple errors only the last one will be seen. Also, what is the user supposed to do with this information?
- If you use JSON, you can make submit operations atomic: either all videos are reported or none are and you can try to resubmit the videos.
- Is there a way to remove previously reported sponsor?
What if the user reports a video and submits it, then realizes timing was just a bit off and fixes one segment and then submits it. As far as I see, the server can only record more segments, not delete old ones.
With a JSON format, you can make one request, delete the obsolete reports, and consistently handle errors because it is just one event.
User experience
Button sizes and positioning
Popup buttons "Delete [sponsor spot]", "Edit" (sponsor spot) and "Clear [sponsor spot] times" are too close for comfort. User can easily miss and click "Clear times" and loose information.
Popup is useless most of the time
- Popup just shows a placeholder message on most pages
- Popup does show a useful interface on
https://www.youtube.com/watch?v=*
pages, but there you have an option to display popup contents in the sidebar (more convenient)
Possible solution:
- On non-YouTube pages, popup might show "general info" like statistics of how many videos user submitted, skipped, etc. and options.
- On YouTube video pages show the current popup.
Submitting sponsor spots at the very beginning or the very end of the video
If the sponsor spot starts with at 0:0, the user has to record the sponsor spot and then manually edit time.
Hard to submit exact timings
I can not conveniently preview the video without segments I just labeled reloading the page and after I reloaded the page I can no longer conveniently edit my submissions.
What does skip section vote mean?
How should user vote if a video is skipped but the timings are incorrect? There should be an option equivalent to "this is an add, but the skip starts too early" and "this is an add, but the skip ends too soon".
Not all sections I want to skip are "sponsor spots"
Ideally, I would be able to skip or mute repeating long intros with channel logos or outros with "Comment, Like, Subscribe!". Of course, these should have their own setting on the settings panel.
Core problems (and far fetched solutions)
Challenges inherent to the idea of skipping portions of the video no matter what extension you use. The solutions are really far fetched at this point in the extension development.
Imprecise timings
It's hard to submit exact timings because the user can click a button only with specific precision and accuracy. Users, of course, could slow the video down and mark the spot exactly, but in practice, no one does this.
Need good data, if ever plan to automatically classify video segments
A good solution is to allow users to manually report spam text, not just video timings. E.g., present users with text (from subtitles/captions API) and let them select spam sentences.
Video and audio might have slightly different perfect "cut" spot
This can be fixed with a few image transitions added on top of the video.
Solution: Cut at perfect audio times and add fill-in frames or transitions
E.g., cut when the audio is playing without regard to video but then fill in the visual portion with frames sampled just before or just after the audio cut.
- The audio is timed almost perfectly: It starts exactly on words "Imagine a $2000 car..." right after
- The video timing is a bit off: It blinks the channel logo that fades into the stock footage.
Solution (freeze frame displayed before main content audio start):
- Start playback with perfect audio timing
- Freeze frame with channel logo (sampled before the transition) and display it on top of the stock footage for a few seconds. No annoying blinking.
- The intro sponsor times are OK (the fade transition is complete).
- The audio literally cuts off "Airports are incredibly..." and starts with "... complex and challenging businesses.
Solution (freeze frame displayed before main content audio start):
- Start playing with perfect audio timing
- Freeze the first frame after the transition from sponsor spot
(Does not have sponsor spots reported at the time of writing)
Solution (freeze frame displayed after main content audio start):
- Start playing with perfect audio timing
- Freeze frame with Uber logo (after the transition from sponsor spot but before crown appears).