view src/com/aurellem/capture/hello/BasicAVRecord.java @ 12:d10f4d4ff15a

going to improve documentation
author Robert McIntyre <rlm@mit.edu>
date Thu, 27 Oct 2011 21:07:50 -0700
parents
children
line wrap: on
line source
1 package com.aurellem.capture.hello;
3 import java.io.File;
4 import java.io.IOException;
6 import jme3test.helloworld.HelloAudio;
7 import jme3test.helloworld.HelloJME3;
8 import jme3test.niftygui.TestNiftyExamples;
9 import jme3test.water.TestPostWater;
11 import com.aurellem.capture.Capture;
12 import com.aurellem.capture.IsoTimer;
13 import com.jme3.app.SimpleApplication;
16 /**
17 *
18 * Demonstrates how to use basic Audio/Video capture with a jMonkeyEngine
19 * application.
20 *
21 * @author Robert McIntyre
22 *
23 */
25 public class BasicAVRecord {
27 public static void basicVideo() throws IOException{
28 File video = File.createTempFile("HelloJME3", ".avi");
29 System.out.println("Saving video to: " + video.getCanonicalPath());
30 SimpleApplication app = new HelloJME3();
31 app.setTimer(new IsoTimer(60));
33 Capture.captureVideo(app, video);
34 app.start();
35 }
37 public static void basicVideoGUI() throws IOException {
38 File video = File.createTempFile("GUI", ".avi");
39 System.out.println("Saving video to: " + video.getCanonicalPath());
40 SimpleApplication app = new TestNiftyExamples();
41 app.setTimer(new IsoTimer(60));
43 Capture.captureVideo(app, video);
44 app.start();
45 }
47 public static void basicAudio() throws IOException{
48 File audio = File.createTempFile("BasicAudio", ".wav");
49 System.out.println("Saving audio to: " + audio.getCanonicalPath());
50 SimpleApplication app = new HelloAudio();
51 app.setTimer(new IsoTimer(60));
53 // you will not hear the audio while it is being captured.
54 Capture.captureAudio(app, audio);
56 app.start();
57 }
59 public static void basicAudioVideo() throws IOException{
60 File video = new File("/home/r/tmp/basicVideo.avi");
61 File audio = new File("/home/r/tmp/basicAudio.wav");
63 SimpleApplication app = new TestPostWater();
64 app.setTimer(new IsoTimer(60));
66 Capture.captureVideo(app, video);
67 Capture.captureAudio(app, audio);
69 app.start();
70 }
73 public static void main(String[] ignore) throws IOException{
74 basicAudio();
75 }
76 }