From: Cameron Ball Date: Fri, 11 Dec 2020 09:30:10 +0000 (+0800) Subject: Use local audio sources X-Git-Url: http://git.cameron1729.xyz/?p=niki-countdown.git;a=commitdiff_plain;h=17906e570c16ee12aef26a2879ed43cc1a6257e3 Use local audio sources --- diff --git a/audio/1.webm b/audio/1.webm new file mode 100644 index 0000000..564abfb Binary files /dev/null and b/audio/1.webm differ diff --git a/audio/2.webm b/audio/2.webm new file mode 100644 index 0000000..9198519 Binary files /dev/null and b/audio/2.webm differ diff --git a/index.html b/index.html index 342b613..76ce926 100644 --- a/index.html +++ b/index.html @@ -53,8 +53,10 @@ -
+ @@ -67,24 +69,10 @@ var vidElement = document.getElementById('video'); var activeVideo = Math.floor((Math.random() * 4) + 1); vidElement.src = "video/" + activeVideo + ".mp4"; - vidElement.addEventListener('ended', function(e) { - // update the active video index - activeVideo = (++activeVideo) % vidSources.length; - if(activeVideo === vidSources.length){ - activeVideo = 0; - } - - vidElement.src = vidSources[activeVideo]; - vidElement.play(); - }); - var vid = document.getElementById("video"); - vid.playbackRate = 0.5; - - var youtubeIds = ['VG1gcnCVJ8M', 'B_QCJSTxqfI']; - var youtubeId = youtubeIds[Math.floor(Math.random() * youtubeIds.length)]; - var iframe = document.getElementById('audio'); - iframe.src = "https://www.youtube.com/embed/" + youtubeId + "?controls=0&autoplay=1" + var audioElement = document.getElementById('audio'); + var activeAudio = Math.floor((Math.random() * 2) + 1); + audioElement.src = "audio/" + activeAudio + ".webm"; function pad(n, width, z) { z = z || '0'; @@ -103,8 +91,8 @@ function tick() { var timespan = countdown(null, new Date('January 4, 2021 03:47:00'), countdown.ALL); var text = timespan.value < 0 ? 'Welcome to Perth!' : units.reduce((c, v) => c + formatUnit(timespan, v), ""); - timerElement.innerHTML = text; - setTimeout(tick, delay); + timerElement.innerHTML = text; + setTimeout(tick, delay); } setTimeout(tick, delay);