Created
November 4, 2012 22:52
-
-
Save thinkdevcode/4014184 to your computer and use it in GitHub Desktop.
rubymotion broken
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MainController < UIViewController | |
def viewDidLoad | |
setupVideo() | |
end | |
def setupVideo | |
@session = AVCaptureSession.alloc.init | |
@session.sessionPreset = AVCaptureSessionPresetLow | |
@device = AVCaptureDevice.defaultDeviceWithMediaType AVMediaTypeVideo | |
@input = AVCaptureDeviceInput.deviceInputWithDevice @device, error:nil | |
@output = AVCaptureVideoDataOutput.alloc.init | |
@output.alwaysDiscardsLateVideoFrames = true | |
queue = Dispatch::Queue.new('cameraQueue') | |
@output.setSampleBufferDelegate self, queue:queue.dispatch_object | |
@output.setVideoSettings KCVPixelBufferPixelFormatTypeKey => KCVPixelFormatType_32BGRA | |
session.addInput @input | |
session.addOutput @output | |
@session.startRunning | |
end | |
def captureOutput(captureOutput, didOutputSampleBuffer:sampleBuffer, fromConnection:connection) | |
#imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer) | |
#image = CIImage.imageWithCVImageBuffer(imageBuffer) | |
#Dispatch::Queue.main.sync do | |
#end | |
nil | |
end | |
end |
Experiencing the same... lost a day trying to figure out if it was just me.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
have you been able to fix this? I'm also facing a problem with captureOutput:didOutputSampleBuffer:fromConnection, which is not being triggered at all