How to scan Bar code in a specific area of AVCaptureVideoPreviewLayer using Objective C in iOS?

Viewed 5209

I am trying to implement Bar code Scanner to my iPhone App using AVFoundation in Objective C. Bar code scanning part is working fine, but the issue is currently preview is displaying in the whole screen of the device and I want scanner preview to be display in a specific area of the device and need to change brightness area of the background (please refer to the below screenshot).

enter image description here

How can I place specific region of the AVCaptureVideoPreviewLayer to get the Bar scanner result with the corners?

2 Answers
Related