Hi,
This is not possible now out of the box as part of the plugin. But because you are not the first one to ask for similar functions ie: Play a video after the sequence finishes is on our roadmap for future versions.
Nevertheless, below is a simple snippet, that listens to the scroll position and once the user scrolls past certain point (100px) it plays the sound.
// Reference: https://www.html5rocks.com/en/tutorials/speed/animations/
let lastKnownScrollPosition = 0;
let ticking = false;
let audio = new Audio('audio_file.mp3');
let isMusicPlaying=false;
function doSomething(scrollPos) {
// Here goes the play music logic
if (scrollPos > 100 && isMusicPlaying === false){
audio.play();
isMusicPlaying = true;
}
}
document.addEventListener('scroll', function(e) {
lastKnownScrollPosition = window.scrollY;
if (!ticking) {
window.requestAnimationFrame(function() {
doSomething(lastKnownScrollPosition);
ticking = false;
});
ticking = true;
}
});
I haven’t tested it myself, but the idea is simple – listen for scroll position to be bigger than certain value (100), and then play the music.
Please let me know if it works for you
Ales