Refactor audio playback logic in FakeAdminResponder to ensure that audio plays on start
All checks were successful
Build and push image / docker-build (push) Successful in 4m55s
All checks were successful
Build and push image / docker-build (push) Successful in 4m55s
This commit is contained in:
@@ -208,11 +208,15 @@ public class FakeAdminResponder {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (audioEl) {
|
if (audioEl) {
|
||||||
|
const ensurePlaying = () => {
|
||||||
|
if (!audioEl.dataset.started) {
|
||||||
|
audioEl.dataset.started = '1';
|
||||||
audioEl.volume = 0.4;
|
audioEl.volume = 0.4;
|
||||||
const keepPlaying = () => {
|
}
|
||||||
audioEl.play().catch(() => setTimeout(keepPlaying, 500));
|
audioEl.play().catch(() => {});
|
||||||
};
|
};
|
||||||
keepPlaying();
|
|
||||||
|
ensurePlaying();
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
if (audioEl.paused) {
|
if (audioEl.paused) {
|
||||||
audioEl.play().catch(() => {});
|
audioEl.play().catch(() => {});
|
||||||
|
|||||||
Reference in New Issue
Block a user