0

次のコードがあります。

-(void) startCameraCapture {
    // start capturing frames
    // Create the AVCapture Session
    session = [[AVCaptureSession alloc] init];

    // create a preview layer to show the output from the camera
    AVCaptureVideoPreviewLayer *previewLayer = [AVCaptureVideoPreviewLayer layerWithSession:session];
    // Specify that the video should be stretched to fill the layer’s bounds.
    previewLayer.videoGravity = AVLayerVideoGravityResize;

    //previewView.frame = CGRectMake(126.0, 164.0, 64.0, 75.0);


    previewLayer.frame = previewView.frame;
    [previewView.layer addSublayer:previewLayer];

    // Get the default camera device
    AVCaptureDevice* camera = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
    // get the current settings
    [appDelegate loadSettings];
    [session startRunning];     
}

カメラ デバイスの露出をロックして、画面が特定の明るさに調整されるようにする方法はありますか?

私がこの権利を求めていない場合は申し訳ありません。

ありがとうございました。

編集:

追加してみました:

[camera setExposureModeCustomWithDuration:CMTimeMake(1,1) ISO:100 completionHandler:nil];

しかし、それはその行でアプリがクラッシュするだけです。

4

1 に答える 1

1

Appleのドキュメントによると:

NSGenericException最初に : を使用してレシーバーへの排他的アクセスを取得せずにこのメソッドを呼び出すと、例外がスローされますlockForConfiguration

したがって、次の行を前に追加します。

[camera lockForConfiguration:nil];
于 2014-12-27T15:35:09.873 に答える