views:

50

answers:

1

I wrote an application that sets some camera values (duration, quality, etc) using UIImagePickerController and it works fine. However, on an iPhone 4, I start with the front camera and if the user switches to the rear camera, the quality settings are lost. Is there a way that I can test if the user switches between the front and rear camera?

By using

if (imagePicker.cameraDevice=UIImagePickerControllerCameraDeviceFront)

it will tell me if the camera is set to the front camera but if the user switches cameras using the screen switcher, it won't return the camera value.

Any help here would be greatly appreciated.

A: 

You probably need AVCaptureDevice notifications:

  • AVCaptureDeviceWasDisconnectedNotification
  • AVCaptureDeviceWasConnectedNotification

Observe them and react accordingly.

madmw
Thanks for this, I'll give it a try. I have a support ticket open with Apple and from the forums, it appears that this is a bug. When switching cameras, the videoquality settings are not kept and are set back to the highest quality settings. The other variables such as videoduration stay.I'll try using the AVCaptureDeviceWasDisconnectedNotification and reset the variables before I reconnect to the other camera.Thanks again.
VMan
I'm not too sure of the syntax for AVCaptureDeviceWasDisconnectedNotification. Can anyone please provide an example?
VMan