[ 
https://issues.apache.org/jira/browse/CB-12542?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15903832#comment-15903832
 ] 

ASF GitHub Bot commented on CB-12542:
-------------------------------------

GitHub user shazron opened a pull request:

    https://github.com/apache/cordova-plugin-media/pull/132

    CB-12542 - Can't record to a wav file

    Thanks to Leo Schubert for this patch (see JIRA issue).
    
    ### Platforms affected
    
    iOS
    
    ### What does this PR do?
    
    Change the file extension of the file being recorded to .m4a  (AAC)
    
    ### What testing has been done on this change?
    
    cordova-paramedic local test on iOS (flaky). I plan to let the CI run the 
device tests.
    
    ### Checklist
    - [X] [Reported an issue](http://cordova.apache.org/contribute/issues.html) 
in the JIRA database
    - [X] Commit message follows the format: "CB-3232: (android) Fix bug with 
resolving file paths", where CB-xxxx is the JIRA ID & "android" is the platform 
affected.
    - [X] Added automated test coverage as appropriate for this change.


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/shazron/cordova-plugin-media CB-12542

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cordova-plugin-media/pull/132.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #132
    
----
commit b77adb2fb8f0cf8fd72352959bbdc3b9b76e2791
Author: Shazron Abdullah <[email protected]>
Date:   2017-03-09T19:18:41Z

    CB-12542 - Can't record to a wav file
    
    Thanks to Leo Schubert (ls at 4js dot com) for this patch.

----


> can’t record to a “wav” file on IOS media plugin
> ------------------------------------------------
>
>                 Key: CB-12542
>                 URL: https://issues.apache.org/jira/browse/CB-12542
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Plugin Media
>    Affects Versions: 3.5.0
>         Environment: 9.x Simulator , IOS 8.x device (iPod touch)
>            Reporter: Leo Schubert
>            Priority: Critical
>         Attachments: cdvsound.diff
>
>
> I get “Failed to initialize AVAudioRecorder: (null)” in the error callback of 
> the startRecordingAudio() exec API.
> I see that the AVAudioPlayer settings in CDVAudio.m are
> {code}
> NSDictionary *audioSettings = @{AVFormatIDKey: @(kAudioFormatMPEG4AAC),
>                                             AVSampleRateKey: @(44100),
>                                             AVNumberOfChannelsKey: @(1),
>                                             AVEncoderAudioQualityKey: 
> @(AVAudioQualityMedium)
>                                             };
> {code}
> This is IMHO the reason it doesn’t work. Either one uses the .m4a extension 
> with {{kAudioFormatMPEG4AAC}} or
> .wav with the {{kAudioFormatLinearPCM}} key (the IOS docs are very unclear 
> about which file extensions are actually supported)
> The plugin enforces “wav” but the settings enforce the MPEG4AAC encoder.
> Using the attached simple patch and using .m4a at the JS side solves the 
> problem and records on my iPod touch IOS 8.x.
> I stumbled also across 
> https://github.com/remoorejr/cordova-plugin-media-with-compression where the 
> exchange wav->m4a is done too.
> Strangely I can’t find much problems reported on stackoverflow, but this one 
> seems to cover it
> http://stackoverflow.com/questions/12244111/failed-to-initialize-avaudiorecorder-null
> The last poster seem to indicate that the problem sneaked in in IOS 8 
> (previously it was probably possible to record to a .wav file but with AAC 
> content).
> Looking at the recordAudio() test for the plugin in tests/tests.js I can’t 
> see that potential errors are actually causing the test to fail: they are 
> just logged with console.log , so this may explain why the problem has not 
> been detected by the tests.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to