Skip to content
This repository has been archived by the owner on Nov 10, 2023. It is now read-only.

Weird bug when used at the same time as an AVCaptureSession #7

Open
ndbroadbent opened this issue Mar 28, 2015 · 3 comments
Open

Weird bug when used at the same time as an AVCaptureSession #7

ndbroadbent opened this issue Mar 28, 2015 · 3 comments

Comments

@ndbroadbent
Copy link

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 (Using AVCaptureMovieFileOutput#startRecordingToOutputFileURL).

@ndbroadbent
Copy link
Author

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.

@ndbroadbent
Copy link
Author

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.

@dirkmcpherson
Copy link

@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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants