[JavaScript] 纯文本查看 复制代码 function turnonLight(isOn) {
if(plus.os.name == "iOS") {
var avcaptClass = plus.ios.importClass("AVCaptureDevice");
if(avcaptClass) {
var device = avcaptClass.defaultDeviceWithMediaType("vide");
plus.ios.invoke(device, "lockForConfiguration:", null);
if(isOn) {
plus.ios.invoke(device, "setTorchMode:", 1);
plus.ios.invoke(device, "setFlashMode:", 1);
} else {
plus.ios.invoke(device, "setTorchMode:", 0);
plus.ios.invoke(device, "setFlashMode:", 0);
}
plus.ios.invoke(device, "unlockForConfiguration");
}
}
};
|