Java Media Framework
The Java Media Framework (JMF) is a Java library that enables audio, video and other time-based media to be added to Java applications and applets. This optional package, which can capture, play, stream, and transcode multiple media formats, extends the Java Platform, Standard Edition (Java SE) and allows development of cross-platform multimedia applications. Versions and licensingAn initial, playback-only version of JMF was developed by Sun Microsystems, Silicon Graphics, and Intel, and released as JMF 1.0 in 1997. JMF 2.0, developed by Sun and IBM, came out in 1999 and added capture, streaming, pluggable codecs, and transcoding. JMF is branded as part of Sun's "Desktop" technology of J2SE opposed to the Java server-side and client-side application frameworks. The notable exceptions are Java applets and Java Web Start, which have access to the full JMF in the web browser's or appletviewer's underlying JRE.[1][2] JMF 2.0 originally shipped with an MP3 decoder and encoder. This was removed in 2002, and a new MP3 playback-only plug-in was posted in 2004. JMF binaries are available under a custom license, and the source is available under the SCSL. The current version ships with four JAR files, and shell scripts to launch four JMF-based applications:
JMF is available in an all-Java version and as platform-specific "performance packs", which can contain native-code players for the platform, and/or hooks into a multimedia engine specific to that platform. JMF 2.0 offers performance packs for Linux, Solaris (on SPARC) and Windows.[1] In January 2011, Tudor Holton of Bentokit Project released a Debian package for the JMF to alleviate difficulties that had arisen over time when installing the JMF on Debian and Ubuntu Linux. This package does not contain the JMF, but presents the user with the JMF License, retrieves it from the Oracle website, and then installs it.[3] A similar Debian package installer for the JMF MP3 Plugin was also built in February 2011.[4] Design conceptsJMF abstracts the media it works with into A Criticism and alternativesMany JMF developers have complained that the JMF implementation supplied in up-to-date JRE's supports relatively few up-to-date codecs and formats. Its all-Java version, for example, cannot play MPEG-2, MPEG-4, Windows Media, RealMedia, most QuickTime movies, Flash content newer than Flash 2, and needs a plug-in to play the ubiquitous MP3 format.[5] While the performance packs offer the ability to use the native platform's media library, they're only offered for Linux, Solaris and Windows. In particular, MS Windows-based JMF developers new to JMF often expect support for some newer formats on all platforms when such formats are only, in fact, supported on MS Windows. While JMF is considered a very useful framework, the freely available implementation provided by Oracle is suffering from a lack of updates and maintenance. JMF does not get much maintenance effort from Oracle; the API has not been enhanced since 1999, and the last news item on JMF's home page was posted in September 2008. While JMF is built for extensibility, there are few such third-party extensions. Furthermore, content editing functionality in JMF is effectively non-existent. You can do simple recording and playback for audio and video, but the implementation provided by Oracle can do little else.[6] Platforms beyond those that Oracle provides support to are left to their corresponding JRE vendors.[7] While Sun still provides a forum for discussion of its implementation, there have been several efforts to implement open-source alternatives.[8][9][10][11][12] AlternativesDepending on a developer's needs, several other libraries may be more suitable than JMF. These include:
Code exampleThe following example shows an AWT file-selection dialog, and attempts to load and play the media file selected by the user. import javax.media.*;
import java.io.File;
import java.awt.*;
public class TrivialJMFPlayer extends Frame {
public static void main (String[] args) {
try {
Frame f = new TrivialJMFPlayer();
f.pack();
f.setVisible (true);
} catch (Exception e) {
e.printStackTrace();
}
}
public TrivialJMFPlayer()
throws java.io.IOException,
java.net.MalformedURLException,
javax.media.MediaException {
FileDialog fd = new FileDialog
(this, "TrivialJMFPlayer", FileDialog.LOAD);
fd.setVisible(true);
File f = new File(fd.getDirectory(), fd.getFile());
Player p = Manager.createRealizedPlayer
(f.toURI().toURL());
Component c = p.getVisualComponent();
add(c);
p.start();
}
}
Much of the example is involved with the building of the AWT GUI. Only two lines touch JMF. References
|
Portal di Ensiklopedia Dunia