Skip to content

Instantly share code, notes, and snippets.

@thinkdevcode
Created November 4, 2012 22:52
Show Gist options
  • Save thinkdevcode/4014184 to your computer and use it in GitHub Desktop.
Save thinkdevcode/4014184 to your computer and use it in GitHub Desktop.
rubymotion broken
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
@interhive
Copy link

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