Bug 247614 - Only require a "transient" user activation for Web Audio rendering
Summary: Only require a "transient" user activation for Web Audio rendering
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Audio (show other bugs)
Version: Safari 16
Hardware: Mac (Apple Silicon) macOS 13
: P2 Major
Assignee: Chris Dumez
URL:
Keywords: BrowserCompat, InRadar
Depends on:
Blocks:
 
Reported: 2022-11-08 06:09 PST by David Spura
Modified: 2022-11-17 15:28 PST (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Spura 2022-11-08 06:09:44 PST
After registering processor to AudioWorklet, its process method does not get called.

Please try here: https://1006044.playcode.io/

Source of the sample: https://playcode.io/1006044

Mentioned sample works in firefox, chrome and edge.
Comment 1 Radar WebKit Bug Importer 2022-11-15 06:10:16 PST
<rdar://problem/102364692>
Comment 2 Chris Dumez 2022-11-15 13:26:43 PST
Safari has stricter use gesture requirements than other browsers. We don't allow starting rendering without a user gesture. I see the demo asks the user to click a button to start rendering but my bet is that it actually starts the rendering asynchronously after getting the click.
Comment 3 Chris Dumez 2022-11-15 13:29:29 PST
Yes, I mean the click handler calls an async function which does a:
```
await e.audioWorklet.addModule(n),
```

Before it connects the node to the graph. By that time, the user gesture is lost in Safari. I wish we could relax the user gesture requirement a bit (e.g. only require a "recent" gesture) but I usually get push back from our media team when I suggest that.
Comment 4 Chris Dumez 2022-11-15 14:16:08 PST
Pull request: https://github.com/WebKit/WebKit/pull/6529
Comment 5 EWS 2022-11-15 22:29:15 PST
Committed 256721@main (7cc4b4216132): <https://commits.webkit.org/256721@main>

Reviewed commits have been landed. Closing PR #6529 and removing active labels.