Merge pull request #701 from manualmanul/fix-youtube-tv

Partially fix YouTube TV support
This commit is contained in:
Ajay Ramachandran 2021-03-26 18:36:29 -04:00 committed by GitHub
commit 8dfa386cdb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1530,8 +1530,9 @@ function getSegmentsMessage(sponsorTimes: SponsorTime[]): string {
function addHotkeyListener(): boolean {
let videoRoot = document.getElementById("movie_player") as HTMLDivElement;
if (onInvidious) videoRoot = (document.getElementById("player-container") ?? document.getElementById("player")) as HTMLDivElement;
if (video.baseURI.startsWith("https://www.youtube.com/tv#/")) videoRoot = document.querySelector("ytlr-watch-page") as HTMLDivElement;
if (!videoRootsWithEventListeners.includes(videoRoot)) {
if (videoRoot && !videoRootsWithEventListeners.includes(videoRoot)) {
videoRoot.addEventListener("keydown", hotkeyListener);
videoRootsWithEventListeners.push(videoRoot);
return true;