Screen Recording Using AvCaptureSession

In my application, I want to record a view using still images. Is there a way to take a screenshot using AvCaptureSession? I will do this, capture the viewing images and after that I will use all the images to make the video from this point of view. I also link to this link https://github.com/immortalLion/iPhoneScreenRecord/tree/master/ScreenCaptureViewTest . I know that we can record a screen shot using IOSurface, but I do not want to record the entire screen, instead I want to capture only the view. I would like to install Framerate and with rendering a good scale Thanks in advance.

+6
source share
1 answer

This will capture the view as an image, and you can specify a view frame.

- (UIImage *)captureView:(UIView *)view { CGRect screenRect = [[UIScreen mainScreen] bounds]; UIGraphicsBeginImageContext(screenRect.size); CGContextRef ctx = UIGraphicsGetCurrentContext(); [[UIColor blackColor] set]; CGContextFillRect(ctx, screenRect); [view.layer renderInContext:ctx]; UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return newImage; } 
0
source

Source: https://habr.com/ru/post/954070/


All Articles