diff --git a/js&css/web-accessible/init.js b/js&css/web-accessible/init.js index 9386fce27..1de110d36 100644 --- a/js&css/web-accessible/init.js +++ b/js&css/web-accessible/init.js @@ -41,8 +41,10 @@ new MutationObserver(function (mutationList) { }); ImprovedTube.init = function () { - ImprovedTube.pageType(); - + + window.addEventListener('yt-page-data-updated', function () { + ImprovedTube.pageType(); + }); var yt_player_updated = function () { document.dispatchEvent(new CustomEvent('improvedtube-player-loaded')); @@ -60,7 +62,11 @@ ImprovedTube.init = function () { this.onkeydown(); this.onmousedown(); this.youtubeLanguage(); - + + if (ImprovedTube.elements.player && ImprovedTube.elements.player.setPlaybackRate) { + ImprovedTube.videoPageUpdate(); + ImprovedTube.initPlayer(); + } if (window.matchMedia) { document.documentElement.dataset.systemColorScheme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';