Giter Site home page Giter Site logo

techmanha / cordova-plugin-dbmeter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from akofman/cordova-plugin-dbmeter

0.0 1.0 0.0 577 KB

:microphone::mega: Cordova plugin to get decibels from the microphone

License: Apache License 2.0

JavaScript 28.22% Java 52.32% Swift 19.46%

cordova-plugin-dbmeter's Introduction

Twitter: @alexiskofman License Build Status

cordova-plugin-dbmeter

This plugin defines a global DBMeter object, which permits to get the decibel values from the microphone. Although the object is in the global scope, it is not available until after the deviceready event.

document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
    DBMeter.start(function(dB){
        console.log(dB);
    });
}

Installation

cordova plugin add cordova-plugin-dbmeter

The iOS part is written in Swift so the Swift support plugin is configured as a dependency in plugin.xml.

⚠️ Because this plugin doesn't support Swift 3 at the moment, the following preference has to be added in your project :

<preference name="UseLegacySwiftLanguageVersion" value="true" />

Supported Platforms

  • iOS
  • Android

Methods

DBMeter.start(success, error)

start listening.

DBMeter.start(function(dB){
  console.log(dB);
}, function(e){
  console.log('code: ' + e.code + ', message: ' + e.message);
});

DBMeter.stop(success, error)

stop listening.

DBMeter.stop(function(){
  console.log("DBMeter well stopped");
}, function(e){
  console.log('code: ' + e.code + ', message: ' + e.message);  
});

⚠️ If the DBMeter is stopped while is not listening, an error will be triggered and can be handle from the second callback argument.

DBMeter.isListening(success, error)

retrieve from the success callback whether the DBMeter is listening.

DBMeter.isListening(function(isListening){
  console.log(isListening);
});

DBMeter.delete(success, error)

delete the DBMeter instance.

DBMeter.delete(function(){
  console.log("Well done !");
}, function(e){
  console.log('code: ' + e.code + ', message: ' + e.message);  
});

⚠️ If the DBMeter has not been started once before deleting, an error will be triggered and can be handle from the second callback argument.

App

An app is available in the app folder and is generated from the Cordova Plugin Test Framework. It permits to launch auto tests and manual tests.

To install it, please follow these steps :

cd app && cordova platform add android|ios
cordova run android|ios --device

cordova-plugin-dbmeter's People

Contributors

akofman avatar techmanha avatar

Watchers

 avatar

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.