ios-Flash operation

Source: Internet
Author: User

AVCaptureDevice.h is primarily used to obtain some of the iphone's properties on camera devices. Front-and rear -facing camerasenum{avcapturedevicepositionback=1, Avcapturedevicepositionfront=2};typedef nsinteger avcapturedeviceposition; Flash switchenum{Avcaptureflashmodeoff=0, Avcaptureflashmodeon=1, Avcaptureflashmodeauto=2};typedef nsinteger avcaptureflashmode; flashlight Switchenum{Avcapturetorchmodeoff=0, Avcapturetorchmodeon=1, Avcapturetorchmodeauto=2,};typedef Nsinteger avcapturetorchmode; focal length adjustmentenum{avcapturefocusmodelocked=0, Avcapturefocusmodeautofocus=1, Avcapturefocusmodecontinuousautofocus=2,};typedef Nsinteger avcapturefocusmode; exposure adjustmentenum{avcaptureexposuremodelocked=0, Avcaptureexposuremodeautoexpose=1, Avcaptureexposuremodecontinuousautoexposure=2,};typedef Nsinteger avcaptureexposuremode; white balanceenum{avcapturewhitebalancemodelocked=0, Avcapturewhitebalancemodeautowhitebalance=1, Avcapturewhitebalancemodecontinuousautowhitebalance=2,};typedef Nsinteger avcapturewhitebalancemode;

To turn on the flash:

1avcapturedevice* d = nil;//find a device by position2nsarray* alldevices =[Avcapturedevice devices];3  for(avcapturedevice* Currentdeviceinchalldevices) {   4     if(Currentdevice.position = =avcapturedevicepositionback) { 5D =Currentdevice; 6     } 7}//at this point, D may still is nil, assuming we found something we like ....8nserror* err =Nil;9BOOL lockacquired = [D lockforconfiguration:&err]; Ten if(!lockacquired) {     One     //log err and handle ... A}Else {     -     //Flip on the flash mode -     if([D Hasflash] &&[D Isflashmodesupported:avcaptureflashmodeon]) {        the [D Setflashmode:avcaptureflashmodeon];  -     }     - [D unlockforconfiguration]; -}

ios-Flash operation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.