[Webkit-unassigned] [Bug 255134] New: AudioContext stops playing when displaying a dialog (window.alert() or window.confirm())
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Thu Apr 6 19:16:24 PDT 2023
https://bugs.webkit.org/show_bug.cgi?id=255134
Bug ID: 255134
Summary: AudioContext stops playing when displaying a dialog
(window.alert() or window.confirm())
Product: WebKit
Version: Safari 16
Hardware: All
OS: All
Status: NEW
Severity: Normal
Priority: P2
Component: Web Audio
Assignee: webkit-unassigned at lists.webkit.org
Reporter: simmkyu at amazon.com
CC: cdumez at apple.com
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.
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20230407/4c059bcf/attachment-0001.htm>
More information about the webkit-unassigned
mailing list