private void publish() {
first = true;
try {
if (!AudioSystem.isLineSupported(info)) {
System.err.println("Line is not supported by the Audio System");
JOptionPane.showMessageDialog(this,
"Line is not supported by the Audio System");
return;
}
line = (TargetDataLine) mixer.getLine(info);
line.open(sourceFormat);
line.start();
IEncoder encoder = new Encoder();
encoder.add(AudioCodec.MP3, sourceFormat);
encoder.add(VideoCodec.SCREEN_VIDEO, null);
clientManager.setEncoder(encoder);
clientManager.setRunning(true);
clientManager.setRecording(true);
CaptureAudio captureAudio = new CaptureAudio(clientManager, line);
CaptureVideo captureVideo = new CaptureVideo(clientManager, new Robot());
Thread publishAudio = new Thread(captureAudio);
publishAudio.start();
Thread publishVideo = new Thread(captureVideo);
publishVideo.start();
} catch (LineUnavailableException e) {
System.err.println("Line Unavailable:" + e);
e.printStackTrace();
System.exit(-2);
} catch (Exception e) {
System.out.println("Direct Upload Error");
e.printStackTrace();
}
}// End of RecordAudio method
Sunday, June 19, 2011
Java Code Examples
You can publish your desktop just for a few lines of code:
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment