You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With Safari (Version 15.2 build 17612.3.6.1.6), this example using createMediaElementSource() doesn't output any audio. It works fine in Chrome (96.0.4664.110) and Firefox (95.0.2).
The text was updated successfully, but these errors were encountered:
I just ran into the same problem. Luckily, a remark on a older WebKit issue related to createMediaElementSource() (https://bugs.webkit.org/show_bug.cgi?id=211394#c37) gave the solution: the new AudioContext() should be created after e.g. a click event since the play event apparently doesn't count as user input.
Then move the entirety of the existing play event handler into a click event handler of the button. Not super intuitive, but it does make the example work on Safari now:
constbutton=document.querySelector('button');button.addEventListener('click',event=>{audioCtx=newAudioContext();// Create a MediaElementAudioSourceNode// Feed the HTMLMediaElement into itletsource=audioCtx.createMediaElementSource(myAudio);// Create a gain nodeletgainNode=audioCtx.createGain();
...
Live example: https://mdn.github.io/webaudio-examples/media-source-buffer/
I found this example from the docs here: https://developer.mozilla.org/en-US/docs/Web/API/AudioContext/createMediaElementSource
With Safari (Version 15.2 build 17612.3.6.1.6), this example using
createMediaElementSource()
doesn't output any audio. It works fine in Chrome (96.0.4664.110) and Firefox (95.0.2).The text was updated successfully, but these errors were encountered: