Tom Krones created CB-7717:
------------------------------

             Summary: Cordova Media Plugin Record as mp4
                 Key: CB-7717
                 URL: https://issues.apache.org/jira/browse/CB-7717
             Project: Apache Cordova
          Issue Type: New Feature
            Reporter: Tom Krones


It would be nice to be able to record audio in other formats like mp4.  Here's 
code that allows you to change the recording type.  It would be great if the 
option could be added to the record call.

here's the code

Step 1: add this to the startRecordingAudio method on SDVSound.m before 
audioFile.recorder =

    NSDictionary *recordSettings = [NSDictionary dictionaryWithObjectsAndKeys:
                                    [NSNumber numberWithInt: 
kAudioFormatMPEG4AAC], AVFormatIDKey,
                                    [NSNumber numberWithFloat:16000.0], 
AVSampleRateKey,
                                    [NSNumber numberWithInt: 1], 
AVNumberOfChannelsKey,
                                    nil];
Then I replaced:

audioFile.recorder = [[CDVAudioRecorder alloc] 
initWithURL:audioFile.resourceURL settings:nil error:&error]; // Default PCM 
recording
With:

audioFile.recorder = [[CDVAudioRecorder alloc] 
initWithURL:audioFile.resourceURL settings:recordSettings error:&error];
This records directly in M4A, mono in a relatively low fi (16K) format. For my 
application, which is just capturing words, not music this is just what I 
needed.

from:

https://github.com/keenan/cordova-phonegap-audio-encode/issues/4



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org

Reply via email to