Returns the best supported audio type for your browser of the types you provide.
Meant to be used in the browser with browserify.
var bestSupported = require('supported-audio')
bestSupported([ 'ogg', 'wav', 'mp3' ]) // => 'mp3'
bestSupported([ '.ogg', '.wav', '.mp3' ]) // => 'mp3'
bestSupported([ 'file.ogg', 'file.wav', 'file.txt.mp3' ]) // => 'mp3'
bestSupported([ 'audio/ogg', 'audio/wav', 'audio/mp3' ]) // => 'mp3'
bestSupported([ 'lol', 'rofl', 'ttyl' ]) // => null
var bestSupported = require('supported-audio')
types
is an array of types to check.- Returns a string or null.
With npm do:
npm install supported-audio