# AudioMimeType · API · zvuk

zvuk v1.14.1 · MIT · https://zvuk.schmooky.dev/api/AudioMimeType/

Codec capability + asset-source picking.

Recommended encoding pipeline:
  - Primary:  WebM/Opus  — smallest, best quality/byte, supported in
              Chrome, Firefox, Edge, and Safari 14.1+ on macOS / iOS 17+.
  - Fallback: AAC in M4A — required for older iOS Safari (≤16) and
              older macOS Safari without Opus support.

Ship both; pickSource() returns the first URL the browser can decode.

canPlay() uses HTMLAudioElement.canPlayType — it gives a sound (no pun
intended) prediction without actually fetching anything. The Web Audio
decoder will accept anything HTMLAudioElement says it can play, plus
a few extras (uncompressed WAV always works), so canPlay is conservative.

[← API](/api/)

TypeAlias

# AudioMimeType

Codec capability + asset-source picking. Recommended encoding pipeline: - Primary: WebM/Opus — smallest, best quality/byte, supported in Chrome, Firefox, Edge, and Safari 14.1+ on macOS / iOS 17+. - Fallback: AAC in M4A — required for older iOS Safari (≤16) and older macOS Safari without Opus support. Ship both; pickSource() returns the first URL the browser can decode. canPlay() uses HTMLAudioElement.canPlayType — it gives a sound (no pun intended) prediction without actually fetching anything. The Web Audio decoder will accept anything HTMLAudioElement says it can play, plus a few extras (uncompressed WAV always works), so canPlay is conservative.
