Skip to content

This is a cordova plugin for audio recording. And the record will be compressed into MP3 format by LAME.

License

Notifications You must be signed in to change notification settings

mljsgto222/Cordova_Plugin_AudioRecorder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cordova_Plugin_AudioRecorder

This is a cordova plugin for audio recording. And the record will be compressed into MP3 format by LAME.

Supported Platforms

  • iOS >= 6.0
  • Android >= 4.0

Usage

Constants

  • AudioRecorder.MAX = 1
  • AudioRecorder.NORMAL = 2
  • AudioRecorder.LOW = 3

NOTE: The transformation of mp3 files by LAME may fail when using other samplingrates.

Has Permission

AudioRecorder.hasPermission(success, error);
  • success: hasPermission success callback.

    • hasPermission: has audio recorder permission. (boolean)
  • error:hasPermission error callback

Request Permission

AudioRecorder.requestPermission(success, error);

Start Record

AudioRecorder.startRecord(options, success, error); // auto request permission
  • options: recorder settings

    • outSamplingRate: Set sampling rate for output mp3. default: 22050(number)
    • outBitRate: Set bit rate for output mp3. default: 16(number)
    • isChatMode: If true then set AVAudioSessionModeVoiceChat in iOS and use NoiseSuppressor in Android. default: false(boolean)
    • isSave: If true then save mp3 file into device storage. default: false(boolean)
    • duration: Set the duration of recorder file in seconds. default: 0(number)
  • success: startRecord success callback.

    • file: output mp3 file object(This is a temporary file on device)
      • name: mp3 file's name.(string)
      • type: 'audio/mpeg'(string)
      • uri: file local uri(string)
  • error: startRecord error callback.

    • errorMessage: a string about error(string)

Stop Record

AudioRecorder.stopRecord(success)
  • success: stopRecord success callback.

Play Sound

AudioRecorder.playSound(path, success, error)
  • path: path for play local and remote file-base media.

  • success: play sound success callback.(keep callback)

    • status: play status(start、finish、stop). (string)
  • error: startRecord error callback.

    • errorMessage: a string about error(string)

Stop Sound

AudioRecorder.playSound(success)
  • success: stop sound success callback.(keep callback)

TODO LIST

  • Set duration for audio recording.
  • Save record in device storage.
  • Play audio on device or Internet.

Reference

AndroidMp3Recorder

cordova-plugin-media

About

This is a cordova plugin for audio recording. And the record will be compressed into MP3 format by LAME.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published