Open ndbroadbent opened 9 years ago
Aha, the problem was that JPSVolumeButtonHandler
is calling setCategory
and setActive
on an AVAudioSession
, which screwed up my video recording, maybe because I was also recording the audio from the microphone. Also, I think you should use self.session = [AVAudioSession sharedInstance];
instead of instantiating a new one, since it's a singleton object.
Do you know if calling setCategory
and setActive
is really necessary? My app is already calling them, but I commented out all the calls in my app, as well as in JPSVolumeButtonHandler
, and I could still capture the volume buttons without any issues.
Oh, the sharedInstance
thing was already fixed in this commit. Sorry, I was looking at the latest code I found on Cocoapods, which doesn't seem to be updated yet.
@ndbroadbent did commenting out setCategory and setActive work for you? I am running into the exact same problem on the most recent version (Jan 2015), when I modify those calls I can no longer use the volume buttons.
Please see my StackOverflow post for details: http://stackoverflow.com/questions/29312178/cant-call-startrecordingtooutputfileurl-more-than-once-on-instance-of-avcapture
I think
JPSVolumeButtonHandler
might not be cleaning up after itself properly. If I initialize it once, then I can record videos fine. But if I set it to nil and it deallocates (when my view disappears), and then I initialize it again, I can't record videos anymore (UsingAVCaptureMovieFileOutput#startRecordingToOutputFileURL
).