Back to the Shapespark home page

How to show video when click play start button?

I wan gv it play full screen video when they click to start.
After video auto play finish (no scene loading finish, if video finish first then can continue show loading process) and click close, inside background music start to play.

1 Like

Hey Vito,

I’d try making an eventlistener to the “play-button” id :

document.getElementById("play-button").addEventListener("click",function(){
// Show a div with the video in it
document.getElementById("myDiv").style.display = "block";
// When the video ends, hide the div
document.getElementById("videoElement").onEnded = function(){
document.getElementById("myDiv").style.display = "none";
// Play "audio_file.mp3"
var audio = new Audio('audio_file.mp3');
audio.play();
};
});

With the autoplay, it should do the trick :slight_smile:

2 Likes

Very thank :grinning:! I will try it ltr.
This audio it’s related as SS background audio setting? Or I use this audio code then inside setting can’t set audio?
image