1

I wrote a simple script to add an autoplay feature to a video streaming website

var vid = document.getElementById("my_video_1_html5_api");
var nxt = document.getElementById("Img2");
var ply = document.getElementsByClassName("vjs-big-play-button");

window.addEventListener('load', function () {
  vid.play();
  vid.requestFullscreen();
});

vid.onended = function() {
   nxt.click();
};

I get the error: Failed to execute 'requestFullscreen' on 'Element': API can only be initiated by a user gesture. it is running through the chrome extension Custom JavaScript for Websites Is there a way to bypass this because its a local script and not part of the website or allow non-user gestures on this domain in chrome, or do I need to use something like auto hot key to press the fullscreen button?

Whud
  • 714
  • 1
  • 6
  • 19
  • 1
    Does this answer your question? [how to initialize fullscreen without user interaction](https://stackoverflow.com/questions/30841517/how-to-initialize-fullscreen-without-user-interaction) – Harun Yilmaz Apr 08 '20 at 14:19
  • 1
    Thank you, That says what I already know that fullscreen needs user input. I was hoping there was a way to disable it as I'm not building this into a website or anything and it just needs to work on my machine. – Whud Apr 08 '20 at 14:28

0 Answers0