nk-o / jarallax

Parallax scrolling for modern browsers
https://jarallax.nkdev.info
MIT License
1.39k stars 214 forks source link

Jarallax video doesnt work on phone #227

Open Saku241 opened 4 months ago

Saku241 commented 4 months ago

Issue description:

Hello, I'm using jarallax to have a background video from youtube and the video works on browser (but I have to mute the sound for the autoplay) BUT it doesnt work on any phone. Actually it shows youtube controllers ui with a loading wheel and never play. After some tweak I was able to make it work but the video played with sound...

Code to reproduce the issue (HTML blocks + JavaScript initialization)

<div id="started-video-bg" class="video-bg media-bg jarallax-video video-mobile-bg" data-jarallax data-video-src="https://youtu.be/ab0TSkLe-E0" data-video-volume="0">
<div class="video-bg-mask"></div>
<div class="video-bg-texture" id="grained_container"></div>
</div> 

EDIT : It works when putting this extra script : (So this is for sure a volume problem but I dont get it since I already put the data parameter "data-video-volume="0" ....

<div id="started-video-bg" class="video-bg media-bg jarallax-video video-mobile-bg" data-jarallax data-video-src="https://youtu.be/ab0TSkLe-E0" data-video-volume="0">
<div class="video-bg-mask"></div>
<div class="video-bg-texture" id="grained_container"></div>
</div>
<script>
    document.addEventListener("DOMContentLoaded", function() {
        jarallax(document.querySelectorAll('.jarallax-video'), {
            videoVolume: 0,
        });
    });
</script>