Fix the videoRoot to also work on invidious embeds

The root div of the player is not `#player-container` in invidious embeds but just `#player`.
This commit is contained in:
LJ
2021-03-04 15:26:25 +02:00
committed by GitHub
parent f59b7516fc
commit f48e1895db

View File

@@ -1529,7 +1529,7 @@ function getSegmentsMessage(sponsorTimes: SponsorTime[]): string {
function addHotkeyListener(): boolean {
let videoRoot = document.getElementById("movie_player") as HTMLDivElement;
if (onInvidious) videoRoot = document.getElementById("player-container") as HTMLDivElement;
if (onInvidious) videoRoot = (document.getElementById("player-container") ?? document.getElementById("player")) as HTMLDivElement;
if (!videoRootsWithEventListeners.includes(videoRoot)) {
videoRoot.addEventListener("keydown", hotkeyListener);