LoginSignup
3
3

More than 5 years have passed since last update.

Configuration AVCaptureDevice

Last updated at Posted at 2013-03-14

AVCaptureDeviceで取得したデバイスの設定をいろいろ変えたいときがある。カメラの場合はフラッシュ光らせるとか、オートフォーカスにするとか。
AVCaptureDeviceにはfocusModetorchModeなど各種プロパティが存在するが以下のようにやっては変更ができない。

device.focusMode = AVCaptureFlashModeOn;

デバイスはロックされているため、設定を変えたければ一度ロックを行なって、解放するという作業が必要になる。具体的には以下のように書けばよい。

NSError *err;
[device lockForConfiguration:&err];
device.focusMode = AVCaptureFlashModeOn;
[device unlockForConfiguration];

ただむやみにlockを行うと他のアプリケーションのキャプチャ品質に影響を及ぼすのでご注意を。

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3