rlm@12: package com.aurellem.capture.hello; rlm@12: rlm@12: import java.io.File; rlm@12: import java.io.IOException; rlm@12: rlm@12: import jme3test.helloworld.HelloAudio; rlm@12: import jme3test.helloworld.HelloJME3; rlm@12: import jme3test.niftygui.TestNiftyExamples; rlm@12: import jme3test.water.TestPostWater; rlm@12: rlm@12: import com.aurellem.capture.Capture; rlm@12: import com.aurellem.capture.IsoTimer; rlm@12: import com.jme3.app.SimpleApplication; rlm@12: rlm@12: rlm@12: /** rlm@12: * rlm@12: * Demonstrates how to use basic Audio/Video capture with a jMonkeyEngine rlm@12: * application. rlm@12: * rlm@12: * @author Robert McIntyre rlm@12: * rlm@12: */ rlm@12: rlm@12: public class BasicAVRecord { rlm@12: rlm@12: public static void basicVideo() throws IOException{ rlm@12: File video = File.createTempFile("HelloJME3", ".avi"); rlm@12: System.out.println("Saving video to: " + video.getCanonicalPath()); rlm@12: SimpleApplication app = new HelloJME3(); rlm@12: app.setTimer(new IsoTimer(60)); rlm@12: rlm@12: Capture.captureVideo(app, video); rlm@12: app.start(); rlm@12: } rlm@12: rlm@12: public static void basicVideoGUI() throws IOException { rlm@12: File video = File.createTempFile("GUI", ".avi"); rlm@12: System.out.println("Saving video to: " + video.getCanonicalPath()); rlm@12: SimpleApplication app = new TestNiftyExamples(); rlm@12: app.setTimer(new IsoTimer(60)); rlm@12: rlm@12: Capture.captureVideo(app, video); rlm@12: app.start(); rlm@12: } rlm@12: rlm@12: public static void basicAudio() throws IOException{ rlm@12: File audio = File.createTempFile("BasicAudio", ".wav"); rlm@12: System.out.println("Saving audio to: " + audio.getCanonicalPath()); rlm@12: SimpleApplication app = new HelloAudio(); rlm@12: app.setTimer(new IsoTimer(60)); rlm@12: rlm@12: // you will not hear the audio while it is being captured. rlm@12: Capture.captureAudio(app, audio); rlm@12: rlm@12: app.start(); rlm@12: } rlm@12: rlm@12: public static void basicAudioVideo() throws IOException{ rlm@12: File video = new File("/home/r/tmp/basicVideo.avi"); rlm@12: File audio = new File("/home/r/tmp/basicAudio.wav"); rlm@12: rlm@12: SimpleApplication app = new TestPostWater(); rlm@12: app.setTimer(new IsoTimer(60)); rlm@12: rlm@12: Capture.captureVideo(app, video); rlm@12: Capture.captureAudio(app, audio); rlm@12: rlm@12: app.start(); rlm@12: } rlm@12: rlm@12: rlm@12: public static void main(String[] ignore) throws IOException{ rlm@12: basicAudio(); rlm@12: } rlm@12: }