rlm@12
|
1 package com.aurellem.capture.hello;
|
rlm@12
|
2
|
rlm@12
|
3 import java.io.File;
|
rlm@12
|
4 import java.io.IOException;
|
rlm@12
|
5
|
rlm@12
|
6 import jme3test.helloworld.HelloAudio;
|
rlm@12
|
7 import jme3test.helloworld.HelloJME3;
|
rlm@12
|
8 import jme3test.niftygui.TestNiftyExamples;
|
rlm@12
|
9 import jme3test.water.TestPostWater;
|
rlm@12
|
10
|
rlm@12
|
11 import com.aurellem.capture.Capture;
|
rlm@12
|
12 import com.aurellem.capture.IsoTimer;
|
rlm@12
|
13 import com.jme3.app.SimpleApplication;
|
rlm@12
|
14
|
rlm@12
|
15
|
rlm@12
|
16 /**
|
rlm@12
|
17 *
|
rlm@12
|
18 * Demonstrates how to use basic Audio/Video capture with a jMonkeyEngine
|
rlm@12
|
19 * application.
|
rlm@12
|
20 *
|
rlm@12
|
21 * @author Robert McIntyre
|
rlm@12
|
22 *
|
rlm@12
|
23 */
|
rlm@12
|
24
|
rlm@12
|
25 public class BasicAVRecord {
|
rlm@12
|
26
|
rlm@12
|
27 public static void basicVideo() throws IOException{
|
rlm@12
|
28 File video = File.createTempFile("HelloJME3", ".avi");
|
rlm@12
|
29 System.out.println("Saving video to: " + video.getCanonicalPath());
|
rlm@12
|
30 SimpleApplication app = new HelloJME3();
|
rlm@12
|
31 app.setTimer(new IsoTimer(60));
|
rlm@12
|
32
|
rlm@12
|
33 Capture.captureVideo(app, video);
|
rlm@12
|
34 app.start();
|
rlm@12
|
35 }
|
rlm@12
|
36
|
rlm@12
|
37 public static void basicVideoGUI() throws IOException {
|
rlm@12
|
38 File video = File.createTempFile("GUI", ".avi");
|
rlm@12
|
39 System.out.println("Saving video to: " + video.getCanonicalPath());
|
rlm@12
|
40 SimpleApplication app = new TestNiftyExamples();
|
rlm@12
|
41 app.setTimer(new IsoTimer(60));
|
rlm@12
|
42
|
rlm@12
|
43 Capture.captureVideo(app, video);
|
rlm@12
|
44 app.start();
|
rlm@12
|
45 }
|
rlm@12
|
46
|
rlm@12
|
47 public static void basicAudio() throws IOException{
|
rlm@12
|
48 File audio = File.createTempFile("BasicAudio", ".wav");
|
rlm@12
|
49 System.out.println("Saving audio to: " + audio.getCanonicalPath());
|
rlm@12
|
50 SimpleApplication app = new HelloAudio();
|
rlm@12
|
51 app.setTimer(new IsoTimer(60));
|
rlm@12
|
52
|
rlm@12
|
53 // you will not hear the audio while it is being captured.
|
rlm@12
|
54 Capture.captureAudio(app, audio);
|
rlm@12
|
55
|
rlm@12
|
56 app.start();
|
rlm@12
|
57 }
|
rlm@12
|
58
|
rlm@12
|
59 public static void basicAudioVideo() throws IOException{
|
rlm@12
|
60 File video = new File("/home/r/tmp/basicVideo.avi");
|
rlm@12
|
61 File audio = new File("/home/r/tmp/basicAudio.wav");
|
rlm@12
|
62
|
rlm@12
|
63 SimpleApplication app = new TestPostWater();
|
rlm@12
|
64 app.setTimer(new IsoTimer(60));
|
rlm@12
|
65
|
rlm@12
|
66 Capture.captureVideo(app, video);
|
rlm@12
|
67 Capture.captureAudio(app, audio);
|
rlm@12
|
68
|
rlm@12
|
69 app.start();
|
rlm@12
|
70 }
|
rlm@12
|
71
|
rlm@12
|
72
|
rlm@12
|
73 public static void main(String[] ignore) throws IOException{
|
rlm@12
|
74 basicAudio();
|
rlm@12
|
75 }
|
rlm@12
|
76 }
|