Coder Social home page Coder Social logo

cordova-plugin-audio-category's Introduction

Cordova Plugin Audio Category

A Cordova plugin for iOS to expose AVAudioSession setCategory:error:

Getting Started

Once you have set up your Cordova project, run:

cordova plugin add --save https://github.com/msbit/cordova-plugin-audio-category.git

and then, in your code:

window.MSBAudioCategory.setCategory('soloAmbient');

Available Categories

The category value specified can be as follows:

  • ambient corresponding to AVAudioSessionCategoryAmbient
  • multiRoute corresponding to AVAudioSessionCategoryMultiRoute
  • playAndRecord corresponding to AVAudioSessionCategoryPlayAndRecord
  • playback corresponding to AVAudioSessionCategoryPlayback
  • record corresponding to AVAudioSessionCategoryRecord
  • soloAmbient corresponding to AVAudioSessionCategorySoloAmbient

Details of the individual AVAudioSessionCategory behaviours can be found in the Apple developer documentation.

Available Methods

Methods available in the plugin are:

  • getCategory()
  • setCategory(name)

Example Usage

Fetching the Current Category

window.MSBAudioCategory.getCategory().then((category) => {
  console.log(`Current AVAudioSessionCategory is ${category}`);
});

Updating the Category

window.MSBAudioCategory.setCategory('playback').then((result) => {
  console.log(`AVAudioSessionCategory has been updated: ${result}`);
}).catch((error) => {
  console.log(`AVAudioSessionCategory could not be updated: ${error}`);
});

Todo

cordova-plugin-audio-category's People

Contributors

msbit avatar

Watchers

 avatar  avatar

cordova-plugin-audio-category's Issues

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.