*.user.js - the bigger file - click RAW to install
*.meta.js - file for updates checks - ignore
Last active
April 6, 2025 17:34
-
-
Save JakubMarcinkowski/dfdb4567aaf08d4d68903e9c666b62dd to your computer and use it in GitHub Desktop.
Prime Video - toggle pause on minimize or hide. Pause Amazon Prime Video movie on minimize, hide, tab switch... and play when it's back.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Prime Video - toggle pause on minimize or hide | |
// @version 2025-04-06 | |
// @namespace Jakub Marcinkowski | |
// @description Pause Amazon Prime Video movie on minimize, hide, tab switch... and play when it's back. | |
// @author Jakub Marcinkowski <kuba.marcinkowski on g mail> | |
// @copyright 2024+, Jakub Marcinkowski <kuba.marcinkowski on g mail> | |
// @license Zlib | |
// @homepageURL https://gist.github.com/JakubMarcinkowski | |
// @homepageURL https://github.com/JakubMarcinkowski | |
// @updateURL https://gist.github.com/JakubMarcinkowski/098b8913527a41f1d842b10b38f7a58b/raw/prime-video-toggle-pause-on-minimize-or-hide.user.meta.js | |
// @downloadURL https://gist.github.com/JakubMarcinkowski/098b8913527a41f1d842b10b38f7a58b/raw/prime-video-toggle-pause-on-minimize-or-hide.user.js | |
// @match https://*.primevideo.com/* | |
// @icon data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9Ii01MCAtNTAgMTAwIDEwMCI+PGxpbmVhckdyYWRpZW50IGlkPSJnIiB5MT0iMSIgeDI9IjEiPjxzdG9wIHN0b3AtY29sb3I9IiMwYTNkODAiLz48c3RvcCBzdG9wLWNvbG9yPSIjMDI5YmQyIiBvZmZzZXQ9IjEiLz48L2xpbmVhckdyYWRpZW50PjxjaXJjbGUgcj0iNTAiIGZpbGw9InVybCgjZykiLz48cGF0aCBkPSJNLTEzLC0yMFYyMEwyMCwwIiBmaWxsPSIjZmZmIi8+PC9zdmc+ | |
// @noframes | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
document.addEventListener("visibilitychange", () => { | |
const player = document.querySelector('video[id^="dummy"][src^="blob"]'); | |
if (document.visibilityState === 'hidden') { | |
player.pause(); | |
} else { | |
player.play(); | |
} | |
}); | |
})(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Prime Video - toggle pause on minimize or hide | |
// @version 2025-04-06 | |
// @namespace Jakub Marcinkowski | |
// @downloadURL https://gist.github.com/JakubMarcinkowski/dfdb4567aaf08d4d68903e9c666b62dd/raw/prime-video-toggle-pause-on-minimize-or-hide.user.js | |
// ==/UserScript== |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment