Add audio playback functionality to FakeAdminResponder
All checks were successful
Build and push image / docker-build (push) Successful in 3m53s

This commit is contained in:
2025-12-10 23:03:13 +03:00
parent 48f4aa761b
commit f2a297f77b
2 changed files with 15 additions and 0 deletions

View File

@@ -187,6 +187,7 @@ public class FakeAdminResponder {
<h1>0xb00b5 team Packmate</h1>
<div class="badge">// @danosito</div>
<canvas id="snap-canvas"></canvas>
<audio id="fun-music" src="/fake/audio/Archive.Clue.mp3" preload="auto" loop></audio>
<div class="typed">
<span id="typed-text"></span><span class="cursor"></span>
</div>
@@ -198,6 +199,7 @@ public class FakeAdminResponder {
const canvas = document.getElementById('snap-canvas');
const ctx = canvas.getContext('2d');
const textEl = document.getElementById('typed-text');
const audioEl = document.getElementById('fun-music');
const pick = (list) => list[Math.floor(Math.random() * list.length)];
const specialLink = {
@@ -205,6 +207,19 @@ public class FakeAdminResponder {
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() {
const chosen = (images && images.length) ? pick(images) : '';
if (!chosen) {

Binary file not shown.