Got bumped with a problem, maybe someone can help me with it.
There is a script that should restart and play a video on an event ( play video.play(); ). On other browsers like Chrome etc. it works, except Safari.
On Safari it just resets the video to 0, but doesn't play it.
Seems like video.play() doesn't work on that browser.
Autoplay and mured are on.
Has anyone had this problem?
Here is the website https://luna-wealth-3b31bac5f1f8e980696881bf9d5.webflow.io/client-online-access
<script>
window.addEventListener('DOMContentLoaded', function () {
const video = document.getElementById("573dfe8f-6592-57e6-c48c-8e93fbdae2e3-video");
const trigger = document.getElementById("trigger");
const observerVideo = new IntersectionObserver((entries) => {
if (entries[0].isIntersecting) {
if (video.currentTime === 0) {
video.muted = true;
video.play();
}
}
}, { threshold: 1 });
const observerTrigger = new IntersectionObserver((entries) => {
if (entries[0].isIntersecting) {
if (video.currentTime !== 0) {
video.currentTime = 0
}
}
}, { threshold: 0 });
observerTrigger.observe(trigger);
observerVideo.observe(video);
})
</script>