youtube
youtube copied to clipboard
Modification to issue #1516
fixing auto-play off problem( auto-play won't be affected if you opened one player instance ) fixing one player instance problem (if you opened several tabs it still works it doesn't depend on the browser ( it will block any new tab from auto-starting the video ) it will continue to play as normal in the active tab which means in the active tab it will play the up-next video and auto-start >them if the user chooses auto-play on and up-next video on.
chrome.storage.local.set({newTab: true})
why storage?
ImprovedTube.storage.newTab = false
wont happen for some users, who dont navigate on youtube @MohamedLebda
why storage?
so I can put that condition content-scripts/website-context/youtube-features/player.js ) || ( ImprovedTube.storage.only_one_player_instance_playing && ImprovedTube.storage.newTab)
and its purpose is to stop any new tap from auto-starting videos whenever you change the tab to it, only when you open the only one player instance feature at the same time it only stops the new taps videos meaning that if you didn't open a new tap the background won't send the new tap opened massage so the second part of the condition will be false even tho the one player instance is still true which means that it will not stop any new videos from auto-starting in the same page you are actively in and the same goes if you open a new tap so it will only affect the start of the video of the new tap so that the user whenever he opens the only player instance can browse and open new tabs without the original video stops only when he manually starts a video in the new tap the original tap stop so no two videos play in the same time
ImprovedTube.storage.only_one_player_instance_playing && ImprovedTube.storage.newTab
permanent storage. so it will stop the first tab from playing if that one is opened in the background (ok, since browser will stop it anyways)
just as said ImprovedTube.storage.newTab = false might stay true always (
wont happen for some users, who dont navigate on youtube ) if a user doesnt navigate on youtube but only open & close single videos ImprovedTube.video_url !== location.href
just how it looks to me, didnt test.
sorry for the details,
renamed the features only one player instance playing
Don't let a second video auto-start at once
moved it after autopause when switching tab
Pause while not visible
and we could add a third one Pause the first video when a second one auto-starts
just as said ImprovedTube.storage.newTab = false might stay true always
even if it ImprovedTube.storage.newTab = true because there is no new video started it still won't stop the video from playing or have an effect
if (ImprovedTube.allow_autoplay === false &&
so let's say that the user opened a new tab (now ImprovedTube.storage.newTab = true and ImprovedTube.storage.only_one_player_instance_playing) it will stop the new tab from playing the video, not the original tab. so if the user stopped the original video and didn't open a new video (now still ImprovedTube.storage.newTab = true and ImprovedTube.storage.only_one_player_instance_playing) then the user tried to start any new video whether the original video or a new tab video( now still ImprovedTube.storage.newTab = true and ImprovedTube.storage.only_one_player_instance_playing) but the first part of the if condition will be false (ImprovedTube.allow_autoplay === true) so it won't have any effect and once he starts a new video whether in the original tab or the new tab then
if (ImprovedTube.video_url !== location.href) {
ImprovedTube.allow_autoplay = false;
ImprovedTube.video_url = location.href
ImprovedTube.storage.newTab = false
so it will be false so it won't stop any new video to start from auto-playing in the same tab
and if the user stops the one player instance before opening any new video in the same tab which means that ImprovedTube.storage.newTab will always be true because it's in the storage but it will have no effect because
) || ( ImprovedTube.storage.only_one_player_instance_playing && ImprovedTube.storage.newTab)
renamed the features ~
only one player instance playing
~Don't let a second video auto-start at once
moved it after ~autopause when switching tab
~Pause while not visible
and we could add a third one:Pause the first video when a second one auto-starts
do you mean dividing the feature into 3 new features?
hi @MohamedLebda!
ImprovedTube.allow_autoplay === false &&
this looks like an exception to autoplay:off.
true only after keyboard activity.
(As said in your pull request about autoplay:off)
(thus won't be true if a user opens the first tab with no activity? )
I just tried this in the browser, but it would play a second video for 3 seconds then pause both. (btw, found a clue why the condition of no 'ad-showing' was there?)
ImprovedTube.storage.newTab (can be in Ram: https://developer.chrome.com/docs/extensions/reference/storage/#storage-areas )
do you mean dividing the feature into 3 new features?
no, sorry, we already have "two options of Auto-pause ":
(just made them disable each other)
- ...when switching tabs = "no background playing!"
- ...only one instance = allowing one background player
+3. (or 1.1.) Auto-pause, while video is scrolled away (like our 'custom mini player' will do)
+2.1. Allow (first) video to play when tab is opened in background (since chrome&firefox block autoplay in background)
+2.1.1. Keep all background videos in queue. - But In that case we could rather would be smarter to ignore opening the tabs/close immediately and turn the first tab into a youtube playlist link
more importantly:
- we can expand the feature to all standard <video> ?
- we can go back to manifest2
(so its worth it if you reviewed our tabs-code also in 3.965)
(thus won't be true if a user opens the first tab with no activity? )
yes but if the user opened the first (video) tab with no activity the improved.storage.newTab = false if (ImprovedTube.video_url !== location.href) { ImprovedTube.allow_autoplay = false; ImprovedTube.video_url = location.href ImprovedTube.storage.newTab = false