0

I am trying to capture a UIImage of the screen. However, there is a video (in a AVPlayerViewController). The capture works, but what is displayed in the AVPlayerViewController area is always empty - the rest of the screen is captured correctly.

Is there a way to capture what is in the AVPlayerViewController window too ?

This is how I am capturing the screen

    func captureScreen() -> UIImage? {
        UIGraphicsBeginImageContextWithOptions(self.view.bounds.size, false, UIScreen.main.scale)
        self.view.layer.render(in: UIGraphicsGetCurrentContext()!)
        let image = UIGraphicsGetImageFromCurrentImageContext()
        UIGraphicsEndImageContext()
        return image
    }
Agreensh
  • 1,305
  • 1
  • 12
  • 15
  • 1
    http://stackoverflow.com/questions/23286252/screenshot-for-avplayer-and-video – PlusInfosys Apr 25 '17 at 12:03
  • Your problem is that apple highly optimized viewing a video so it wan't use much cpu usage. In fact the video is drawn directly to the screen without using view logic. – ObjectAlchemist Apr 25 '17 at 19:24

0 Answers0