Search code examples
videovolumeaframemute

a-videosphere control mute


I want to create a landing page with a-videosphere 360 video but I want to load it muted ... or with the volume at 0 because it's annoying to get surprised by sound when you land on a site. But I don't know the command to "mute" and "unmute" the video. ( and or control the volume )

<video muted id="video" style="display:none" autoplay loop crossorigin="anonymous" playsinline webkit-playsinline>
<source type="video/mp4" src="<?php echo $src; ?>" />
</video>

document.querySelector("#video").???();

Solution

  • Your example code already contains the correct attribute to load the video - 'muted'.

    You can mute a video by getting a reference to it and then set it to muted or not muted in Javascript:

    vid = document.getElementById("myPath/myvideo.mp4");
    
    //Mute video
    vid.muted = true;
    
    //Turn sound on 
    vid.muted = false;