<pre> <script> window.onload = function() { var mainaudio = document.getElementById("mainaudio"); var trailervideo = document.getElementById("trailer-video"); mainaudio.volume = 0.1; //If the video plays, the audio stops until the video pauses again. var flag = 0; trailervideo.onplay = function() { flag = 1; while (flag === 1) { mainaudio.pause(); if (flag === 1) { mainaudio.pause(); } else if (flag === 0) { mainaudio.play(); } trailervideo.onpause = function () { flag = 0; } } } } </script>
Quote:... the audio will automatically play when the webpage is loaded ...
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)