简体   繁体   中英

How to fire a method on camera capture click in iphone

I am working on a iPhone application which has a main functionality video capture. How can I fire a method when a user started video recording ??

UIImagePickerController Class reference has instant method for image capturing, start and stop video recording.

Below is the copy of apple Doc for UIImagePickerController Class.

startVideoCapture Starts video capture using the camera specified by the UIImagePickerControllerCameraDevice property.

  • (BOOL)startVideoCapture Return Value YES on success or NO on failure. This method may return a value of NO for various reasons, among them the following:

Movie capture is already in progress The device does not support movie capture The device is out of disk space Discussion Use this method in conjunction with a custom overlay view to initiate the programmatic capture of a movie. You can take more than one movie without leaving the interface, but to do so requires you to hide the default image picker controls.

Calling this method while a movie is being captured has no effect. You must call the stopVideoCapture method, and then wait until the associated delegate object receives an imagePickerController:didFinishPickingMediaWithInfo: message, before you can capture another movie.

Calling this method when the source type of the image picker is set to a value other than UIImagePickerControllerSourceTypeCamera results in the throwing of an NSInvalidArgumentException exception.

If you require additional options or more control over movie capture, use the movie capture methods in the AV Foundation framework. Refer to AV Foundation Framework Reference.

Availability Available in iOS 4.0 and later. Declared In UIImagePickerController.h stopVideoCapture Stops video capture.

  • (void)stopVideoCapture Discussion After you call this method to stop video capture, the system calls the image picker delegate's imagePickerController:didFinishPickingMediaWithInfo: method.

Availability Available in iOS 4.0 and later. Declared In UIImagePickerController.h

You can also get this from Apple Doc class ref

when You click on camera recoding .

After that you can check by

If ([imagePickerController startVideoCapture] == yes)
{
   // Fire your method here.
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM