Bug 175412
| Summary: | WebAudio does not output sound on iOS without user gesture | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Andrew Morris <andrew> |
| Component: | Web Audio | Assignee: | Nobody <webkit-unassigned> |
| Status: | RESOLVED WONTFIX | ||
| Severity: | Normal | CC: | ap, eric.carlson, jer.noble, jonlee, msander, webkit-bug-importer, youennf |
| Priority: | P2 | Keywords: | InRadar |
| Version: | Other | ||
| Hardware: | iPhone / iPad | ||
| OS: | iOS 11 | ||
Andrew Morris
No sound resulting from this code, also no error is thrown:
https://output.jsbin.com/mogudag
'use strict';
const handleError = (e) => {
const pre = document.createElement('pre');
pre.style.color = 'red';
pre.textContent = `Error: ${e}\n.message: ${e.message}\n.stack: ${e.stack}`;
document.body.appendChild(pre);
};
window.addEventListener('error', ({ error }) => handleError(error));
window.addEventListener('unhandledrejection', ({ reason }) => handleError(reason));
(async () => {
try {
await new Promise(resolve => window.addEventListener('load', resolve));
const ctx = new (window.webkitAudioContext || window.AudioContext)();
const oscNode = ctx.createOscillator();
oscNode.connect(ctx.destination);
oscNode.start();
} catch (e) {
handleError(e);
}
})();
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Andrew Morris
Tested on iPhone with iOS beta 4 and iPad with iOS beta 5.
Radar WebKit Bug Importer
<rdar://problem/33818985>
Alexey Proskuryakov
Does this start to work for you if triggered from a user interaction (tap?).
youenn fablet
For instance, https://output.jsbin.com/yuhobukuji
Andrew Morris
Ah it does work with user interaction. Didn't think that kind of restriction applied for web audio. Thanks.