The following code is triggered by a user clicking on a button. It works in Chrome and Firefox. It does NOT work in Safari (11.1).
const blob = new Blob([binary], {type: 'audio/ogg'});
const audio = new Audio();
audio.src = URL.createObjectURL(blob);
audio.load();
audio.play();
The following code works in all 3 browsers:
const audio = new Audio();
audio.src = 'test.mp3';
audio.load();
audio.play();
So, the issue is with URL.createObjectURL(blob) in Safari. The Safari console.log error thrown by audio.play() is:
Unhandled Promise Rejection: NotSupportedError: The operation is not supported.
If audio.play() is commented out, no error is thrown.
Thanks