supported-audio
v1.0.2
Published
Returns the best supported audio type for your browser of the types you provide
Downloads
9
Maintainers
Readme
supported-audio
Returns the best supported audio type for your browser of the types you provide.
Meant to be used in the browser with browserify.
example
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
api
var bestSupported = require('supported-audio')
var type = bestSupported(types)
types
is an array of types to check.- Returns a string or null.
install
With npm do:
npm install supported-audio