Skip to content

Add native SponsorBlock integration#49

Draft
grohit1810 wants to merge 409 commits into
Tonwalter888:mainfrom
grohit1810:feature/add-sponsorblock
Draft

Add native SponsorBlock integration#49
grohit1810 wants to merge 409 commits into
Tonwalter888:mainfrom
grohit1810:feature/add-sponsorblock

Conversation

@grohit1810

Copy link
Copy Markdown

Summary

Adds built-in SponsorBlock support to YouMod, implementing all 9 segment categories with configurable per-category actions. This is a native implementation (not a bundled iSponsorBlock dylib), making it easier to maintain and extending support to include the Highlight (poi_highlight) category that iSponsorBlock lacks.

Resolves #34

Features

  • Full SponsorBlock API integration (sponsor.ajay.app)
  • 9 segment categories: Sponsor, Intro, Endcards, Interaction, Self-promotion, Non-music, Preview, Highlight, Filler
  • Per-category action modes: Disable, Auto-skip, Ask before skipping, Display on seek bar only, Skip-to (for Highlights)
  • Colored seek bar markers showing segment positions on the progress bar
  • Skip notification banner with Unskip button (auto-dismisses after configurable duration)
  • Ask mode with persistent Skip/Dismiss banner for manual-skip categories
  • Highlight support — skip TO the key moment (poi_highlight), not past it
  • Player overlay toggle button (shield icon) to enable/disable SponsorBlock per video
  • Full settings page with per-category controls and 12 color presets
  • Haptic feedback option on skip
  • In-memory segment caching per session (no redundant API calls)

Architecture

File Purpose
Files/SponsorBlock.x Core logic — API requests, segment model, skip engine
Files/SponsorBlockUI.x UI — notification banner, seek bar markers, overlay button
Files/SponsorBlockSettings.x Full settings page with per-category action/color pickers

@Tonwalter888

Copy link
Copy Markdown
Owner

Can you send me a screenshot about the skip banner? I want to see what it looks like.

@grohit1810

Copy link
Copy Markdown
Author

Here are screenshots and a screen capture video. Let me know if it looks good
image (2)
image (1)
image

ScreenRecording_05-02-2026.04-46-50_1.mp4

@Tonwalter888

Tonwalter888 commented May 2, 2026

Copy link
Copy Markdown
Owner

Can you trigger a skip dialog and send a screenshot here?
EDIT: The dialog that are asking you to skip or not.

@grohit1810

grohit1810 commented May 2, 2026

Copy link
Copy Markdown
Author

Note: This is a v1 implementation focused on getting all the core functionality working. Known limitations that I plan to address later(in a follow up PR):

  • Seek bar markers are currently rendered as a separate overlay above the progress bar. The next version will render them inline on the progress bar track itself (matching how YTLite does it).
  • Color picker currently uses 12 preset colors. A follow-up will add a full color picker with custom hex input.
  • Channel whitelisting (disable SponsorBlock for specific creators) is not yet implemented.

All core SponsorBlock functionality is complete and working — skipping, notifications, per-category settings, overlay toggle, and highlight support.

@grohit1810

Copy link
Copy Markdown
Author

Here is screenshot of skip dialog
image (3)

Settings Page:
image (4)

@Tonwalter888

Copy link
Copy Markdown
Owner

One more thing, can you do a long press on the miniplayer to see what happens?

@grohit1810

Copy link
Copy Markdown
Author

One more thing, can you do a long press on the miniplayer to see what happens?

Nothing happens on long press of the miniplayer. Video continues to play normally

@Tonwalter888

Copy link
Copy Markdown
Owner

@grohit1810 Nevermind, I tested it. The dialog is too small compares to YTLite. But a lot of things need to implement here.

  • Adds a skip dialog for highlight
  • Use built-in ColorPicker for segments colors
  • Make the segments height = YouTube's seekbar (Maybe you can use some codes from iSponsorBlock)

@grohit1810

grohit1810 commented May 2, 2026

Copy link
Copy Markdown
Author

@Tonwalter888 Updated the PR with all the requested changes

  • Skip dialog for highlight — shows a "Jump to highlight" banner when a highlight segment is available
  • Built-in ColorPicker — uses native iOS UIColorPicker for segment colors
  • Segment markers match YouTube's seekbar height — uses iSponsorBlock's approach with reference decoration views
  • Redesigned settings page — matches the UI of SponsorBlock settings page with YTLite SponsorBlock settings page

@Tonwalter888

Copy link
Copy Markdown
Owner

@grohit1810 Can you make the skip dialog like in YTLite?
IMG_3568

@Tonwalter888

Copy link
Copy Markdown
Owner

@grohit1810 Actually, can you use system UI settings (like this Sponsorblock) for all settings? YouTube’s settings are unstable and glichy.

@grohit1810

Copy link
Copy Markdown
Author

@Tonwalter888 For the system UI settings rewrite do you want that in this same PR, or should I open a separate one? It's a bigger change that touches the entire settings flow, so wanted to check.

Also just a heads up: I am writing and understanding the code myself (not fully AI generated), so my turnaround will be slower

@Tonwalter888

Copy link
Copy Markdown
Owner

@Tonwalter888 For the system UI settings rewrite do you want that in this same PR, or should I open a separate one? It's a bigger change that touches the entire settings flow, so wanted to check.

Also just a heads up: I am writing and understanding the code myself (not fully AI generated), so my turnaround will be slower

You can do on this PR. Just rewrite like the SponsorBlock you wrote, that's all I wanted. (Inside the sections)

@grohit1810

Copy link
Copy Markdown
Author

@Tonwalter888 Update the PR with both the changes

  • Skip dialog redesigned to match YTLite Style - Pill shaped pop up with progress depletion and fully interactable
  • Settings rewritten with system UIKit - same layout and sections as before.

@Tonwalter888

Copy link
Copy Markdown
Owner

@Tonwalter888 Update the PR with both the changes

  • Skip dialog redesigned to match YTLite Style - Pill shaped pop up with progress depletion and fully interactable

  • Settings rewritten with system UIKit - same layout and sections as before.

Will test this, thanks for implementing them.

@Tonwalter888

Copy link
Copy Markdown
Owner

@grohit1810 I think there are some missing SponsorBlock segments.
And the dialog is hidden in fullscreen, I think you should move the dialog on top of the screen.
IMG_3591
IMG_3592
Also, can you use a slider for default tab bar? I implemented it before.
a512d99

@Tonwalter888

Copy link
Copy Markdown
Owner

Also adds a skip dialog for hightlight

@Tonwalter888

Copy link
Copy Markdown
Owner

@grohit1810 Also makes the button hidden with the overlay.
IMG_3599

@Tonwalter888

Copy link
Copy Markdown
Owner

@grohit1810 I will add the new features in v1.4.0 in here.

@grohit1810

grohit1810 commented May 6, 2026

Copy link
Copy Markdown
Author

@Tonwalter888 I am not sure why you are not able to see the new pill shaped button in fullscreen mode?
I am able to see skip dialog to highlight and also in fullscreen.

I have the fix other two issues - Slider bar and hide sponsorblock button overlay
I will test it and push it

@Tonwalter888

Copy link
Copy Markdown
Owner

@grohit1810 Okey then.

@grohit1810

Copy link
Copy Markdown
Author

@Tonwalter888 Found the issue with full screen. I will fix this as well in my next commit

@Tonwalter888

Copy link
Copy Markdown
Owner

@Tonwalter888 Found the issue with full screen. I will fix this as well in my next commit

Alright, I will add more features after you pushed your fix.

@Tonwalter888

Copy link
Copy Markdown
Owner

@grohit1810 The back button stays black in dark mode.
IMG_3606
IMG_3607

@grohit1810

Copy link
Copy Markdown
Author

@Tonwalter888 Fixed all three issues
image (1)
image

I will fix the back button stays not visible in dark mode in the next commit.
It's the OLED theme overriding nav bar tint color, should be a quick fix. I'll do it tomorrow

@Tonwalter888

Tonwalter888 commented May 7, 2026

Copy link
Copy Markdown
Owner

@grohit1810 Lastly, can you use the dialog for downloading? Replace the HUD toast with our dialog. (Replace the skip icon to a check and a cross (x) for errors)

@Tonwalter888

Tonwalter888 commented May 7, 2026

Copy link
Copy Markdown
Owner

@grohit1810
I think you should filp this icon to go back.
IMG_3613
And it looks like the skip dialog doesn’t apply the waiting time from the settings.
IMG_3614

@grohit1810

Copy link
Copy Markdown
Author

@Tonwalter888 I will fix all three issues - back button, not adhering to the wait times and the black back button
I will also add my dialog to the downloading toast

@MCTMS8

MCTMS8 commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Same crash after a research

-[YTInlineMutedPlaybackPlayerOverlayViewController playerBarController]: unrecognized selector sent to instance 0x156e68000
Call stack: (
0 CoreFoundation 0x00000001860a2248 FE9658B2-9DE6-3FA5-907B-0B3A3BCBB0B7 + 1135176
1 YouTube 0x00000001158be3cc YouTube + 37528524
2 YouTube 0x00000001158bd8a0 YouTube + 37525664
3 libobjc.A.dylib 0x0000000182b71224 objc_exception_throw + 88
4 CoreFoundation 0x00000001861131d4 FE9658B2-9DE6-3FA5-907B-0B3A3BCBB0B7 + 1597908
5 UIKitCore 0x000000018d1ac41c 9EE8C19A-A370-3599-823B-34B84131AAD7 + 23172124
6 CoreFoundation 0x0000000185ff052c FE9658B2-9DE6-3FA5-907B-0B3A3BCBB0B7 + 406828
7 CoreFoundation 0x0000000185ffae60 _CF_forwarding_prep_0 + 96
8 YouMod.dylib 0x000000010446f6f4 SBColorFromHex + 42744
9 YouMod.dylib 0x000000010446feb8 SBColorFromHex + 44732
10 libdispatch.dylib 0x00000001c03af9a8 E1A24FA0-2160-3366-AE7E-420F0FA3C5BC + 6568
11 libdispatch.dylib 0x00000001c03c91e4 E1A24FA0-2160-3366-AE7E-420F0FA3C5BC + 111076
12 libdispatch.dylib 0x00000001c03e6e10 E1A24FA0-2160-3366-AE7E-420F0FA3C5BC + 232976
13 libdispatch.dylib 0x00000001c03be964 E1A24FA0-2160-3366-AE7E-420F0FA3C5BC + 67940
14 libdispatch.dylib 0x00000001c03be8a4 _dispatch_main_queue_callback_4CF + 44
15 CoreFoundation 0x000000018602f030 FE9658B2-9DE6-3FA5-907B-0B3A3BCBB0B7 + 663600
16 CoreFoundation 0x0000000185fbc604 FE9658B2-9DE6-3FA5-907B-0B3A3BCBB0B7 + 194052
17 CoreFoundation 0x0000000185fbb54c FE9658B2-9DE6-3FA5-907B-0B3A3BCBB0B7 + 189772
18 GraphicsServices 0x000000022b70b498 GSEventRunModal + 120
19 UIKitCore 0x000000018bcb4244 9EE8C19A-A370-3599-823B-34B84131AAD7 + 1184324
20 UIKitCore 0x000000018bc1f158 UIApplicationMain + 332
21 YouTube 0x00000001135e60c4 YouTube + 991428
22 LiveContainerShared 0x000000010429b418 invokeAppMain + 6340
23 LiveContainerShared 0x00000001042992cc LiveContainerMain + 2144
24 dyld 0x0000000182bc9c1c 41DE795B-9283-37FD-917E-D674BB73F541 + 19484
)

@MCTMS8

MCTMS8 commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

And search ads are not hidedimage

@Tonwalter888

Copy link
Copy Markdown
Owner

