Last active
November 5, 2020 23:51
-
-
Save DimaGashko/807de8a67f7fabbc08e3641650ecce30 to your computer and use it in GitHub Desktop.
Console.Youtube
This file contains 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
// Prevent autopause when youtube is plaing in the background | |
v = $('video'); | |
v.onpause = () => v.play(); | |
// To disable | |
v.onpause = null; |
This file contains 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
// Prevent autopause when youtube is plaing in the background | |
allowPause = false; | |
const video = document.querySelector('video'); | |
video.onpause = () => { | |
if (allowPause) return; | |
video.play(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Autopause when youtube is plaing in the background: