When playing audio via an HTMLAudioElement instance and the src is a Blob URL, playback halts before the end of the track and the "ended" event is never fired on the audio element. Steps to Reproduce: Please see the jsfiddle link for a demo: https://jsfiddle.net/1yv7b82n/5/ 1. Fetch an mp3 or other audio file and read the response body as a Blob 2. Get an object URL from the blob then set that URL as the src of an audio element 3. Call play() on the audio element Expected: The audio plays all the way through, and the onended event is fired after playback completes. Actual: Playback never completes and onended is never fired. In the example provided in the jsfiddle above, I observed playback ceasing several seconds before the actual end of the audio. I also notice my phone heating up after audio ends so maybe there is runaway CPU/memory usage somewhere. Build Date & Hardware: Safari on iOS 15.4 stable. Does not occur on Safari 15.4 (17613.1.17.1.6) on MacOS.
<rdar://problem/90614038>
Created attachment 455608 [details] Network tab while blob is playing This shows the packets on the Safari network tab with a smaller mp3 than the one submitted in the fiddle with the original bug - the last chunk repeats endlessly.
To clarify the attachment - this bug happens any time a Blob exceeds 65536 bytes. Examining the network tab while the file is playing, it looks like the last chunk in the file never causes the ended event to fire, and it fetches endlessly with 206 returns. If you take the fiddle that was provided in the original post and use a smaller mp3, it's easier to see.
Thanks for this report. From the attachment, this looks like a dup of bug# 238170, recently fixed. Please CC yourself to that bug to follow along. *** This bug has been marked as a duplicate of bug 238170 ***