I have a web page where I want to let the user to click a button and start to watch a video in fullscreen mode. However, I don't want the video to play immediately after clicking the button. I want it to wait some seconds and then play the video and go fullscreen. To achieve this; I have used the setTimeout function like so;
function startVideoAfterSecs(seconds){
setTimeout(() => {
this.activateFullscreen(); // function to go fullsreen
this.player.play();
}, seconds);
};
I know that it is not possible to go fullscreen without a user interaction, there should be some user event to trigger it. That's why, startVideoAfterSecs
is bound to a button's onclick
event. However, I am still getting the error;
Unhandled Rejection (TypeError): fullscreen error
I know that this error is causing about a browser blockage, because it does not accept it as a user action since the setTimeout
function is being used. Are there any way to solve this issue?
Thanks in advance.