Java Reference
In-Depth Information
JMF
JMF was released long ago by Sun and has not been well maintained over the years. It is an
extension so it must be downloaded; there is a Maven dependency for it in the
javasrc
Maven
pom.xml
file.
Example 12-7
shows code that displays a movie or other media file
named on the command line. JMF is flexible; this program falls back to playing an audio file,
supplying a volume control, if the media object that you name contains a sound clip instead
Figure 12-6. JMFPlayer in action: audio (left), video (right)
Example 12-7. JMFPlayer.java
public
public class
class
JMFPlayer
JMFPlayer
extends
extends
JPanel
implements
implements
ControllerListener
{
/** The player object */
Player thePlayer
=
null
null
;
/** The parent Frame we are in. */
JFrame parentFrame
=
null
null
;
/** Our contentpane */
Container cp
;
/** The visual component (if any) */
Component visualComponent
=
null
null
;
/** The default control component (if any) */
Component controlComponent
=
null
null
;
/** The name of this instance's media file. */