[Webkit-unassigned] [Bug 231105] New: AudioContext stops playing when minimizing or moving the macOS Safari window to the background.
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Fri Oct 1 15:02:34 PDT 2021
https://bugs.webkit.org/show_bug.cgi?id=231105
Bug ID: 231105
Summary: AudioContext stops playing when minimizing or moving
the macOS Safari window to the background.
Product: WebKit
Version: Safari 15
Hardware: Mac (Apple Silicon)
OS: macOS 11
Status: NEW
Severity: Normal
Priority: P2
Component: Web Audio
Assignee: webkit-unassigned at lists.webkit.org
Reporter: harsho at amazon.com
CC: cdumez at apple.com
AudioContext stops playing when minimizing or moving the macOS Safari window to the background.
Problem:
In the WebRTC-based web applications using the AudioContext API, audio stops playing when you minimize or move the macOS Safari window to the background.
Steps to Reproduce
1. Open any HTTPS website in Safari 14 or 15. In the following example, you will use the MediaDevices API to get your microphone's media stream.
2. Open the console in Web Inspector.
3. Run the following code to bind your first audio input to an audio element via two AudioNodes.
(async function () {
// Get your first audio input
const devices = await navigator.mediaDevices.enumerateDevices({ audio: true });
const deviceId = devices[0].deviceId;
const deviceStream = await navigator.mediaDevices.getUserMedia({
audio: { deviceId: { exact: deviceId } },
});
// Your audio input => MediaStreamAudioSourceNode => MediaStreamAudioDestinationNode
const audioContext = new (window.AudioContext || window.webkitAudioContext)();
const sourceNode = audioContext.createMediaStreamSource(deviceStream);
const destinationNode = audioContext.createMediaStreamDestination();
sourceNode.connect(destinationNode);
// MediaStreamAudioDestinationNode => HTMLAudioElement
const audio = document.createElement('audio');
document.body.appendChild(audio);
audio.srcObject = destinationNode.stream;
audio.play();
})();
4. Speak into your microphone and ensure that you can hear your voice from the system's speaker.
5. Minimize the Safari window (⌘ Cmd + M). Or you can activate full-screen mode (⌃ Ctrl + ⌘ Cmd + F) and switch to another window.
6. Speak into your microphone and test if you can hear your voice from the system’s speaker.
Actual Results:
The audio stops as soon as you minimize or move the Safari window to the background.
Expected Results:
The audio should not stop and play continuously.
Build:
* macOS Safari Version 15.0 (16612.1.29.41.4, 16612)
* macOS Safari Version 14.1.2 (16611.3.10.1.3)
Additional Information:
Behavior without AudioContext
The following script binds your first audio input with an audio element without using the AudioContext API. The audio continuously plays when you minimize the Safari window.
(async function () {
const devices = await navigator.mediaDevices.enumerateDevices({ audio: true });
const deviceId = devices[0].deviceId;
const audio = document.createElement('audio');
document.body.appendChild(audio);
audio.srcObject = await navigator.mediaDevices.getUserMedia({
audio: { deviceId: { exact: deviceId } },
});
audio.play();
})();
Behavior In Other Browsers:
When running the reproduction steps in Chrome and Firefox, audio continuously plays when you minimize or move the Safari window to the background.
*Chrome Version*: *94.0.4606.61*
*FireFox Version*: *91.1.Oser*
--
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/20211001/542cfa56/attachment.htm>
More information about the webkit-unassigned
mailing list