There is a plugin that measures volume data in decibels: https://github.com/akofman/cordova-plugin-dbmeter
Install the plugin with:
cordova plugin add cordova-plugin-dbmeter
Make sure you add these lines to your config.xml application, as this plugin does not currently support Swift 3.
<preference name="UseLegacySwiftLanguageVersion" value="true" />
Use the plugin as follows:
document.addEventListener("deviceready", onDeviceReady, false); function onDeviceReady() { DBMeter.start(function(dB){ console.log(dB); }); }
source share