[Webkit-unassigned] [Bug 281566] AudioContext.resume() never resolves if browser is suspended to background
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Tue Nov 12 18:27:08 PST 2024
https://bugs.webkit.org/show_bug.cgi?id=281566
--- Comment #5 from self at destruct.dev ---
very scuffed workaround if anyone needs it,
but yeah, this is borked.
```js
audioContext = new AudioContext();
const abortController = new AbortController();
function addListeners(){
document.addEventListener("pointerdown", resume, {signal: destructor.signal});
document.addEventListener("keydown", resume, {signal: destructor.signal});
};
addListeners();
function resume(){
if(audioContext.state !== "running"){
abortController.abort();
audioContext.suspend(); /* Needs to be called before resume */
setTimeout(() => {audioContext.resume()}, 200);
};
};
document.addEventListener('visibilitychange', () => {
if(document.hidden){
abortController.abort();
audioContext.suspend();
}
else{resume()};
});
--
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/20241113/3d46c414/attachment.htm>
More information about the webkit-unassigned
mailing list