code-charity / youtube

[top~1 open YouTube & Video web-extension] Enrich your experience & choice! 🧰180+ options & clever features📌set+forget📌Longest-standing(yet rare&tough alone. Please help/join🧩us👨‍👩‍👧‍👧) ..⋮ {playback|content discovery|player|extra buttons|distractions|related videos|shorts|ads|quality|codec|full tab|full screen}
http://improvedtube.com
Other
3.36k stars 505 forks source link

autoplay quickfix #1703

Open ImprovedTube opened 1 year ago

ImprovedTube commented 1 year ago

AirRaid Videos don't always auto-pause when navigating to them. Is there something I should look for; other than disabling Player\Auto-play?

AirRaid And yeah, confirming - it was pageType === "video" and pageType === "channel"

https://github.com/code-charity/youtube/blob/2a88783398daa257dfa08f6d05517432d4d347d5/js%26css/web-accessible/functions.js#L246-L258

ImprovedTube commented 1 year ago

https://github.com/code-charity/youtube/commit/dc0dc715972cfed6d0c940fd5d60edc75bc84e24

raszpl commented 1 year ago

There must be another more efficient way of disabling autoplay. Current https://github.com/code-charity/youtube/blob/f6e49b11fea9bedd7f471a884675485cc59e8f31/js%26css/web-accessible/functions.js#L296 still allows for a sub second play time and fetches few seconds of video to a buffer :(. On the other hand YT detects if viewport is visible/tab active and will not start playing at all if you open YT page in the background until you switch to that tab.

ImprovedTube commented 4 months ago

There must be another more efficient way of disabling autoplay. Current

https://github.com/code-charity/youtube/blob/f6e49b11fea9bedd7f471a884675485cc59e8f31/js%26css/web-accessible/functions.js#L296

still allows for a sub second play time and fetches few seconds of video to a buffer :(. On the other hand YT detects if viewport is visible/tab active and will not start playing at all if you open YT page in the background until you switch to that tab.

hi! @raszpl, btw

should we try the stop() function as possible or repeatedly within 0.x seconds? @dodieboy thought about this before after youtube removed a function.

this one: https://github.com/code-charity/youtube/blob/6f6a592a14834c4fd3aba890a30498904f2823e2/js%26css/web-accessible/functions.js#L173-L176 was placed critically/misplaced, because depending what changes over time during the sessions, our mutation handler could reach there too (https://github.com/code-charity/youtube/blob/master/js%26css/web-accessible/init.js )

raszpl commented 4 months ago

stop() function as possible or repeatedly within 0.x seconds?

pause works fine in other extensions, just need to slightly rework where its being called as for reliably pausing every time this needs to be removed https://github.com/code-charity/youtube/blob/7014a799a8f2facdbf073875b410fa130469f019/js%26css/web-accessible/www.youtube.com/player.js#L18-L21 I have no idea what its for, but its breaking autoplayDisable

ImprovedTube commented 3 months ago

https://github.com/code-charity/youtube/pull/2157#issuecomment-2036482930