From 5ae530389285b7b98b2de60fb3f5c94f3e017918 Mon Sep 17 00:00:00 2001 From: David Wheatley Date: Sat, 8 Jun 2024 20:38:06 +0100 Subject: [PATCH] wip --- src/announcement-data/AnnouncementSystem.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/announcement-data/AnnouncementSystem.ts b/src/announcement-data/AnnouncementSystem.ts index 0d13d9b54..8382fbebc 100644 --- a/src/announcement-data/AnnouncementSystem.ts +++ b/src/announcement-data/AnnouncementSystem.ts @@ -212,12 +212,12 @@ export default abstract class AnnouncementSystem { if (crunker._context.state === 'suspended') { console.error('[Crunker] Failed to resume audio context') - alert( - "Your device or web browser is refusing to let the website play audio.\n\nThis is especially common on iPhones and iPads. We'd recommend you try using a desktop computer or an alterantive device.\n\nTry scrolling to the bottom of the page and pressing the 'Resume audio' button. If this doesn't help, there's nothing else that we can do. Sorry!", - ) + + document.getElementById('resume-audio-button')?.remove() const button = document.createElement('button') button.textContent = 'Resume audio' + button.id = 'resume-audio-button' button.style.margin = '16px' button.onclick = () => { crunker._context.resume() @@ -225,6 +225,10 @@ export default abstract class AnnouncementSystem { } document.body.appendChild(button) + alert( + "Your device or web browser is refusing to let the website play audio.\n\nThis is especially common on iPhones and iPads. We'd recommend you try using a desktop computer or an alterantive device.\n\nTry scrolling to the bottom of the page and pressing the 'Resume audio' button. If this doesn't help, there's nothing else that we can do. Sorry!", + ) + button.scrollIntoView() } }