Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WebM and Opus in Safari

Using patent-free audio and video codecs on the web has always been problematic due to poor support in Safari. According to the Safari 15 release notes, though, this might be starting to change. WebM video is apparently now supported in MSE on iPadOS 15, and the Opus audio codec is supported in WebM containers.

According to Can I Use, though, (WebM, Opus) the situation didn't change with i(Pad)OS 15. On mobile devices, WebM is only supported for WebRTC, and Opus only works if you use a CAF container—which no other browser supports.

My experiments suggest that, unfortunately, Can I Use is correct. I was wondering, though, if anyone can clear up the mystery. Are the release notes just wrong, as seems to be the case? Am I misunderstanding the release notes somehow? Is there some trick that allows you to use these codecs after all?

like image 543
Pete Avatar asked Dec 08 '25 20:12

Pete


1 Answers

Safari support is inconsistent, but the recent release of 17.5 fixed some issues.

https://opus-bitrates.anthum.com/audio/music-96.webm (audio/webm; codecs=opus)

⚠️ when constructing <audio> from Blob

This failed prior to the release of Safari 17.5

(async () => {
  const url = 'https://opus-bitrates.anthum.com/audio/music-96.webm'
  const buffer = await (await fetch(url)).arrayBuffer()
  const blob = new Blob([buffer], { type: 'audio/webm; codecs=opus' })
  const audio = new Audio(URL.createObjectURL(blob))
  audio.controls = true
  document.body.appendChild(audio)
})()

✅ when using <audio> with <source>

<audio controls>
  <source type="audio/webm; codecs=opus"
          src="https://opus-bitrates.anthum.com/audio/music-96.webm" />
</audio>

✅ when constructing <audio> from URL

const url = 'https://opus-bitrates.anthum.com/audio/music-96.webm'
const audio = new Audio(url)
audio.controls = true
document.body.appendChild(audio)
like image 57
AnthumChris Avatar answered Dec 11 '25 09:12

AnthumChris



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!