0

如何检测代码中的“警报 LED 闪烁”(来自设置)状态?我努力了:

AVCaptureDevice *torched=[AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];   

BOOL test = torched.torchMode;
BOOL test1 = torched.flashMode;

但它似乎不是我需要的。

4

1 回答 1

0

这样做,

BOOL test=NO;
BOOL test1=NO;

Class captureDeviceClass = NSClassFromString(@"AVCaptureDevice");
if (captureDeviceClass != nil) {
    AVCaptureDevice *device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
    if ([device hasTorch] && [device hasFlash]){
       if(device.flashMode==AVCaptureFlashModeOn)
          NSLog(@"ON");
       else
          NSLog(@"OFF");
    }
}

希望对你有帮助......

于 2013-05-21T08:39:27.240 回答