项目作者: tobyliu-sw

项目描述 :
iOS swift module to capture video frames from camera
高级语言: Swift
项目地址: git://github.com/tobyliu-sw/CameraFrameCapturer.git
创建时间: 2017-06-20T18:02:13Z
项目社区:https://github.com/tobyliu-sw/CameraFrameCapturer

开源协议:Apache License 2.0

下载


CameraFrameCapturer

CameraFrameCapturer is an iOS app which contains a swift class module CameraFrameCapturer.swift for capturing video frames from camera, converting the frames to UIImage images, and sent the images to delegate instances.

System environment

  1. macOS Sierra Version 10.12.5
  2. Xcode Version 8.3.3 (installed from App Store)

Tested devices

  1. iPhone 7 plus with iOS 10.2

Porting CameraFrameCapturer.swift to a new project

After copying CameraFrameCapturer.swift to a new project, you need add the key NSCameraUsageDescription with description in the app’s Info.plist.

Reference:

  1. Photo Capture Programming Guide
  2. Technical Q&A QA1937 - Resolving the Privacy-Sensitive Data App Rejection

Features

  • Support switching front and back camera
  • Support changing captured video frames quality
  • Support changing device orientation

Notes

  • Because UI components could be only updated in main thread, please use DispatchQueue.main.async {} to update UI in the delegate function.
    1. func didCaptured(image: UIImage) {
    2. // UIImageView can only be updated in main thread
    3. DispatchQueue.main.async {
    4. self.imageView.image = image
    5. }
    6. }