Code Monkey home page Code Monkey logo

cordova-plugin-audioroute's Introduction

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-change

Example:

document.addEventListener('audioroute-changed',
                          function(event) {
                              console.log('Audio route changed: ' + event.reason);
                          });

License

MIT

Author

Saúl Ibarra Corretgé [email protected]

This work has been sponsored by AG Projects.

cordova-plugin-audioroute's People

Contributors

apparition47 avatar saghul avatar teasealancs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

cordova-plugin-audioroute's Issues

Can't use

I can't seem to get access the audioroute object

cordova.plugins.audioroute.overrideOutput('speaker') doesn't work.

cordova.plugins and window.cordova.plugins are undefined.

Can you please provide examples of use?

Can i have and example of how to override audio route in iOS 10

Hi i'm trying to route audio to front top speaker where i hear voice during a call.

I'm creating an app to call using webrtc and i need to hear sound in outgoing call from the front top speaker.

I tried:
cordova.plugins.audioroute.overrideOutput('speaker');
but doesn't work.

I'm using cordova-plugin-iosrtc i cant find a plugin for ios 10 that toggle audio from a speaker to another.

Not routing to speakers

Maybe I am doing something wrong or calling this at the wrong point in my code but it doesnt work. RTC sounds still come from the phones earpiece and not the speakers when I call

cordova.plugins.audioroute.overrideOutput("speaker", r => console.log(r), err => console.error(err));

I am calling this at the point where theres a rtc offer. Thanks.

Using iOS 5.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.