Hi,
I am trying to record multiple files (most likely as m4a or mp3), to
store for playing later through the same app, on the iPad.
I might be using the plugin provided by Matt Crider at
https://github.com/mcrider/phonegap-plugins/tree/master/iPhone/RecordingEncoder
to store as m4a, but currently I am having a little hard time with the
js/IOS interaction and paths before getting that far.
("SoundRecorder" in the code snippets below is just a "namespace" for
recording related stuff and the two last params are callback functions
- of which none is called...)
If I do
SoundRecorder.currentRecordingMedia = new Media("samplefile1.mp3",
onRecordSuccess, onRecordError);
SoundRecorder.currentRecordingMedia.startAudioRecord();
, I get "Cannot use audio file from resource". If I do
SoundRecorder.currentRecordingMedia = new Media(null,
onRecordSuccess, onRecordError);
SoundRecorder.currentRecordingMedia.startAudioRecord();
, I get log lines like this:
2011-04-30 19:58:26.550 <appname>[385:707] Will use resource
'documents://1304186306504' from the documents folder.
2011-04-30 19:58:26.570 <appname>[385:707] Failed to initialize
AVAudioPlayer: Error Domain=NSOSStatusErrorDomain Code=-43 "The
operation couldn’t be completed. (OSStatus error -43.)"
2011-04-30 19:58:26.580 <appname>[385:707] Will use resource
'documents://1304186306504' from the documents folder.
[Switching to thread 11779]
2011-04-30 19:58:27.411 <appname>[385:707] Started recording audio
sample 'documents://1304186306504'
and when doing stopAudioRecord() at the end of recording (when I want
to store to file):
2011-04-30 19:58:42.369 <appname>[385:707] Will use resource
'documents://1304186306504' from the documents folder.
2011-04-30 19:58:42.374 <appname>[385:707] Stopped recording audio
sample 'documents://1304186306504'
2011-04-30 19:58:42.788 <appname>[385:707] Unknown resource '/var/
mobile/Applications/E690DB48-D065-4D97-9365-XXXX9347/Documents/
1304186306504'
2011-04-30 19:58:42.792 <appname>[385:707] Cannot use audio file from
resource '/var/mobile/Applications/E690DB48-D065-4D97-9365-XXXX39347/
Documents/1304186306504'
2011-04-30 19:58:42.795 <appname>[385:707] Finished recording audio
sample 'documents://1304186306504'
As mentioned my callbacks are not called. Above testing and logs are
from testing on device from Xcode, but similar with emulator.
I guess what I need is just a push in the right direction (I see the
"IOS quirks" in
http://docs.phonegap.com/phonegap_media_media.md.html
mention that files must exist?) on how to specify the files and paths
and how to access them again, for playing and possibly sending them to
the plugin mentioned above (but plain PCM might also do for my use
case, but would be nice to save some space on the user's behalf!).
TIA and Cheers,
-S-