ajayyy / SponsorBlock

Skip YouTube video sponsors (browser extension)
https://sponsor.ajay.app
GNU General Public License v3.0
10.21k stars 323 forks source link

Ensuring sections after skipped content are buffered #1239

Open ccuser44 opened 2 years ago

ccuser44 commented 2 years ago

So youtube pre-loads the video when you watch it. However sponsorblock doesn't affect this at all.

Currently if there is a long segment which isn't pre-loaded and sponsorblock skips to it, the video wont load immediatly.

I propose Sponsorblock should modify the youtube video player so, that it doesn't pre-load the skippable segments at all and continues after the skippable segments.

This would also act as a nice bandwith saver, and it would prevent interruptions caused by the video not being loaded properly.

Also if it were possible (and efficient and easily modifyable) then we could also make it not load audio of muted segments.

mchangrh commented 2 years ago

discussed previously: https://discord.com/channels/603643120093233162/607338052221665320/884188684361023498

ccuser44 commented 2 years ago

About the namechange, I want to make it clear that we should not load at all the content inside skippable sections also to save bandwith

mchangrh commented 2 years ago

...we should not load at all the content inside skippable sections also to save bandwith

I don't think we have enough control over playback in order to selectively load that content., at least not on youtube.com. That would also cause a lot of issues if someone wanted to unskip that segment

ccuser44 commented 2 years ago

...we should not load at all the content inside skippable sections also to save bandwith

I don't think we have enough control over playback in order to selectively load that content., at least not on youtube.com. That would also cause a lot of issues if someone wanted to unskip that segment

I disagree. The youtube bufferer should be made to "skip" the sponsored segment. This would both fix the issue with long segments being skipped but also would act as a nice bandwith saver. For users who have unskipping enabled, a few seconds of the sponsored segment should also be loaded to make unskipping seamless. Also when the user manually enters a sponsored segment, the whole sponsored segment (And all other sponsored segments ehich sre touching that segment) should be loaded.

It is nearly as easy to make it not load content inside sponsored segments instead of just forcefully loading content after that.

This would also be a great addition to Sponsorblock and would give it much more legitimacy and potential users. We could also display a counter of bandwith saved to users outside of just time saved.

mchangrh commented 2 years ago

It is nearly as easy to make it not load content inside sponsored segments instead of just forcefully loading content after that.

Would you like to elaborate how or maybe reference documentation that allows for this amount of precision in manipulating the buffer/cache? I don't recall there being any simple method of cache manipulation, even when there were plugins for manipulating DASH with flash

NDevTK commented 2 years ago

I think its possible seems similar to https://github.com/ajayyy/SponsorBlock/issues/543 This could probably be done by hooking XMLHttpRequest.prototype.open

ccuser44 commented 1 year ago

It is nearly as easy to make it not load content inside sponsored segments instead of just forcefully loading content after that.

Would you like to elaborate how or maybe reference documentation that allows for this amount of precision in manipulating the buffer/cache? I don't recall there being any simple method of cache manipulation, even when there were plugins for manipulating DASH with flash

The HTML5 video player itself exhibits this behavior. When you set your video playback position to an unloaded part of the video the client does not load the content before the playback positiin. So the browsers player at least holds this capability. I'm not exactly sure if there is a javascript API to directly do this. If there isn't a simple workaround could be used instead.