Description from Webflow:
Using custom code to control unmuting and muting sound. Video independent of the sound file loading from a cloud server ( Dropbox ). By default all audio URLs end with d1=0, if left with default settings sound wont play change to d1=1.
Custom Code :
<audio src="https://youraudiosource.com" class="audio">
// The audio HTML element
const audio = document.querySelector('audio');
let playing = false;
// Check if document is ready
$(document).ready(function(){
// Clicking the play_btn
$('.play_btn').click(function(){
if (playing == true) {
audio.pause();
playing = false;
// Setting the button text
$(this).html("Play");
} else {
audio.play();
playing = true;
// Setting the button text
$(this).html("Pause");
}
});
});