AVCaptureVideoPreviewLayer (camera preview) freezes/stuck after moving to background and back

后端 未结 6 665
忘了有多久
忘了有多久 2020-12-15 20:38

Cant figure this one out. Everything works fine when the app is active, and than sometimes when i move the app to the background(pressing the home button) a

6条回答
  •  渐次进展
    2020-12-15 21:12

    Just a quick update In 2017 if someone suffering overthinking such that thing,

    Do the same thing but change your

    stillImageOutput!.outputSettings = [AVVideoCodecKey: AVVideoCodecJPEG]
    

    replace it with

    stillImageOutput!.outputSettings = [((kCVPixelBufferPixelFormatTypeKey as NSString) as String):NSNumber(value:kCVPixelFormatType_32BGRA)]
    

    it will solve the issue. If not, then come back here and write down :))

提交回复
热议问题