I want to do that when user sign in with success on next page opened or tab it will be auto start video in picture-in-pucture mode, but when I try with this code bellow does not work:
<div class="col-md-12">
<video loop="1" autoplay="1" muted="" id="video" controls="" style="width:550px;height:350px;"
src="https://rawcdn.githack.com/Freshman-tech/custom-html5-video/911e6fbfc39d670cb26e94d6f3013b9426f4a679/video.mp4">
</video>
</div>
<script>
var video = document.getElementById('video');
if ('pictureInPictureEnabled' in document) {
document.addEventListener('click', () => {
video.requestPictureInPicture()
.catch(error => {
console.warn("Your Browser does not support picture in picture");
});
});
}
video.addEventListener('enterpictureinpicture', () => {
video.play()
});
video.addEventListener('leavepictureinpicture', () => {
video.play();
});
window.onload = () => document.querySelector("body").click();
</script>
d