Video autoplay is not working in mobile view

RMAG news

i am creating a project in angular and typescript. i have a video in homepage which ,the client have requirement to play without interaction and even if the video goes out of window viewport it has to play. so i added an interval function in ts file like;
ngAfterViewInit(): void {
const video = this.myVideo.nativeElement;
this.playCheckInterval = setInterval(() => {
// console.log(‘Video element:’, video.paused);

if (video.paused) {
video.play(); // Ensure the video keeps playing
}
}, 250); // Check every second (adjust as needed)

}

ngOnDestroy(): void {
if (this.playCheckInterval) {
clearInterval(this.playCheckInterval); // Clear the interval on component destroy
}
}
desktop it is playing but mobile is not auto playing. how can i achieve this?

Please follow and like us:
Pin Share