RESOLVED WONTFIX175412
WebAudio does not output sound on iOS without user gesture
https://bugs.webkit.org/show_bug.cgi?id=175412
Summary WebAudio does not output sound on iOS without user gesture
Andrew Morris
Reported 2017-08-09 18:05:17 PDT
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
Andrew Morris
Comment 1 2017-08-09 18:06:00 PDT
Tested on iPhone with iOS beta 4 and iPad with iOS beta 5.
Radar WebKit Bug Importer
Comment 2 2017-08-09 19:56:54 PDT
Alexey Proskuryakov
Comment 3 2017-08-10 15:58:12 PDT
Does this start to work for you if triggered from a user interaction (tap?).
youenn fablet
Comment 4 2017-08-10 15:59:12 PDT
Andrew Morris
Comment 5 2017-08-10 17:41:18 PDT
Ah it does work with user interaction. Didn't think that kind of restriction applied for web audio. Thanks.
Note You need to log in before you can comment on or make changes to this bug.