Ads

Wednesday, September 11, 2013

Audio Recorder Module

Audio Recorder module helps to record audio without using intent in Android. Using this module we can record audio in different format like(mp4,3gp) without help of intent. This module uses MediaRecorder class to record audio.

Titanium Audio Recorder Module

Features and Benefits
  • File format
    Module support for both mp4 and 3gp formats.
  • Audio Encoders
    Module support for following audio encoder types AAC, AMR_NB, AMR_WB, DEFAULT
  • External Storage
    It saves output file in external storage inside the specified directory
  • maxDuration
    Option to stop the recording session after the specified duration
  • maxFileSize
    Option to stop the recording session after the specified file size

Usage:
var audioRecorder = require("titutorial.audiorecorder");

audioRecorder.startRecording({
    outputFormat : audioRecorder.OutputFormat_THREE_GPP,
    audioEncoder : audioRecorder.AudioEncoder_AMR_NB,
    directoryName : "testdir",
    fileName : "testfile",
    maxFileSize : 7000,
    success : function(e) {
        alert("success => " + e.filePath);
        Ti.API.info("response is => " + JSON.stringify(e));
        var audioDir = Titanium.Filesystem.getFile(Titanium.Filesystem.externalStorageDirectory, "testdir");
        var audioFile = Ti.Filesystem.getFile(audioDir.resolve(), e.fileName);
        Ti.API.info("audioFile.nativePath = " + audioFile.nativePath);
    },
    error : function(d) {
        alert("error => " + e.message);
        Ti.API.info("error is => " + JSON.stringify(d));
    }
});

Download:
Module: https://marketplace.appcelerator.com/apps/6516?1532012201
Source Code: https://github.com/railskarthi/AudioRecorder

1 comment:

  1. Rainer SchleevoigtApril 18, 2014 at 4:29 PM

    Awesome work! I downloaded the version from marketplace and this version doesn't support 'getMaxAmplitude()'. I tried to compile the version from github by 'ant'. But this was unsuccessful (I modified paths in configuration). Any ideas?

    ReplyDelete