Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-7717

Cordova Media Plugin Record as mp4

    XMLWordPrintableJSON

    Details

    • Type: New Feature
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: cordova-plugin-media
    • Labels:

      Description

      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

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              wootwoot1234 Tom Krones
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: