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() } }