Crashing in iOS after returning from background
See original GitHub issueI’m getting a crash when my app returns from background. I’m able to record and stop recording all day long when the app first comes up… but hitting record after coming back from background the app crashes.
It throws EXC_BAD_ACCESS(code=1, adress=0xWtver123) at line 89 in cordova-plugin-audioinput/src/ios/CDVAudioInputCapture.m
Here: https://github.com/edimuj/cordova-plugin-audioinput/blob/master/src/ios/CDVAudioInputCapture.m#L89
I don’t ObjC from a hole in the ground so any help would be much appreciated. Love the plugin it does exactly what I needed. I was also a little confused as to how to connect it up to my WebAudio lib. I’m using Recorder.js (https://github.com/mattdiamond/Recorderjs) but this is how I got it to work… perhaps there is a better way of connecting the 2 and I’m not sure if it’s related?
Any advice would be much appreciated.
This is what my code essentially looks like minus some DOM stuff.
startRecording: function(){
// Start audioinput streaming to WebAudio
audioinput.start({ streamToWebAudio: true});
if(this.recorder){
this.recorder.clear();
this.recorder.record();
} else {
// Here I use audioinput._micGainNode as the source for a new recorder.js instance
this.recorder = new Recorder(audioinput._micGainNode, {numChannels:1});
this.recorder.record();
}
},
stopRecording: function(){
this.recorder.stop();
// I stop audioinput after I stop recording
audioinput.stop();
this.recorder.exportWAV(this.setRecordedFile);
}
Issue Analytics
- State:
- Created 7 years ago
- Comments:10 (4 by maintainers)
Top GitHub Comments
Thank you so much for this plugin and your extremely well thought responses to my issues. I managed to minimize the crashes by reinitialuzing the plugin after returning from background. It still happens on occasion but is mostly under control in normal usage. I also managed to get my app in the stores. I think by limiting the sound recording to a short time period (20s with a timer) it was allowed to slide… Thank goodness. Anyway thank you for all your help.
Doing some housekeeping: Since there hasn’t been any action regarding this issue for a time now, I’m closing it.