maquinas07 / yttwthmode Goto Github PK
View Code? Open in Web Editor NEWTwitch-like theater mode for Youtube livestreams and archives.
License: MIT License
Twitch-like theater mode for Youtube livestreams and archives.
License: MIT License
Sometimes when I turn on theater mode, yttwthmode seems to not notice - I end up with the regular YouTube theater mode. Digging into the code, I found that the #player-wide-container
element doesn't seem to exist. However, there is a #player-full-bleed-container
that looks like it could be the replacement for it. In my limited testing1, using #player-full-bleed-container
as the theaterContainer
seems to result in the correct layout as far as I can tell. (I see from #16 that this isn't the first time that element's ID has changed.)
However, in other sessions, yttwthmode seems to work just fine. That suggests that YouTube is still using the older ID sometimes, possibly as part of an A/B test. So it might be worth checking for both IDs with something like:
theaterContainer = document.getElementById("player-full-bleed-container") || document.getElementById("player-wide-container");
or maybe even something like this, in case they change it yet again:
// Get the first descendant of the pageManagerContainer whose ID looks like player-*-container
theaterContainer = pageManagerContainer.querySelector('[id^="player-"][id$="-container"]:not(#player-container)')
I set a breakpoint at the equivalent of reloadPageElems
, reloaded the video page, then used the console to wrap the getElementById
function: const oldByID = document.getElementById; document.getElementById = function(id) { if(id === 'player-wide-container') id = 'player-full-bleed-container'; return oldByID.call(this, id); }
โฉ
When the addon's theater mode is active and autoplay goes to a normal video the extension bugs out.
Hi, thanks for the great work.
The hide chat button is good, but it is slightly different from the original theater mode (The search bar on the top ...etc).
If there's an enable/disable button than that would be great.
Looks like YouTube has changed the page structure yet again. There's still a #player-full-bleed-container
element, but it's been wrapped in another element #full-bleed-container
that sits between it and the ytd-watch-flexy.ytd-page-manager
. yttwthmode targets the inner one, and as a result, the player ends up partway under the chat, and the video information (title, description, and so on) appear overlaid on top of the video. Using the devtools to convince the extension to target #full-bleed-container
instead seems to result in the correct layout again.
I'm not sure yet if this one is being A/B tested or not, but if you want to continue supporting the old structure as well, I can think of two ways to do this:
querySelector
call to look for two different selectors:theaterContainer = pageManagerContainer.querySelector(
'#full-bleed-container, ' +
'[id^="player-"][id$="-container"]:not(#player-container)'
);
querySelector
will just return the first element it finds that matches either selector. That will be the outer #full-bleed-container
if it's there, and the #player-*-container
otherwise.
ytd-watch-flexy.ytd-page-manager
:theaterContainer = pageManagerContainer.querySelector('[id^="player-"][id$="-container"]:not(#player-container)');
theaterContainer = theaterContainer.closest('ytd-watch-flexy.ytd-page-manager > *');
That second line will do nothing if theaterContainer
already is a direct child, like in the old structure.
I'm not sure which of those is more likely to keep working as YouTube continues changing things.
When there's no chat available the addon reserves space for the frame anyway
When chat is hidden and theater mode is activated the addon reserves space for the chat frame but doesn't show chat
Turning on the Threatre Mode causes the upper bar to fully disappear (it turns fully black).
The search bar and all other elements, which you can usually find in the top bar, disappear and that behaviour stays consistent for all other YT tabs as well.
This means if I have one YT video opened in Theatre Mode, but open a 2nd YT tab (on e.g. the homepage or subscription page), then in that 2nd YT tab I will not be able to enter anything into the search bar, as it is gone.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.