IOS Swift, how to get image capture on hls (http live stream)?

How to get image capture on hls (http live stream) using Swift on iOS?

return the nil value in the "captureImage" field below the code.

func onCaptureButtonClick(sender : UIButton){

    let generator = AVAssetImageGenerator(asset: avAsset)
    generator.maximumSize = self.videolayer.frame.size

    let   time = CMTimeMake(1, 1);

    let capturedImage : CGImageRef! = generator.copyCGImageAtTime(time, actualTime: nil, error: nil)

    let imageView = UIImageView(frame: CGRectMake(0,self.view.bounds.height/2, self.view.bounds.width, self.view.bounds.height / 2))
    imageView.image = UIImage(CGImage: capturedImage)

    self.view.addSubview(imageView)

}
+4
source share

All Articles