0

I am developing a chrome extension for YouTube. One of the functionality that I need is to pause/play the currently opened video.
I found out a way to do this is:

document.querySelector("#movie_player").playVideo()
or
document.querySelector("#movie_player").pauseVideo()

This works perfectly fine on console. But when I try to do the same in my content.js file, It gives the following error:

Uncaught (in promise) TypeError: document.querySelector(...).pauseVideo is not a function

I can't figure out how to use these functions in the content.js file.


Edit: Below is the statement and output of the script in content.js

content.js : console.log(document.querySelector("#movie_player"))


console log:
<div class="html5-video-player ytp-transparent ytp-exp-bottom-control-flexbox ytp-larger-tap-buttons ytp-exp-ppp-update ytp-hide-info-bar ytp-autonav-endscreen-cancelled-state paused-mode ytp-progress-bar-snap" tabindex="-1" id="movie_player" data-version="/s/player/edff9f99/player_ias.vflset/en_US/base.js" aria-label="YouTube Video Player"><div class="html5-video-container" data-layer="0"><video tabindex="-1" class="video-stream html5-main-video" controlslist="nodownload" style="width: 640px; height: 360px; left: 0px; top: 0px;" src="blob:https://www.youtube.com/852891f7-1d62-4401-be61-699a8a3608ab"></video></div><div class="ytp-gradient-top" data-layer="1"></div><div class="ytp-chrome-top" data-layer="1"><button class="ytp-playlist-menu-button ytp-button" aria-owns="ytp-id-23" aria-haspopup="true" aria-label="Playlist" style="display: none;"><div class="ytp-playlist-menu-button-icon"><svg height="100%" version="1.1" viewBox="0 0 36 36" width="100%"><use class="ytp-svg-shadow" xlink:href="#ytp-id-24" >< /use><path d="m 22.53,21.42 0,6.85 5.66,-3.42 -5.66,-3.42 0,0 z m -11.33,0 9.06,0 0,2.28 -9.06,0 0,-2.28 0,0 z m 0,-9.14 13.6,0 0,2.28 -13.6,0 0,-2.28 0,0 z m 0,4.57 13.6,0 0,2.28 -13.6,0 0,-2.28 0,0 z" fill="#fff" id="ytp-id-24"></path></svg></div><div class="ytp-playlist-menu-button-text"></div></button><div class="ytp-title-channel"><div class="ytp-title-beacon"></div><a class="ytp-title-channel-logo" target="_blank"></a><div class="ytp-title-expanded-overlay"><div class="ytp-title-expanded-heading"><h2 class="ytp-title-expanded-title"><a target="_blank" href="https://www.youtube.com"></a></h2><h3 class="ytp-title-expanded-subtitle"></h3></div></div></div><div class="ytp-title"><div class="ytp-title-text"><a class="ytp-title-link yt-uix-sessionlink ytp-title-fullerscreen-link" target="_blank" data-sessionlink="feature=player-title" tabindex="-1">The 3-4-7 miracle. Why is this one not super famous?</a><div class="ytp-title-subtext"><a class="ytp-title-channel-name" target="_blank" href=""></a></div></div></div><div class="ytp-chrome-top-buttons"><button class="ytp-watch-later-button ytp-button" data-tooltip-opaque="false" title="Watch later" aria-label="Watch later"><div class="ytp-watch-later-icon"><svg height="100%" version="1.1" viewBox="0 0 36 36" width="100%"><use class="ytp-svg-shadow" xlink:href="#ytp-id-25"></use><path class="ytp-svg-fill" d="M18,8 C12.47,8 8,12.47 8,18 C8,23.52 12.47,28 18,28 C23.52,28 28,23.52 28,18 C28,12.47 23.52,8 18,8 L18,8 Z M16,19.02 L16,12.00 L18,12.00 L18,17.86 L23.10,20.81 L22.10,22.54 L16,19.02 Z" id="ytp-id-25"></path></svg></div><div class="ytp-watch-later-title">Watch later</div></button><button class="ytp-button ytp-share-button ytp-share-button-visible" title="Share" aria-haspopup="true" aria-owns="ytp-id-27" data-tooltip-opaque="false" aria-label="Share"><div class="ytp-share-icon"><svg height="100%" version="1.1" viewBox="0 0 36 36" width="100%"><use class="ytp-svg-shadow" xlink:href="#ytp-id-41"></use><path class="ytp-svg-fill" d="m 20.20,14.19 0,-4.45 7.79,7.79 -7.79,7.79 0,-4.56 C 16.27,20.69 12.10,21.81 9.34,24.76 8.80,25.13 7.60,27.29 8.12,25.65 9.08,21.32 11.80,17.18 15.98,15.38 c 1.33,-0.60 2.76,-0.98 4.21,-1.19 z" id="ytp-id-41"></path></svg></div><div class="ytp-share-title">Share</div></button><button class="ytp-button ytp-copylink-button" data-tooltip-opaque="false" title="Copy link" aria-label="Copy link" style="display: none;"><div class="ytp-copylink-icon"><svg height="100%" version="1.1" viewBox="0 0 36 36" width="100%"><use class="ytp-svg-shadow" xlink:href="#ytp-id-38"></use><path class="ytp-svg-fill" d="M21.9,8.3H11.3c-0.9,0-1.7,.8-1.7,1.7v12.3h1.7V10h10.6V8.3z M24.6,11.8h-9.7c-1,0-1.8,.8-1.8,1.8v12.3  c0,1,.8,1.8,1.8,1.8h9.7c1,0,1.8-0.8,1.8-1.8V13.5C26.3,12.6,25.5,11.8,24.6,11.8z M24.6,25.9h-9.7V13.5h9.7V25.9z" id="ytp-id-38"></path></svg></div><div class="ytp-copylink-title" aria-hidden="true">Copy link</div></button><button class="ytp-button ytp-cards-button" aria-label="Show cards" aria-owns="iv-drawer" aria-haspopup="true" data-tooltip-opaque="false" style="display: none;"><span class="ytp-cards-button-icon-default"><div class="ytp-cards-button-icon"><svg height="100%" version="1.1" viewBox="0 0 36 36" width="100%"><use class="ytp-svg-shadow" xlink:href="#ytp-id-2"></use><path class="ytp-svg-fill" d="M18,8 C12.47,8 8,12.47 8,18 C8,23.52 12.47,28 18,28 C23.52,28 28,23.52 28,18 C28,12.47 23.52,8 18,8 L18,8 Z M17,16 L19,16 L19,24 L17,24 L17,16 Z M17,12 L19,12 L19,14 L17,14 L17,12 Z" id="ytp-id-2"></path></svg></div><div class="ytp-cards-button-title">Info</div></span><span class="ytp-cards-button-icon-shopping"><div class="ytp-cards-button-icon"><svg height="100%" version="1.1" viewBox="0 0 36 36" width="100%"><path class="ytp-svg-shadow" d="M 27.99,18 A 9.99,9.99 0 1 1 8.00,18 9.99,9.99 0 1 1 27.99,18 z"></path><path class="ytp-svg-fill" d="M 18,8 C 12.47,8 8,12.47 8,18 8,23.52 12.47,28 18,28 23.52,28 28,23.52 28,18 28,12.47 23.52,8 18,8 z m -4.68,4 4.53,0 c .35,0 .70,.14 .93,.37 l 5.84,5.84 c .23,.23 .37,.58 .37,.93 0,.35 -0.13,.67 -0.37,.90 L 20.06,24.62 C 19.82,24.86 19.51,25 19.15,25 c -0.35,0 -0.70,-0.14 -0.93,-0.37 L 12.37,18.78 C 12.13,18.54 12,18.20 12,17.84 L 12,13.31 C 12,12.59 12.59,12 13.31,12 z m .96,1.31 c -0.53,0 -0.96,.42 -0.96,.96 0,.53 .42,.96 .96,.96 .53,0 .96,-0.42 .96,-0.96 0,-0.53 -0.42,-0.96 -0.96,-0.96 z" fill-opacity="1"></path><path class="ytp-svg-shadow-fill" d="M 24.61,18.22 18.76,12.37 C 18.53,12.14 18.20,12 17.85,12 H 13.30 C 12.58,12 12,12.58 12,13.30 V 17.85 c 0,.35 .14,.68 .38,.92 l 5.84,5.85 c .23,.23 .55,.37 .91,.37 .35,0 .68,-0.14 .91,-0.38 L 24.61,20.06 C 24.85,19.83 25,19.50 25,19.15 25,18.79 24.85,18.46 24.61,18.22 z M 14.27,15.25 c -0.53,0 -0.97,-0.43 -0.97,-0.97 0,-0.53 .43,-0.97 .97,-0.97 .53,0 .97,.43 .97,.97 0,.53 -0.43,.97 -0.97,.97 z" fill="#000" fill-opacity="0.15"></path></svg></div><div class="ytp-cards-button-title">Shopping</div></span></button><div class="ytp-cards-teaser" style="display: none;"><div class="ytp-cards-teaser-box"></div><div class="ytp-cards-teaser-text"><span class="ytp-cards-teaser-label"></span></div></div><button class="ytp-button ytp-overflow-button" title="More" aria-haspopup="true" aria-owns="ytp-id-30" aria-label="More"><div class="ytp-overflow-icon"><svg height="100%" viewBox="-5 -5 36 36" width="100%"><path d="M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z" fill="#fff"></path></svg></div></button></div></div><button class="ytp-unmute ytp-popup ytp-button ytp-unmute-animated ytp-unmute-shrink" data-layer="2" style="display: none;"><div class="ytp-unmute-inner"><div class="ytp-unmute-icon"><svg height="100%" version="1.1" viewBox="0 0 36 36" width="100%"><use class="ytp-svg-shadow" xlink:href="#ytp-id-1"></use><path class="ytp-svg-fill" d="m 21.48,17.98 c 0,-1.77 -1.02,-3.29 -2.5,-4.03 v 2.21 l 2.45,2.45 c .03,-0.2 .05,-0.41 .05,-0.63 z m 2.5,0 c 0,.94 -0.2,1.82 -0.54,2.64 l 1.51,1.51 c .66,-1.24 1.03,-2.65 1.03,-4.15 0,-4.28 -2.99,-7.86 -7,-8.76 v 2.05 c 2.89,.86 5,3.54 5,6.71 z M 9.25,8.98 l -1.27,1.26 4.72,4.73 H 7.98 v 6 H 11.98 l 5,5 v -6.73 l 4.25,4.25 c -0.67,.52 -1.42,.93 -2.25,1.18 v 2.06 c 1.38,-0.31 2.63,-0.95 3.69,-1.81 l 2.04,2.05 1.27,-1.27 -9,-9 -7.72,-7.72 z m 7.72,.99 -2.09,2.08 2.09,2.09 V 9.98 z" id="ytp-id-1"></path></svg></div><div class="ytp-unmute-text">Tap to unmute</div><div class="ytp-unmute-box"></div></div></button><div class="ytp-cued-thumbnail-overlay" data-layer="4" style="display: none;"><div class="ytp-cued-thumbnail-overlay-image"></div><button class="ytp-large-play-button ytp-button" aria-label="Play"><svg height="100%" version="1.1" viewBox="0 0 68 48" width="100%"><path class="ytp-large-play-button-bg" d="M66.52,7.74c-0.78-2.93-2.49-5.41-5.42-6.19C55.79,.13,34,0,34,0S12.21,.13,6.9,1.55 C3.97,2.33,2.27,4.81,1.48,7.74C0.06,13.05,0,24,0,24s0.06,10.95,1.48,16.26c0.78,2.93,2.49,5.41,5.42,6.19 C12.21,47.87,34,48,34,48s21.79-0.13,27.1-1.55c2.93-0.78,4.64-3.26,5.42-6.19C67.94,34.95,68,24,68,24S67.94,13.05,66.52,7.74z" fill="#f00"></path><path d="M 45,24 27,14 27,34" fill="#fff"></path></svg></button></div><div class="ytp-spinner" data-layer="4" style="display: none;"><div class="ytp-spinner-container"><div class="ytp-spinner-rotator"><div class="ytp-spinner-left"><div class="ytp-spinner-circle"></div></div><div class="ytp-spinner-right"><div class="ytp-spinner-circle"></div></div></div></div><div class="ytp-spinner-message" style="display: none;">If playback doesn't begin shortly, try restarting your device.</div></div><div class="ytp-paid-content-overlay" aria-live="assertive" aria-atomic="true" data-layer="4"><a class="ytp-paid-content-overlay-link" target="_blank" style="display: none;"><div class="ytp-paid-content-overlay-icon"></div><div class="ytp-paid-content-overlay-text"></div><div class="ytp-paid-content-overlay-chevron"></div></a></div><div class="ytp-storyboard-framepreview" data-layer="4" style="display: none;"><div class="ytp-storyboard-framepreview-img"></div></div><div data-layer="4" style="display: none;" class="ytp-bezel-text-hide"><div class="ytp-bezel-text-wrapper"><div class="ytp-bezel-text"></div></div><div class="ytp-bezel" role="status" aria-label="Pause"><div class="ytp-bezel-icon"><svg height="100%" version="1.1" viewBox="0 0 36 36" width="100%"><use class="ytp-svg-shadow" xlink:href="#ytp-id-39"></use><path class="ytp-svg-fill" d="M 12,26 16,26 16,10 12,10 z M 21,26 25,26 25,10 21,10 z" id="ytp-id-39"></path></svg></div></div></div><div class="ytp-doubletap-ui-legacy" data-layer="4" style="display: none;"><div class="ytp-doubletap-fast-forward-ve"></div><div class="ytp-doubletap-rewind-ve"></div><div class="ytp-doubletap-static-circle"><div class="ytp-doubletap-ripple"></div></div><div class="ytp-doubletap-overlay-a11y"></div><div class="ytp-doubletap-seek-info-container"><div class="ytp-doubletap-arrows-container"><span class="ytp-doubletap-base-arrow"></span><span class="ytp-doubletap-base-arrow"></span><span class="ytp-doubletap-base-arrow"></span></div><div class="ytp-doubletap-tooltip"><div class="ytp-chapter-seek-text-legacy"></div><div class="ytp-doubletap-tooltip-label"></div></div></div></div><div aria-live="polite" data-layer="4" style="max-width: 300px; top: 273px; left: 461px; display: none;" class="ytp-tooltip ytp-bottom" aria-hidden="true"><div class="ytp-tooltip-text-wrapper"><div class="ytp-tooltip-image"></div><div class="ytp-tooltip-title" style="right: 81.5px; text-align: center;"><svg height="100%" viewBox="0 0 24 24" width="100%"><g><rect fill="none" height="24" width="24" x="0"></rect></g><g><g><polygon points="19,9 20.25,6.25 23,5 20.25,3.75 19,1 17.75,3.75 15,5 17.75,6.25"></polygon><polygon points="19,15 17.75,17.75 15,19 17.75,20.25 19,23 20.25,20.25 23,19 20.25,17.75"></polygon><path d="M11.5,9.5L9,4L6.5,9.5L1,12l5.5,2.5L9,20l2.5-5.5L17,12L11.5,9.5z M9.99,12.99L9,15.17l-0.99-2.18L5.83,12l2.18-0.99 L9,8.83l0.99,2.18L12.17,12L9.99,12.99z"></path></g></g></svg><span>The Coin rotation paradox</span></div><span class="ytp-tooltip-text">Miniplayer (i)</span></div><div class="ytp-tooltip-bg" style="width: 159px; height: 89.5px;"><div class="ytp-tooltip-duration"></div></div></div><div class="ytp-ad-persistent-progress-bar-container" data-layer="4" style="display: none;"><div class="ytp-ad-persistent-progress-bar"></div></div><div class="ytp-suggested-action" data-layer="4"><button class="ytp-button ytp-suggested-action-badge ytp-suggested-action-badge-with-controls ytp-suggested-action-badge-expanded" style="display: none;" aria-label=""><div class="ytp-suggested-action-badge-icon"></div><div class="ytp-suggested-action-badge-expanded-content-container" style=""><label class="ytp-suggested-action-badge-title"></label><button class="ytp-suggested-action-badge-dismiss-button-icon ytp-button" aria-label=""></button></div></button></div><div class="ytp-suggested-action" data-layer="4"><button class="ytp-button ytp-suggested-action-badge ytp-suggested-action-badge-with-controls" style="display: none;"><div class="ytp-suggested-action-badge-expanded-content-container" style="display: none;"><label class="ytp-suggested-action-badge-title"></label><button class="ytp-suggested-action-badge-dismiss-button-icon ytp-button"></button></div></button></div><div class="ytp-remote" data-layer="4" style="display: none;"><div class="ytp-remote-display-status"><div class="ytp-remote-display-status-icon"><svg height="100%" version="1.1" viewBox="0 0 36 36" width="100%"><use class="ytp-svg-shadow" xlink:href="#ytp-id-35"></use><path d="M7,24 L7,27 L10,27 C10,25.34 8.66,24 7,24 L7,24 Z M7,20 L7,22 C9.76,22 12,24.24 12,27 L14,27 C14,23.13 10.87,20 7,20 L7,20 Z M25,13 L11,13 L11,14.63 C14.96,15.91 18.09,19.04 19.37,23 L25,23 L25,13 L25,13 Z M7,16 L7,18 C11.97,18 16,22.03 16,27 L18,27 C18,20.92 13.07,16 7,16 L7,16 Z M27,9 L9,9 C7.9,9 7,9.9 7,11 L7,14 L9,14 L9,11 L27,11 L27,25 L20,25 L20,27 L27,27 C28.1,27 29,26.1 29,25 L29,11 C29,9.9 28.1,9 27,9 L27,9 Z" fill="#fff" id="ytp-id-35"></path></svg></div><div class="ytp-remote-display-status-text"></div></div></div><div class="ytp-mdx-popup-dialog" role="dialog" data-layer="4" style="display: none;"><div class="ytp-mdx-popup-dialog-inner-content"><div class="ytp-mdx-popup-title">You're signed out</div><div class="ytp-mdx-popup-description">Videos you watch may be added to the TV's watch history and influence TV recommendations. To avoid this, cancel and sign in to YouTube on your computer.</div><div class="ytp-mdx-privacy-popup-buttons"><button class="ytp-button ytp-mdx-privacy-popup-cancel">Cancel</button><button class="ytp-button ytp-mdx-privacy-popup-confirm">Confirm</button></div></div></div><div class="ytp-miniplayer-ui" data-layer="4" style="display: none;"></div><div class="ytp-caption-window-container" id="ytp-caption-window-container" data-layer="4"></div><div class="ytp-autonav-endscreen-countdown-container ytp-autonav-endscreen-small-mode ytp-autonav-endscreen-upnext-no-alternative-header" data-layer="4" style="display: none;"><div class="ytp-autonav-endscreen-upnext-container"><div class="ytp-autonav-endscreen-upnext-header">Up next</div><div class="ytp-autonav-endscreen-upnext-alternative-header"></div><a class="ytp-autonav-endscreen-link-container" target=""><div class="ytp-autonav-endscreen-upnext-thumbnail" style=""><div class="ytp-autonav-timestamp"></div><div class="ytp-autonav-live-stamp">Live</div><div class="ytp-autonav-upcoming-stamp">Upcoming</div></div><div class="ytp-autonav-endscreen-video-info"><div class="ytp-autonav-endscreen-premium-badge"></div><div class="ytp-autonav-endscreen-upnext-title"></div><div class="ytp-autonav-endscreen-upnext-author"></div><div class="ytp-autonav-view-and-date"></div><div class="ytp-autonav-author-and-view"></div></div></a></div><div class="ytp-autonav-overlay" style="width: 640px;"></div><div class="ytp-autonav-endscreen-button-container" style="display: none;"><button class="ytp-autonav-endscreen-upnext-button ytp-autonav-endscreen-upnext-cancel-button" aria-label="Cancel autoplay">Cancel</button><a class="ytp-autonav-endscreen-upnext-button ytp-autonav-endscreen-upnext-play-button" role="button" aria-label="Play next video">Play Now</a></div></div><div class="html5-endscreen ytp-player-content videowall-endscreen" data-layer="4" style="display: none;"><button class="ytp-button ytp-endscreen-previous" aria-label="Previous"><svg height="100%" version="1.1" viewBox="0 0 32 32" width="100%"><path d="M 19.41,20.09 14.83,15.5 19.41,10.91 18,9.5 l -6,6 6,6 z" fill="#fff"></path></svg></button><div class="ytp-endscreen-content"></div><button class="ytp-button ytp-endscreen-next" aria-label="Next"><svg height="100%" version="1.1" viewBox="0 0 32 32" width="100%"><path d="m 12.59,20.34 4.58,-4.59 -4.58,-4.59 1.41,-1.41 6,6 -6,6 z" fill="#fff"></path></svg></button></div><div class="ytp-multicam-menu" role="dialog" data-layer="5" style="display: none;"><div class="ytp-multicam-menu-header"><div class="ytp-multicam-menu-title">Switch camera<button class="ytp-multicam-menu-close ytp-button" aria-label="Close"><svg height="100%" viewBox="0 0 24 24" width="100%"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" fill="#fff"></path></svg></button></div></div><div class="ytp-multicam-menu-items"></div></div><div class="ytp-playlist-menu" role="dialog" id="ytp-id-23" data-layer="5" style="display: none;"><div class="ytp-playlist-menu-header"><div class="ytp-playlist-menu-title"><a class="ytp-playlist-menu-title-name"></a><button class="ytp-playlist-menu-close ytp-button" aria-label="Close"><svg height="100%" viewBox="0 0 24 24" width="100%"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" fill="#fff"></path></svg></button></div><div class="ytp-playlist-menu-subtitle"></div></div><div class="ytp-playlist-menu-items" role="menu"></div></div><div class="ytp-share-panel" id="ytp-id-27" role="dialog" aria-labelledby="ytp-id-26" data-layer="5" style="display: none;"><div class="ytp-share-panel-inner-content"><div class="ytp-share-panel-title" id="ytp-id-26">Share</div><a class="ytp-share-panel-link ytp-no-contextmenu" target="_blank" title="Share link" aria-label="Share link"></a><label class="ytp-share-panel-include-playlist"><input class="ytp-share-panel-include-playlist-checkbox" type="checkbox" checked="true">Include playlist</label><div class="ytp-share-panel-loading-spinner"><div class="ytp-spinner-container"><div class="ytp-spinner-rotator"><div class="ytp-spinner-left"><div class="ytp-spinner-circle"></div></div><div class="ytp-spinner-right"><div class="ytp-spinner-circle"></div></div></div></div></div><div class="ytp-share-panel-service-buttons"></div><div class="ytp-share-panel-error">An error occurred while retrieving sharing information. Please try again later.</div></div><button class="ytp-share-panel-close ytp-button" title="Close" aria-label="Close"><svg height="100%" viewBox="0 0 24 24" width="100%"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" fill="#fff"></path></svg></button></div><div class="ytp-overflow-panel" id="ytp-id-30" role="dialog" data-layer="5" style="display: none;"><div class="ytp-overflow-panel-content"><div class="ytp-overflow-panel-action-buttons"></div></div><button class="ytp-overflow-panel-close ytp-button" title="Close" aria-label="Close"><svg height="100%" viewBox="0 0 24 24" width="100%"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" fill="#fff"></path></svg></button></div><div class="ytp-popup ytp-settings-menu" data-layer="6" style="display: none;" id="ytp-id-17"><div class="ytp-panel"><div class="ytp-panel-menu" role="menu"></div></div></div><div class="ytp-gradient-bottom" data-layer="9" style="height: 146px; background-image: url(&quot;data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAACSCAYAAACE56BkAAAAAXNSR0IArs4c6QAAAPVJREFUKFNlyOlHGAAcxvHuY93H1n1fW1v3fbej+zAmI5PIRGYiM5JEEkkiiSSRRPoj83nze9Pz4uPrSUh4tURPEpKDFJWKtCBdZSAzeKOykB3kqFzkBfmqAIVBkSrGW7wLSlQpyoJyVYHKoEpVoyaoVXWoDxpUI5qCZtWC98EH1YqPwSfVhvagQ3WiK+hWPegN+lQ/BoJBNYRhjASjagzjwYSaxOfgi/qKb8GUmsZMMKvmMB8sqEUsYRnf8QMr+IlV/MIa1rGB39jEFv7gL7axg3/4j13sYR8HOMQRjnGCU5zhHBe4xBWucYNb3OEeD3jEE55fAOe7I9q0+rDDAAAAAElFTkSuQmCC&quot;);"></div><div class="ytp-chrome-bottom" data-layer="9" style="width: 616px; left: 12px;"><div class="ytp-progress-bar-container" style="height: 5px;"><div class="ytp-heat-map-container"><div class="ytp-heat-map-edu"></div></div><div class="ytp-progress-bar" tabindex="0" role="slider" aria-label="Seek slider" draggable="true" aria-valuemin="0" aria-valuemax="1404" aria-valuenow="2" aria-valuetext="Intro 0 Minutes 2 Seconds of 23 Minutes 24 Seconds" style="touch-action: none;"><div class="ytp-chapters-container"><div class="ytp-chapter-hover-container ytp-exp-chapter-hover-container" style="width: 227px; margin-right: 2px;"><div class="ytp-progress-bar-padding"></div><div class="ytp-progress-list"><div class="ytp-play-progress ytp-swatch-background-color" style="left: 0px; transform: scaleX(0.00450931);"></div><div class="ytp-progress-linear-live-buffer"></div><div class="ytp-load-progress" style="left: 0px; transform: scaleX(0.239332);"></div><div class="ytp-hover-progress ytp-hover-progress-light" style="left: 1.02361px; transform: scaleX(0.995491);"></div><div class="ytp-ad-progress-list"></div></div></div><div class="ytp-chapter-hover-container ytp-exp-chapter-hover-container ytp-exp-chapter-hover-effect" style="margin-right: 2px; width: 187px;"><div class="ytp-progress-bar-padding"></div><div class="ytp-progress-list"><div class="ytp-play-progress ytp-swatch-background-color" style="left: 0px; transform: scaleX(0);"></div><div class="ytp-progress-linear-live-buffer"></div><div class="ytp-load-progress" style="left: 0px; transform: scaleX(0);"></div><div class="ytp-hover-progress ytp-hover-progress-light" style="left: 0px; transform: scaleX(0.994652);"></div><div class="ytp-ad-progress-list"></div></div></div><div class="ytp-chapter-hover-container ytp-exp-chapter-hover-container" style="margin-right: 2px; width: 68px;"><div class="ytp-progress-bar-padding"></div><div class="ytp-progress-list"><div class="ytp-play-progress ytp-swatch-background-color" style="left: 0px; transform: scaleX(0);"></div><div class="ytp-progress-linear-live-buffer"></div><div class="ytp-load-progress" style="left: 0px; transform: scaleX(0);"></div><div class="ytp-hover-progress" style="left: 0px; transform: scaleX(0);"></div><div class="ytp-ad-progress-list"></div></div></div><div class="ytp-chapter-hover-container ytp-exp-chapter-hover-container" style="margin-right: 2px; width: 33px;"><div class="ytp-progress-bar-padding"></div><div class="ytp-progress-list"><div class="ytp-play-progress ytp-swatch-background-color" style="left: 0px; transform: scaleX(0);"></div><div class="ytp-progress-linear-live-buffer"></div><div class="ytp-load-progress" style="left: 0px; transform: scaleX(0);"></div><div class="ytp-hover-progress" style="left: 0px; transform: scaleX(0);"></div><div class="ytp-ad-progress-list"></div></div></div><div class="ytp-chapter-hover-container ytp-exp-chapter-hover-container" style="margin-right: 2px; width: 30px;"><div class="ytp-progress-bar-padding"></div><div class="ytp-progress-list"><div class="ytp-play-progress ytp-swatch-background-color" style="left: 0px; transform: scaleX(0);"></div><div class="ytp-progress-linear-live-buffer"></div><div class="ytp-load-progress" style="left: 0px; transform: scaleX(0);"></div><div class="ytp-hover-progress" style="left: 0px; transform: scaleX(0);"></div><div class="ytp-ad-progress-list"></div></div></div><div class="ytp-chapter-hover-container ytp-exp-chapter-hover-container" style="width: 60px;"><div class="ytp-progress-bar-padding"></div><div class="ytp-progress-list"><div class="ytp-play-progress ytp-swatch-background-color" style="left: 0px; transform: scaleX(0);"></div><div class="ytp-progress-linear-live-buffer"></div><div class="ytp-load-progress" style="left: 0px; transform: scaleX(0);"></div><div class="ytp-hover-progress" style="left: 0px; transform: scaleX(0);"></div><div class="ytp-ad-progress-list"></div></div></div></div><div class="ytp-marker-crenellation-list"></div><div class="ytp-timed-markers-container"></div><div class="ytp-clip-start-exclude" style="width: 0%;"></div><div class="ytp-clip-end-exclude" style="left: 100%; width: 0%;"></div><div class="ytp-scrubber-container" style="transform: translateX(1.02361px);"><div class="ytp-scrubber-button ytp-swatch-background-color" style="height: 13px;"><div class="ytp-scrubber-pull-indicator"></div></div></div></div><div class="ytp-fine-scrubbing-container"></div><div class="ytp-bound-time-left">0:00</div><div class="ytp-bound-time-right">23:24</div><div class="ytp-clip-start" draggable="true" title="Watch full video" style="touch-action: none; left: 0%;"><svg height="100%" version="1.1" viewBox="0 0 14 14" width="100%"><use class="ytp-svg-shadow" xlink:href="#ytp-id-3"></use><path d="M12,14 L9,11 L9,3 L12,0 L5,0 L5,14 L12,14 Z" fill="#eaeaea" id="ytp-id-3"></path></svg></div><div class="ytp-clip-end" draggable="true" title="Watch full video" style="touch-action: none; left: 100%;"><svg height="100%" version="1.1" viewBox="0 0 14 14" width="100%"><use class="ytp-svg-shadow" xlink:href="#ytp-id-4"></use><path d="M2,14 L5,11 L5,3 L2,0 L9,0 
Yash Singh
  • 11
  • 6
  • Without a [mcve] we can only guess, but it’s likely that the selector isn’t finding the element. – evolutionxbox Jan 06 '22 at 09:16
  • @evolutionxbox Selector is finding the element, I have updated the post – Yash Singh Jan 06 '22 at 09:28
  • Do not trust the console log over the error. If the error says it’s null or undefined, then the log is being evaluated after the code has been run – evolutionxbox Jan 06 '22 at 09:29
  • @evolutionxbox The error doesn't says it's null or undefined, it just says it can't find that specific function(pauseVideo). – Yash Singh Jan 06 '22 at 09:40
  • Apologies. It seems the element being returned is a div. Try selecting for the actual video element? `document.querySelector('#movie_player video')`? – evolutionxbox Jan 06 '22 at 11:36
  • @evolutionxbox This link solved the problem: https://stackoverflow.com/questions/9515704/use-a-content-script-to-access-the-page-context-variables-and-functions – Yash Singh Jan 06 '22 at 12:06

0 Answers0