简体   繁体   中英

Video Volume Not Adjusting

Video loads and plays, but volume is at 100%. I want it at 20%. Code to adjust isn't working. Ideas?

<script>
function setvolume() {
var vid = document.getElementById("myVideo");
vid.volume = 0.2;
}
window.onload = setvolume;
</script>

<video src="{!-ASSETSPATH-!}External%20Files/Hurricane%20Home.m4v" autoplay="autoplay id="myVideo"></video> 

You have to make sure that the video element is ready before setting the volume. Try hooking up on the canplay event it emits or one of the earlier events.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM