Closed jurisgalang closed 13 years ago
Here's a sample Sketch to recreate the issue:
require 'ruby-processing' class Sketch < Processing::App load_library :video import "processing.video.Capture" def setup size 640, 480 @video = Capture.new self, width, height, 32 end def capture_event video @video.read end def draw image @video, 0, 0 end end
A workaround is to not rely on capture_event method, and just check the Camera#available? return value:
capture_event
Camera#available?
def draw @video.read if @video.available? image @video, 0, 0 end
unfortunately java reflection on jruby objects (which is used by video library and others) doesn't works. The only workaround is to use the method you described.
Yeah, kinda figured that out sometime ago. :-)
Here's a sample Sketch to recreate the issue:
A workaround is to not rely on
capture_event
method, and just check theCamera#available?
return value: