Skip to content

Commit b10ab2e

Browse files
動画/静止画撮影要求時にライトが点灯していたら、消灯するように修正。
(Android版と挙動を合わせる。)
1 parent 4dffe5e commit b10ab2e

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

dConnectDevicePlugin/dConnectDeviceHost/dConnectDeviceHost/Classes/profile/DPHostMediaStreamRecording/DPHostMediaStreamRecordingProfile.m

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,9 @@ - (instancetype)init
482482
[recorder.session startRunning];
483483
}
484484

485+
// ライトが点いていたら消灯する。
486+
[weakSelf setLightOff];
487+
485488
// 写真を撮影する。
486489
__block AVCaptureDevice *captureDevice = [AVCaptureDevice deviceWithUniqueID:recorder.videoDevice.uniqueId];
487490
NSError *error;
@@ -698,6 +701,9 @@ - (instancetype)init
698701
return;
699702
}
700703

704+
// ライトが点いていたら消灯する。
705+
[weakSelf setLightOff];
706+
701707
recorder.videoOrientation = [recorder.videoConnection videoOrientation];
702708

703709
AVCaptureDevice *captureDevice = [AVCaptureDevice deviceWithUniqueID:recorder.videoDevice.uniqueId];
@@ -2062,4 +2068,14 @@ - (void)deviceOrientationDidChange
20622068
}
20632069
}
20642070

2071+
- (void)setLightOff
2072+
{
2073+
AVCaptureDevice *captureDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
2074+
[captureDevice lockForConfiguration:NULL];
2075+
if (captureDevice.torchMode == AVCaptureTorchModeOn) {
2076+
captureDevice.torchMode = AVCaptureTorchModeOff;
2077+
}
2078+
[captureDevice unlockForConfiguration];
2079+
}
2080+
20652081
@end

0 commit comments

Comments
 (0)