#N canvas 575 23 529 855 10; #X obj 15 40 inlet; #X obj 412 23 inlet; #X obj 85 1073 outlet; #X obj 15 1044 t a a; #X msg 412 43 frame \$1; #X text 487 975 RI; #X obj 42 1073 outlet; #X obj 15 1109 ofelia d videoplayer-unbind-\$0 \; function M.poiner(p) \; p:unbind() \; end \;; #X f 66; #X obj 85 1049 pack f f f f f f, f 59; #X obj 15 71 ofelia d -c17 videoplayer-\$0 \; local canvas = ofCanvas(this) \; local args = canvas:getArgs() \; local videoplayer = ofVideoPlayer() \; local filename \, start \, loop = args[1] \, args[2] \, args[3] \; local loaded = 0 \; local outlet = ofOutlet(this) \; \; function M.new() \; ofWindow.addListener("setup" \, this) \; if args[1] == nil then print("No file found") \; else M.open(filename) \; end \; if args[2] == 1 then M.play() \; end \; if args[3] == nil then loop = 0 \; end \; end \; \; function M.free() \; ofWindow.removeListener("setup" \, this) \; end \; \; function M.setup() \; M.open(filename) \; end \; \; function M.open(string) \; if ofWindow.exists then \; videoplayer:close() \; videoplayer:load(string) \; if (videoplayer:isLoaded()) then \; print("loaded " .. string) \; videoplayer:update() \; end \; end \; end \; function M.url(string) \; if ofWindow.exists then \; videoplayer:close() \; videoplayer:load(string) \; if (videoplayer:isLoaded()) then \; print("loaded " .. string) \; videoplayer:update() \; end \; end \; end \; function M.play() videoplayer:play() end \; function M.stop() videoplayer:stop() end \; function M.pause() videoplayer:setPaused(true) end \; function M.speed(float) videoplayer:setSpeed(float) end \; function M.frame(float) videoplayer:setFrame(float) end \; function M.volume(float) videoplayer:setVolume(float) end \; function M.loop(float) \; if float == 0 then videoplayer:setLoopState(OF_LOOP_NONE) \; elseif float == 1 then videoplayer:setLoopState(OF_LOOP_NORMAL) \; elseif float == 2 then videoplayer:setLoopState(OF_LOOP_PALINDROME) \; end \; end \; function M.get() return ofTable (videoplayer \, videoplayer:isLoaded() \, videoplayer:isPlaying() \, videoplayer:getCurrentFrame() \, videoplayer:getTotalNumFrames() \, videoplayer:getWidth() \, videoplayer:getHeight()) \; end \; \; function M.pointer(p) \; videoplayer:update() \; videoplayer:bind() \; outlet:outletPointer(0 \, videoplayer) \; videoplayer:unbind() \; end \; function M.bang() \; videoplayer:update() \; videoplayer:bind() \; outlet:outletPointer(0 \, videoplayer) \; videoplayer:unbind() \; end \;; #X f 71; #X connect 0 0 9 0; #X connect 1 0 4 0; #X connect 3 0 7 0; #X connect 3 1 6 0; #X connect 4 0 9 0; #X connect 8 0 2 0; #X connect 9 0 3 0; #X connect 9 1 8 0; #X connect 9 2 8 1; #X connect 9 3 8 2; #X connect 9 4 8 3; #X connect 9 5 8 4; #X connect 9 6 8 5;