[Webkit-unassigned] [Bug 198015] Cannot play audio created from blob

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue May 28 09:09:10 PDT 2019


https://bugs.webkit.org/show_bug.cgi?id=198015

--- Comment #7 from Jer Noble <jer.noble at apple.com> ---
(In reply to jordan.michael.last from comment #6)
> The example I created above indeed works on all of the iOS devices I have
> tested. Ideally I wouldn't need to use a <source> element to specify the
> mime type, and indeed it is possible to create a blob and pass the mime type
> in. For example, if you store an mp3 file as an arraybuffer, and want to
> create an object URL from it:
> 
> // arrayBuffer is a variable that has already been defined, which holds mp3
> audio
> 
> const blob = new Blob([arrayBuffer], { type: 'audio/mpeg' });
> 
> const objectURL = window.URL.createObjectURL(blob);
> 
> You can then set the src of an audio element to objectURL. This works on the
> two iOS devices that I have tested. I believe it is a solution to the
> StackOverflow questions.

Aha, I learned something today! I wasn't aware that the Blob constructor took a MIME type.

-- 
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/20190528/b83a19b0/attachment.html>


More information about the webkit-unassigned mailing list