Closed raszpl closed 2 weeks ago
ok
On Wed, Jun 12, 2024 at 11:05 AM Rasz_pl @.***> wrote:
You can view, comment on, or merge this pull request online at:
https://github.com/code-charity/youtube/pull/2375 Commit Summary
- 0911d32 https://github.com/code-charity/youtube/pull/2375/commits/0911d32b9e2bb67396fae7ca33c492e8bfd03c8b Update background.js keep focus/blur local
File Changes
(1 file https://github.com/code-charity/youtube/pull/2375/files)
- M background.js https://github.com/code-charity/youtube/pull/2375/files#diff-bb06783fccd762e4d905ab922491e954a9fbaf708a1acbf53dff92872b0bcd3b (49)
Patch Links:
- https://github.com/code-charity/youtube/pull/2375.patch
- https://github.com/code-charity/youtube/pull/2375.diff
— Reply to this email directly, view it on GitHub https://github.com/code-charity/youtube/pull/2375, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJ4GQKMR2VFDDITZYN3OPTTZG7MYJAVCNFSM6AAAAABJFTULVKVHI2DSMVQWIX3LMV43ASLTON2WKOZSGM2DOOBUG42DSOI . You are receiving this because you are subscribed to this thread.Message ID: @.***>
(merging untested)
thank you so much for caring in depth! @raszpl (as always)
(Did you check/compare the impact on each connected feature yet?)
chrome.windows.onFocusChanged is only slightly better due to 10 year old Chrome bug https://issues.chromium.org/issues/41116352 :o Chrome doesnt tell us when user alt-tabs away.
Can we make up for that somehow (...?)
have read alt+tab in our bug reports before
window.addEventListener("blur" ... https://github.com/code-charity/youtube/pull/2375 ... clicking in browser address bar takes focus away and pauses videos
(good to know too. might soon have more auto pause options https://github.com/code-charity/youtube/issues/2111)
(merging untested)
at least test if its not crashing :-)
(Did you check/compare the impact on each connected feature yet?)
I didnt change the mechanism in the end. Its doing exactly same thing old code was doing, just much less of it. Instead of spamming all unassociated (and hibernated) tabs with messages it now only sends it to YT tabs that send 'tab-connected' first and are still active.
chrome.windows.onFocusChanged is only slightly better due to 10 year old Chrome bug https://issues.chromium.org/issues/41116352 :o Chrome doesnt tell us when user alt-tabs away.
Can we make up for that somehow (...?)
Tried, failed, bug report suggest no one has a workaround. It is what it is.
Hmm, still getting errors, but now it was one instance
Uncaught (in promise) Error: Could not establish connection. Receiving end does not exist.
after few hours
at least test if its not crashing :-)
spoilers - it was crashing :] https://github.com/code-charity/youtube/pull/2380
at least test
some more people will already hopefully. it was also is just an acknowledgement, that the changes make me hurry :) @raszpl
chrome.windows.onFocusChanged is only slightly better due to 10 year old Chrome bug https://issues.chromium.org/issues/41116352 :o Chrome doesnt tell us when user alt-tabs away.
Can we make up for that somehow (...?)
Tried, failed, bug report suggest no one has a workaround. It is what it is.
(could monitor alt+tab keyboard events.)
Tried, failed, bug report suggest no one has a workaround. It is what it is.
(could monitor alt+tab keyboard events.)
so you didnt click the link and read that bug report :)
Keep track of connected tabs. Send only to connected tabs, send only to at most TWO tabs, one losing focus and one gaining it.
I tried experimenting with local
as mentioned in https://github.com/code-charity/youtube/pull/2375 but its much worse, clicking in browser address bar takes focus away and pauses videos :/. chrome.windows.onFocusChanged is only slightly better due to 10 year old Chrome bug https://issues.chromium.org/issues/41116352 :o Chrome doesnt tell us when user alt-tabs away. Firefox does send proper message and reacts to alt-tabbing just fine.
finally fixes https://github.com/code-charity/youtube/issues/2284 . Tested in Chrome, Vivaldi and FF.