'Configure UIView for UIGraphicsImageRenderer

in my learning process, I load some online videos in a AVplayer View, ad then use UIGraphicsImageRenderer to take a snapshot from the video and convert it into an UIImage.

    let renderer = UIGraphicsImageRenderer(size: videoView.bounds.size)
    snapshot = renderer.image { ctx in
        videoView.drawHierarchy(in: videoView.bounds, afterScreenUpdates: true)
    }

It works fine, but there two black bar in top and bottom of AvPlayer so it will take in the snapshot as well. How I can modify to take a snapshot for example in 50 px from top to 50 pixel from bottom. In this way, I can have an snap shot from those bars.

Your help will be appreciated



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source