passingnil passingnil - 1 month ago 6
iOS Question

Is there any way to blur AVCaptureSession's videoPreviewLayer ?

I have a custom camera created AVCaptureSession and i want to "blur" the AVCaptureVideoPreviewLayer(a layer with blur effect would be nice). I know about UIVisualEffectView,as i know, there is not any way to modify it's layer,so i could animate it's path. Any suggestions ?

Answer

To achive this, i created a mask and applied it to UIVisualEffectView.

Heres's the complete guide

Create UIVisualEffectView with blur effect. Add it as subview to your view, so it will cover the videoPreviewLayer. Create a mask with a hole in it. Apply that mask to visualEffectView.

Comments