Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cordova-plugin-audio-recorder-api-curltech

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cordova-plugin-audio-recorder-api-curltech

This plugin is a Cordova audio recorder plugin which works as API.

  • 0.0.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

Cordova Audio Recorder API Plugin

Join the chat at https://gitter.im/emj365/cordova-plugin-audio-recorder-api

Introduction:

This plugin is a Cordova audio recorder plugin that works as API.

Different than http://plugins.cordova.io/#/package/org.apache.cordova.media-capture this plugin does not request the native recorder app (system default recorder) and active recording manually.

Supports platforms:

  • iOS
  • Android

Install:

$ cordova plugin add cordova-plugin-audio-recorder-api

How to use:

var recorder = new Object;
recorder.stop = function() {
  window.plugins.audioRecorderAPI.stop(function(msg) {
    // success
    alert('ok: ' + msg);
  }, function(msg) {
    // failed
    alert('ko: ' + msg);
  });
}
recorder.record = function() {
  window.plugins.audioRecorderAPI.record(function(msg) {
    // complete
    alert('ok: ' + msg);
  }, function(msg) {
    // failed
    alert('ko: ' + msg);
  }, 30); // record 30 seconds
}
recorder.playback = function() {
  window.plugins.audioRecorderAPI.playback(function(msg) {
    // complete
    alert('ok: ' + msg);
  }, function(msg) {
    // failed
    alert('ko: ' + msg);
  });
}

Where are files save?

iOS: /var/mobile/Applications/<UUID>/Library/NoCloud/<file-id>.m4a Android: /data/data/<app-id>/files/<file-id>.m4a

Copy File to Another Place

Example with file plugin: http://ngcordova.com/docs/plugins/file/

iOS: /var/mobile/Applications/<UUID>/Documents/new_file.m4a Android: <sdcard>/new_file.m4a

window.plugins.audioRecorderAPI.record(function(savedFilePath) {
  var fileName = savedFilePath.split('/')[savedFilePath.split('/').length - 1];
  var directory;
  if (cordova.file.documentsDirectory) {
    directory = cordova.file.documentsDirectory; // for iOS
  } else {
    directory = cordova.file.externalRootDirectory; // for Android
  }
  $cordovaFile.copyFile(
    cordova.file.dataDirectory, fileName,
    directory, "new_file.m4a"
  )
    .then(function (success) {
      alert(JSON.stringify(success));
    }, function (error) {
      alert(JSON.stringify(error));
    });
}, function(msg) {
  alert('ko: ' + msg);
}, 3);

Keywords

FAQs

Package last updated on 20 Mar 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc