-
-
Notifications
You must be signed in to change notification settings - Fork 577
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
Implemented "Prevent playback looping of youtube shorts video" #2819
base: master
Are you sure you want to change the base?
Conversation
⚬ PROBLEM: YouTube Shorts loop indefinitely, making it hard to stop playback. ⚬ SOLUTION: Detects when a Shorts video restarts and pauses it at the last frame to prevent looping. ⚬ RELEVANCE / SCOPE: Affects only Shorts videos. Doesn’t interfere with regular videos or ads. Works dynamically via MutationObserver. ⚬ "SIDE EFFECTS": May pause unintended seeks. Requires updates if YouTube changes behavior. Automatically toggled, menu toggle does not function properly (player settings) ⚬ CONTEXT: Uses chrome.storage.local.get, matching other features. Listens for setting changes dynamically. Integrates smoothly into ImprovedTube.
@@ -706,16 +706,19 @@ REPEAT | |||
ImprovedTube.playerRepeat = function () { | |||
setTimeout(function () { | |||
if (!/ad-showing/.test(ImprovedTube.elements.player.className)) { | |||
ImprovedTube.elements.video.setAttribute('loop', ''); | |||
// Prevent looping for Shorts videos |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if ( Improvedtube.storage.preventLoopingShorts === true) (...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I reverted it back to the original code for the repeat section and functionality remains the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if ( Improvedtube.storage.preventLoopingShorts === true) (...
How would I go about making the toggle for this feature work in the menu? I have a Prevent Shorts Looping toggle option in the player settings but it doesn't function currently and I can't seem to figure out what else to do for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's good, no need to revert., just to make conditional to a setting of the extension
sorry i didnt read all yet. compare to the the code for our always repeat button for example
if (this.storage.player_always_repeat === true) { ImprovedTube.playerRepeat(); };
these variables are managed automatically through adding it in the menu:
youtube/menu/skeleton-parts/player.js
Lines 1077 to 1095 in 2696228
player_always_repeat: { | |
component: 'switch', | |
text: 'alwaysActive', | |
on: { | |
click: function () { | |
if (this.dataset.value === 'true') { | |
document.getElementById('player_repeat_button').flip(true); | |
} | |
} | |
} | |
}, | |
player_screenshot_button: { | |
component: 'switch', | |
text: 'Screenshot', | |
id: 'player_screenshot_button' | |
}, | |
embed_subtitle: { | |
component: 'switch', | |
text: 'Subtitle_Capture_including_the_current_words', |
( and we also add them as attributes to the root element for convenience. ) (while L1080-L1086 are rare/optional/disputable for visually suggesting and imposing to switch on the repeat button then too, for explaining that "always repeat" is a big change)
- we can also improve https://github.com/code-charity/youtube/wiki/Contributing#Development, or make it more likely that people find it
js&css/web-accessible/init.js
Outdated
@@ -96,6 +96,13 @@ ImprovedTube.init = function () { | |||
this.YouTubeExperiments(); | |||
this.channelCompactTheme(); | |||
|
|||
|
|||
let preventShortsLooping = localStorage.getItem("prevent_shorts_looping") === "true"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need local storage? its not available in incognito mode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed it to chrome.storage.local so it works in incognito mode now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
then 💡 it sounds like you might be the one person in the world now, who is likely to bring forward:
#1408 (comment)
hi! and thanks @giulivno |
Extension works in Incognito Mode Now
⚬ PROBLEM:
YouTube Shorts loop indefinitely, making it hard to stop playback. ⚬ SOLUTION:
Detects when a Shorts video restarts and pauses it at the last frame to prevent looping.
⚬ RELEVANCE / SCOPE:
Affects only Shorts videos.
Doesn’t interfere with regular videos or ads.
Works dynamically via MutationObserver.
⚬ "SIDE EFFECTS":
May pause unintended seeks.
Requires updates if YouTube changes behavior.
Automatically toggled, menu toggle does not function properly (player settings)
⚬ CONTEXT:
Uses chrome.storage.local.get, matching other features. Listens for setting changes dynamically.
Integrates smoothly into ImprovedTube.