https://github.com/ArtskydJ/supported-audio
:notes: Returns the best supported audio type for your browser of the types you provide
https://github.com/ArtskydJ/supported-audio
Last synced: 11 months ago
JSON representation
:notes: Returns the best supported audio type for your browser of the types you provide
- Host: GitHub
- URL: https://github.com/ArtskydJ/supported-audio
- Owner: ArtskydJ
- Created: 2015-09-10T13:11:30.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-09-30T04:19:14.000Z (over 10 years ago)
- Last Synced: 2025-05-07T13:04:04.262Z (11 months ago)
- Language: JavaScript
- Homepage:
- Size: 133 KB
- Stars: 3
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
supported-audio
=========
> Returns the best supported audio type for your browser of the types you provide.
[](https://travis-ci.org/ArtskydJ/supported-audio)
Meant to be used in the browser with [browserify](https://github.com/substack/node-browserify).
# example
```js
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
```js
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](http://nodejs.org/download) do:
npm install supported-audio
# license
[VOL](http://veryopenlicense.com)