[Webkit-unassigned] [Bug 190410] New: user gesture after few seconds leads to audio context resuming but no sound
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Tue Oct 9 13:42:37 PDT 2018
https://bugs.webkit.org/show_bug.cgi?id=190410
Bug ID: 190410
Summary: user gesture after few seconds leads to audio context
resuming but no sound
Product: WebKit
Version: WebKit Nightly Build
Hardware: Unspecified
OS: Unspecified
Status: NEW
Severity: Normal
Priority: P2
Component: Web Audio
Assignee: webkit-unassigned at lists.webkit.org
Reporter: shortsands.ceo at gmail.com
On Safari 12, I am trying everything I can to get audio to have sound. It was working on Safari 11, but not on Safari 12.
In the app, calling resume() on the audioContext after a user interaction gets the audio context out of suspended and into running in all cases. So I am assuming that it is "allowed to start" per Web Audio API.
However, if user interaction is within ~5 seconds of loading the page, sound comes out. If after 5 seconds, no sound.
Thanks.
function fixAudioContext() {
console.log("1: " + audioContext.state);
return audioContext.resume().then(function() {
console.log("2: " + audioContext.state);
var buffer = audioContext.createBuffer(1, 1, 22050);
var source = audioContext.createBufferSource();
source.buffer = buffer;
// Connect to output (speakers)
source.connect(audioContext.destination);
// Play sound
if (source.start) {
source.start(0);
} else if (source.play) {
source.play(0);
} else if (source.noteOn) {
source.noteOn(0);
}
console.log("3: " + audioContext.state);
audioContextDeferred.resolve(audioContext.state);
})
.catch(function() {
});
}
After 5 seconds console still prints, "1: suspended, 2: running, 3: running" but no sound. The creating buffer stuff is an attempt to play a silent sound to warm up the context. Honestly just a shot in the dark.
--
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/20181009/cfaede70/attachment.html>
More information about the webkit-unassigned
mailing list