Pour le coup, c’est simple =>
function getRandomInt(max) {
return Math.floor(Math.random() * Math.floor(max));
}
var random = getRandomInt(10);
if(random > 3) {
setTimeout(function() {
var audio = new Audio('wizebot://nuke-mp3');
audio.volume = 0.2; // Sound volume
audio.play();
}, 500);
window.notificationEnded = function() {
$(".screen_div").remove();
setRefresh(); // DON'T REMOVE.
};
$(".screen_div").html("<video width='100%' autoplay='1' onended='window.notificationEnded()' style='position: absolute; bottom: 0; right: 0'><source src='wizebot://nuke-webm' type='video/webm'></video>");
}else{
setTimeout(function() {
var audio = new Audio('https://datas-01.wizebot.tv/files_upload/global/462327/cmd_884912/5e6cbdd0c15b1.mp3');
audio.volume = 0.9; // Sound volume
audio.play();
}, 500);
window.notificationEnded = function() {
$(".screen_div").remove();
setRefresh(); // DON'T REMOVE.
};
$(".screen_div").html("<video width='100%' autoplay='1' onended='window.notificationEnded()' style='position: absolute; bottom: 0; right: 0'><source src='https://giant.gfycat.com/ClearCluelessBlueandgoldmackaw.webm' type='video/webm'></video>");
setTimeout(function() { setRefresh(); }, 20000);
}