Add audio playback functionality to FakeAdminResponder
All checks were successful
Build and push image / docker-build (push) Successful in 3m53s
All checks were successful
Build and push image / docker-build (push) Successful in 3m53s
This commit is contained in:
@@ -187,6 +187,7 @@ public class FakeAdminResponder {
|
|||||||
<h1>0xb00b5 team Packmate</h1>
|
<h1>0xb00b5 team Packmate</h1>
|
||||||
<div class="badge">// @danosito</div>
|
<div class="badge">// @danosito</div>
|
||||||
<canvas id="snap-canvas"></canvas>
|
<canvas id="snap-canvas"></canvas>
|
||||||
|
<audio id="fun-music" src="/fake/audio/Archive.Clue.mp3" preload="auto" loop></audio>
|
||||||
<div class="typed">
|
<div class="typed">
|
||||||
<span id="typed-text"></span><span class="cursor"></span>
|
<span id="typed-text"></span><span class="cursor"></span>
|
||||||
</div>
|
</div>
|
||||||
@@ -198,6 +199,7 @@ public class FakeAdminResponder {
|
|||||||
const canvas = document.getElementById('snap-canvas');
|
const canvas = document.getElementById('snap-canvas');
|
||||||
const ctx = canvas.getContext('2d');
|
const ctx = canvas.getContext('2d');
|
||||||
const textEl = document.getElementById('typed-text');
|
const textEl = document.getElementById('typed-text');
|
||||||
|
const audioEl = document.getElementById('fun-music');
|
||||||
|
|
||||||
const pick = (list) => list[Math.floor(Math.random() * list.length)];
|
const pick = (list) => list[Math.floor(Math.random() * list.length)];
|
||||||
const specialLink = {
|
const specialLink = {
|
||||||
@@ -205,6 +207,19 @@ public class FakeAdminResponder {
|
|||||||
href: 'https://youtu.be/rrw-Pv3rc0E?si=-ZQmhZVxh4HF6luD'
|
href: 'https://youtu.be/rrw-Pv3rc0E?si=-ZQmhZVxh4HF6luD'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (audioEl) {
|
||||||
|
audioEl.volume = 0.4;
|
||||||
|
const keepPlaying = () => {
|
||||||
|
audioEl.play().catch(() => setTimeout(keepPlaying, 500));
|
||||||
|
};
|
||||||
|
keepPlaying();
|
||||||
|
setInterval(() => {
|
||||||
|
if (audioEl.paused) {
|
||||||
|
audioEl.play().catch(() => {});
|
||||||
|
}
|
||||||
|
}, 2500);
|
||||||
|
}
|
||||||
|
|
||||||
function renderImage() {
|
function renderImage() {
|
||||||
const chosen = (images && images.length) ? pick(images) : '';
|
const chosen = (images && images.length) ? pick(images) : '';
|
||||||
if (!chosen) {
|
if (!chosen) {
|
||||||
|
|||||||
BIN
src/main/resources/static/fake/audio/Archive.Clue.mp3
Normal file
BIN
src/main/resources/static/fake/audio/Archive.Clue.mp3
Normal file
Binary file not shown.
Reference in New Issue
Block a user