Enabling the audio
Method 1: Playing only sound, via 'Ambient Sound' Actor or other sound cues inside Unreal Engine. Then we are going to interact with the video element.
<script>
function handleMute() {
if (document.getElementById("streamingVideoContainer").muted === true) {
document.getElementById("streamingVideoContainer").muted = false;
} else {
document.getElementById("streamingVideoContainer").muted = true;
}
}
</script>
<button class="button" onclick="handleMute();">
Mute/Unmute
</button>
Method 2: Playing a movie with sound, via the MediaPlate Actor or MediaPlayer inside Unreal Engine. Then we are going to interact with the audio element.
<script>
function handleMute() {
if (document.getElementById('audioRef').paused === true) {
document.getElementById('audioRef').play();
}
else if (document.getElementById('audioRef').paused === false) {
document.getElementById('audioRef').pause();
}
}
</script>
<button class="button" onclick="handleMute();">
Mute/Unmute
</button>
<audio id="audioRef"></audio>
Last updated