Skip to content

Commit

Permalink
Merge pull request #2389 from raszpl/patch-18
Browse files Browse the repository at this point in the history
Update player.js reverting #2062, fixes #1342 #1652 #1904
  • Loading branch information
ImprovedTube committed Jun 17, 2024
2 parents 85bf124 + a80bfa7 commit 33fb5bc
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions js&css/web-accessible/www.youtube.com/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,16 @@ ImprovedTube.autoplayDisable = function (videoElement) {
FORCED PLAY VIDEO FROM THE BEGINNING
------------------------------------------------------------------------------*/
ImprovedTube.forcedPlayVideoFromTheBeginning = function () {
if (this.storage.forced_play_video_from_the_beginning === true && document.documentElement.dataset.pageType === 'video' && !this.video_url.match(this.regex.video_time)?.[1]) {
this.elements.player.seekTo(0);
const player = this.elements.player,
video = this.elements.video,
paused = video?.paused;

if (player && video && this.storage.forced_play_video_from_the_beginning && location.pathname == '/watch') {
player.seekTo(0);
// restore previous paused state
if (paused) { player.pauseVideo(); }
}
};

/*------------------------------------------------------------------------------
AUTOPAUSE WHEN SWITCHING TABS
------------------------------------------------------------------------------*/
Expand Down

0 comments on commit 33fb5bc

Please sign in to comment.