AVPlayer does not support WebM. However, WebKit has implemented its own demuxer for WebM playback and also supports a private entitlement for VP9 decoding.
To play WebM files in a native iOS app, you have a few options:
1. Remux the WebM container to MP4. If you’re using the Opus codec, AVPlayer can handle it in an MP4 container. However, I’m not sure exactly which iOS version introduced support. For example, it doesn’t work on iOS 15, but it does on iOS 17. On older iOS versions, AVPlayer is unable to construct the Opus codec info from the container, even though decoding itself is supported.
2. Write a WebM demuxer (or use FFmpeg), extract the samples, decode them, and play them back using AVAudioEngine or AudioQueue. For decoding, you can use FFmpeg, AVAudioConverter, or AudioConverter.
Topic:
Media Technologies
SubTopic:
Audio
Tags: