Bug 175412

Summary: WebAudio does not output sound on iOS without user gesture
Product: WebKit Reporter: Andrew Morris <andrew>
Component: Web AudioAssignee: 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
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.