JMF capture technology (audio)
JMF capture technology (audio)
JMF can capture voice and video equipment, also can be controlled by means of the JMF Mike, these audio and video camera equipment, to be discussed here is how to make use of JMF Mike, in their own tests on the machines, let you hear their own voices.
Below is related to the main categories:
CaptureDeviceManager, CaptureDeviceInfo, Vector, MediaPlayer, DataSource, MeidaLocator, AduioFormat, VideoFormat, Format.
Sun can be provided in the Document on the inspection can be down under, the site not remember. Can be looked at, there was a preliminary understanding, and then return to read examples of class libraries, this might be better.
Public class CaptureDeviceManager
Extends java.lang.Object
CaptureDeviceManager is a manager class that provides access to a list of the capture devices available on a system. CaptureDeviceManager uses a registry and query mechanisms to locate devices and return CaptureDeviceInfo objects for available devices. The CaptureDeviceManager is also used to register new capture devices.
Public class CaptureDeviceInfo
Extends java.lang.Object
Implements java.io.Serializable
A CaptureDeviceInfo object contains information about a particular capture device.
Public class MediaPlayer
Extends java.awt.Container
Implements Player, java.io.Externalizable
MediaPlayer encapsulates a player in a JavaBeans TM component. MediaPlayer implements the Player and Externalizable interfaces.
A MediaPlayer can be used as a full-featured Player with either the default Player controls or custom controls.
Also involves a monitoring interface:
ControllerListener. This is mainly used to monitor the media player interface.
1, capture audio equipment
/ *
* @ Author: kenny
* /
Import javax.media .*;
………………..
(Public class CaptureAudio
Vector deviceList = new Vector ();
AudioForamt audio = new AudioFormat (AudioFormat.LINEAR);
Format audioFormat = (Format) audio;
MediaPlayer player = null;
MediaLocator locator = null;
CaptureDeviceInfo captureInfo;
Public CaptureAudio () (
DeviceList = CaptureDeviceManager.getDeviceList (audioFormat);
CaptureInfo = (CaptureDeviceInfo) deviceList.get (0);
CaptureInfo.getLocator locator = ();
)
Public void play () (
Player = new MediaPlayer ();
Player.setMediaLocator (locator);
Player.addControllerListener (this);
Player.realize ();
)
Public void controllerUpdate (ControllerEvent e) (
If (e instanceof RealizeCompleteEvent)
Player.prefetch ();
If (e instanceof PrefetchCompleteEvent)
Player.start ();
)
Public static void main (String [] args) (
CaptureAudio audio = new CaptureAudio ();
Audio.play ();
)
)
Tags: jmf, the core java technology






