You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I pulled the RxAVFoundation dependency into my Swift project and attempted to use the videoCaptureOutput method to print a new log statement whenever we get a new captureOutput. However, it seems like we never get any .next events. Here's my ViewController.swift
//
// ViewController.swift
// RxTest
//
// Created by Jessie Young on 6/28/21.
//
import UIKit
import AVFoundation
import RxSwift
class ViewController: UIViewController {
// capture session
private let session = AVCaptureSession()
private var videoDevice: AVCaptureDevice!
override func viewDidLoad() {
super.viewDidLoad()
self.videoDevice = AVCaptureDevice.default(.builtInWideAngleCamera, for: .video, position: .back)
session
.rx
.configure(captureDevice: videoDevice)
let disposeBag = DisposeBag()
let videoSettings = [(kCVPixelBufferPixelFormatTypeKey as NSString) : NSNumber(value: kCVPixelFormatType_32BGRA)] as [String : Any]
session
.rx
.videoCaptureOutput(settings: videoSettings)
.observeOn(MainScheduler.instance)
.subscribe { [unowned self] (event) in
switch event {
case .next(let captureOutput):
print("got a frame")
case .error(let error):
print("error: %@", "\(error)")
case .completed:
break // never happens
}
}
.disposed(by: disposeBag)
session
.rx
.startRunning()
// Do any additional setup after loading the view.
}
}
The text was updated successfully, but these errors were encountered:
I pulled the RxAVFoundation dependency into my Swift project and attempted to use the
videoCaptureOutput
method to print a new log statement whenever we get a newcaptureOutput
. However, it seems like we never get any.next
events. Here's myViewController.swift
The text was updated successfully, but these errors were encountered: