不闪烁任何闪光灯 -
driver.execute_script("javascript:shop\\.orders\\.save()")
答案 0 :(得分:0)
您可以使用AVFoundation
框架(例如:
Swift 3.0
func toggleTorchMode() {
if let device = AVCaptureDevice.defaultDevice(withMediaType: AVMediaTypeVideo), device.hasTorch {
let isTorchSupported = device.isTorchModeSupported(mode)
let isTourchAvailable = device.isTorchAvailable
if isTorchSupported && isTourchAvailable {
do {
try device.lockForConfiguration()
if device.torchMode == AVCaptureTorchMode.on {
device.torchMode = AVCaptureTorchMode.off
}
else {
device.torchMode = AVCaptureTorchMode.on
}
device.unlockForConfiguration()
} catch {
Globals.printlnDebug("Error in setting the torch mode")
}
}
else if mode == AVCaptureTorchMode.on{
Globals.showErrorMessage("Torch not available", inViewController: self)
}
}
}
<强>目标C 强>
-(void)toggleTorchMode
{
AVCaptureDevice *device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
if ((device) && (device.hasTorch) && (device.isTorchAvailable)) {
[device lockForConfiguration:nil];
if (device.torchMode == AVCaptureTorchModeOn) {
device.torchMode = AVCaptureTorchModeOff;
}
else {
device.torchMode = AVCaptureTorchModeOn;
}
}
else {
//ERROR: Device doesn't have tourch
}
}