@MCTMS8 Can you install or inject FLEX? Here with FLEXHelperForYT

@MCTMS8

MCTMS8 commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

@MCTMS8 Can you install or inject FLEX? Here with FLEXHelperForYT

@Tonwalter888 yes
Edit already done with https://github.com/temp1122-sys/PrisonFLEX

@MCTMS8

MCTMS8 commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

@Tonwalter888 What do you want me to do

@MCTMS8

MCTMS8 commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

After a little bit of testing it seems that sometimes ads are hides and sometimes they are not hided

A picture showing flex when an ad is displayed image

@MCTMS8

MCTMS8 commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

After building last commit I continue to get this error when watching a video trough the feed player

-[YTInlineMutedPlaybackPlayerOverlayViewController playerBarController]: unrecognized selector sent to instance 0x137492a00
Call stack: (
0 CoreFoundation 0x00000001860a2248 FE9658B2-9DE6-3FA5-907B-0B3A3BCBB0B7 + 1135176
1 YouTube 0x00000001149ca3cc YouTube + 37528524
2 YouTube 0x00000001149c98a0 YouTube + 37525664
3 libobjc.A.dylib 0x0000000182b71224 objc_exception_throw + 88
4 CoreFoundation 0x00000001861131d4 FE9658B2-9DE6-3FA5-907B-0B3A3BCBB0B7 + 1597908
5 UIKitCore 0x000000018d1ac41c 9EE8C19A-A370-3599-823B-34B84131AAD7 + 23172124
6 CoreFoundation 0x0000000185ff052c FE9658B2-9DE6-3FA5-907B-0B3A3BCBB0B7 + 406828
7 CoreFoundation 0x0000000185ffae60 _CF_forwarding_prep_0 + 96
8 YouMod.dylib 0x000000010365fc04 SBColorFromHex + 43252
9 YouMod.dylib 0x00000001036603a4 SBColorFromHex + 45204
10 libdispatch.dylib 0x00000001c03af9a8 E1A24FA0-2160-3366-AE7E-420F0FA3C5BC + 6568
11 libdispatch.dylib 0x00000001c03c91e4 E1A24FA0-2160-3366-AE7E-420F0FA3C5BC + 111076
12 libdispatch.dylib 0x00000001c03e6e10 E1A24FA0-2160-3366-AE7E-420F0FA3C5BC + 232976
13 libdispatch.dylib 0x00000001c03be964 E1A24FA0-2160-3366-AE7E-420F0FA3C5BC + 67940
14 libdispatch.dylib 0x00000001c03be8a4 _dispatch_main_queue_callback_4CF + 44
15 CoreFoundation 0x000000018602f030 FE9658B2-9DE6-3FA5-907B-0B3A3BCBB0B7 + 663600
16 CoreFoundation 0x0000000185fbc604 FE9658B2-9DE6-3FA5-907B-0B3A3BCBB0B7 + 194052
17 CoreFoundation 0x0000000185fbb54c FE9658B2-9DE6-3FA5-907B-0B3A3BCBB0B7 + 189772
18 GraphicsServices 0x000000022b70b498 GSEventRunModal + 120
19 UIKitCore 0x000000018bcb4244 9EE8C19A-A370-3599-823B-34B84131AAD7 + 1184324
20 UIKitCore 0x000000018bc1f158 UIApplicationMain + 332
21 YouTube 0x00000001126f20c4 YouTube + 991428
22 LiveContainerShared 0x0000000102a1f418 invokeAppMain + 6340
23 LiveContainerShared 0x0000000102a1d2cc LiveContainerMain + 2144
24 dyld 0x0000000182bc9c1c 41DE795B-9283-37FD-917E-D674BB73F541 + 19484
)https://github.com/user-attachments/assets/989859e7-70b6-4a7f-9ba6-e29fd5224d8d

@Tonwalter888

Copy link
Copy Markdown
Owner

@MCTMS8 Do you have Telegram or Discord?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add iSponsorBlock as optional build setting

5 participants