#pragma -mark- 打开手电筒
-(void)openFlashlight
{
AVCaptureDevice * device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
if (device.torchMode == AVCaptureTorchModeOff) {
[device lockForConfiguration:nil];
[device setTorchMode:AVCaptureTorchModeOn];
[device unlockForConfiguration];
}
}
#pragma mark 关闭手电筒
-(void)closeFlashlight {
AVCaptureDevice * device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
if (device.torchMode == AVCaptureTorchModeOn) {
[device lockForConfiguration:nil];
[device setTorchMode: AVCaptureTorchModeOff];
[device unlockForConfiguration];
}
}
#pragma -mark 声音
-(void)getVoice{
//添加提示音
SystemSoundID messageSound;
NSString *path = [[NSBundle mainBundle] pathForResource:@"caremaCut" ofType:@"wav"];
AudioServicesCreateSystemSoundID((__bridge CFURLRef)[NSURL fileURLWithPath:path],&messageSound);
AudioServicesPlaySystemSound (messageSound);
}