Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/saghul/cordova-plugin-audioroute
iOS audio route change events and more for Cordova
https://github.com/saghul/cordova-plugin-audioroute
audio cordova ios
Last synced: 3 months ago
JSON representation
iOS audio route change events and more for Cordova
- Host: GitHub
- URL: https://github.com/saghul/cordova-plugin-audioroute
- Owner: saghul
- Created: 2016-06-07T11:23:41.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2020-07-20T09:46:37.000Z (over 4 years ago)
- Last Synced: 2024-04-26T14:22:13.689Z (9 months ago)
- Topics: audio, cordova, ios
- Language: Objective-C
- Size: 9.77 KB
- Stars: 17
- Watchers: 6
- Forks: 18
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# cordova-plugin-audioroute
**This plugin works on iOS only.**
This plugin allows applications to get notified audio about route changes (for example when a headset is connected),
and also to query and override the audio device in use.## Installation
The plugin can be installed using the Cordova CLI tool:
cordova plugin add cordova-plugin-audioroute --save
## API
All these functions are available in the `cordova.plugins.audioroute` namespace.
### currentOutputs(successCallback, errorCallback)
Get an Array of the currently connected audio ports. The possible elements are:
* line-out
* headphones
* bluetooth-a2dp
* builtin-receiver
* builtin-speaker
* hdmi
* airplay
* bluetooth-le
* unknown## overrideOutput(output, successCallback, errorCallback)
Overrides the audio output device. `output` must be one of `default` or `speaker`.
## "audioroute-changed" event
When the audio route has changed a 'audioroute-changed' event will be fired in `document`.
It contains the reason as associated data, which can be one of:* unknown
* new-device-available
* old-device-unavailable
* category-change
* override
* wake-from-sleep
* no-suitable-route-for-category
* route-config-changeExample:
document.addEventListener('audioroute-changed',
function(event) {
console.log('Audio route changed: ' + event.reason);
});## License
MIT
## Author
Saúl Ibarra Corretgé
This work has been sponsored by [AG Projects](http://ag-projects.com).