NEW 255134
AudioContext stops playing when displaying a dialog (window.alert() or window.confirm())
https://bugs.webkit.org/show_bug.cgi?id=255134
Summary AudioContext stops playing when displaying a dialog (window.alert() or window...
Kyu Simm
Reported 2023-04-06 19:16:24 PDT
Problem: - AudioContext stops playing when displaying a dialog (`window.alert()` or `window.confirm()`) Steps to Reproduce: 1. Open any website in macOS or iOS Safari. (For iOS Safari steps, unmute your device.) 2. Run the following script in Safari's console. The script adds a button to play a tone and show a dialog. ``` (() => { const button = document.createElement('button'); button.innerText = 'Play audio'; button.style = 'position: fixed; top:0; left:0; z-index:9999'; document.body.appendChild(button); let isPlaying = false; button.addEventListener('click', async () => { if (isPlaying) { window.alert('Alert!'); } else { isPlaying = true; button.innerText = 'Call window.alert'; const audioContext = new (window.AudioContext || window.webkitAudioContext)(); const oscillator = audioContext.createOscillator(); oscillator.type = 'square'; oscillator.frequency.setValueAtTime(440, audioContext.currentTime); // value in hertz oscillator.connect(audioContext.destination); oscillator.start(); } }); })(); ``` 3. Click the "Play audio" button at the top-left corner of the website. You should hear a tone from Safari. 4. Click the "Call window.alert" button. Actual Results: - The tone cannot be heard as the dialog appears. Expected Results: - The tone should continue playing after the dialog appears or when the dialog is dismissed. Test Environments: - macOS Safari 16.4 - iOS Safari 16.3 Additional Information: - In macOS Chrome 111, the audio continues to play without any pauses. - In macOS Firefox 111, the audio stops while the dialog is visible, but resumes playing after the dialog is closed.
Attachments
Radar WebKit Bug Importer
Comment 1 2023-04-13 02:24:13 PDT
Note You need to log in before you can comment on or make changes to this bug.