Java Media Framework

Java Media Framework

Infobox_Software
name = Java Media Framework



caption = JMF's simple JMStudio application playing a QuickTime movie
developer = Sun Microsystems
latest_release_version = 2.1.1e
latest_release_date = release_date|2003|5|23
latest_preview_version =
latest_preview_date =
operating_system = Cross-platform
programming_language = Java
genre = Library for multimedia
license =
website = http://java.sun.com/products/java-media/jmf/

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, playback, stream, and transcode multiple media formats, extends the Java Platform, Standard Edition (Java SE) and allows development of cross-platform multimedia applications.

Versions and Licensing

An 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. [ [http://java.sun.com/products/java-media/jmf/reference/faqs/index.html JMF FAQ] ] .

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 (file format) files, and shell scripts to launch four JMF-based applications:

* JMStudio - A simple player GUI
* JMFRegistry - A GUI for managing the JMF "registry," which manages preferences, plug-ins, etc.
* JMFCustomizer - Used for creating a JAR file that contains only the classes needed by a specific JMF application, which allows developers to ship a smaller application.
* JMFInit

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 and Windows (on SPARC). [ [http://java.sun.com/products/java-media/jmf/reference/faqs/index.html JMF FAQ] ]

Design Concepts

JMF abstracts the media it works with into DataSources (for media being read into JMF) and DataSinks (for data being exported out). It does not afford the developer significant access to the particulars of any given format; rather, media is represented as sources (themselves obtained from URL's) that can be read in and played, processed, and exported (though not all codecs support processing and transcoding).

A Manager class offers static methods that are the primary point-of-contact with JMF for applications.

Code Example

The 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. Manager.createRealizedPlayer() implicitly creates a DataSource from a URL representation of the file, creates a Player, and "realizes" it, meaning that all resources necessary for playback are allocated and initialized. The getVisualComponent() asks the Player for an AWT Component suitable for use in a GUI. If a control component were desired, it would be obtained with getControlPanelComponent() and added to the GUI separately. Note that the developer is not concerned with the format of the media - this code works equally well for any media format that JMF can import and read.

Criticism and Alternatives

Many JMF developers have complained that it supports few codecs and formats in modern use. 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. [ [http://java.sun.com/products/java-media/jmf/2.1.1/formats.html JMF 2.1.1 - Supported Formats] ] While the performance packs offer the ability to use the native platform's media library, they're only offered for Linux, Solaris and Windows. Furthermore, Windows-based JMF developers can unwittingly think JMF provides support for more formats than it does, and be surprised when their application is unable to play those formats on other platforms.

Another knock against JMF is Sun's seeming abandonment of it. The API has not been touched since 1999, and the last news item on JMF's home page was posted in November 2004.

While JMF is built for extensibility, there are few such third-party extensions.

Furthermore, editing functionality in JMF is effectively non-existent, which makes a wide range of potential applications impractical.

Alternatives

Depending on a developer's needs, several other libraries may be more suitable than JMF. These include:

* JavaSound
* QuickTime for Java
* [http://www.alphaworks.ibm.com/tech/tk4mpeg4 IBM Toolkit for MPEG-4]
* [http://jffmpeg.sourceforge.net/ Jffmpeg]
* [http://trac.videolan.org/jvlc jvlc]
* [http://code.google.com/p/gstreamer-java/ gstreamer-java]
* [http://fmj-sf.net FMJ]
* [http://www.fluendo.com/products.php?product=applet Fluendo's port of Theora to Java]
* [http://www.humatic.de/htools/dsj.htm Directshow <> Java Wrapper]
* [http://fobs.sourceforge.net/index.html Fobs4JMF]
* [http://www.javazoom.net/javalayer/javalayer.html JLayer MP3 library]

Using JMF in Webstart

Many users have reported difficulty in using JMF in applications through webstart to write media to the local disk. This is not necessarily a difficult task, just a very specific process.

First, make certain that the Java Media Framework has been installed properly according to the directions listed by sun for your operating system. This part is critical, if the JMFHOME, and CLASSPATH system variables are not set properly, the remaining steps will not work.

Second, run the JMFRegistry application, make certain "Allow File Writing For Applets" is checked, then click Commit. If an error was displayed in the console window, please revisit the first step and make sure that JMF is installed properly.

Third, run JMFCustomizer with the following command "java JMFCustomizer -p ". Select all the desired options, and create your own custom jmf.jar.

This jar contains the same registry settings that your development platform was configured with. Now all that remains is to sign it with the same key that the other jars in your application are signed with, and include it in your jnlp file.

See also

*QuickTime for Java

External links

* [http://java.sun.com/products/java-media/jmf/ Sun Microsystem's page on JMF]
* [http://archives.java.sun.com/archives/jmf-interest.html JMF-Interest, the official discussion list]
* [http://www.oreillynet.com/mac/blog/2005/12/jmf_a_mistake_asking_to_be_rem.html December 2005 discussion about a possible revival of JMF at Sun]
* [http://jffmpeg.sourceforge.net/ Jffmpeg: A JMF open-source plugin to support additional codecs]
* [http://fobs.sourceforge.net Fobs4JMF: Another JMF open source plugin to support additional codecs]
* [http://havaham2.blogspot.com/2006/05/jmf-on-os-x.html Installation Instructions for JMF on Mac OS X]
* [http://fmj-sf.net/ FMJ: An open-source replacement for/alternative to/implementation of JMF]

References


Wikimedia Foundation. 2010.

Игры ⚽ Нужно решить контрольную?

Look at other dictionaries:

  • Java Media Framework — o JMF (en español entorno de trabajo multimedia de Java) es una extensión de Java que permite la programación de tareas multimedia en este lenguaje de programación. Características Sus principales características son: Estabilidad debida a que… …   Wikipedia Español

  • Java Media Framework — JMF (Java Media Framework) ist eine Java Bibliothek zur Handhabung von Audio und Videodaten. Das API unterstützt das Aufnehmen von Mikrofon und Kamera und erlaubt das Einlesen und Speichern von Audio/Video Formaten. Inhaltsverzeichnis 1… …   Deutsch Wikipedia

  • Java (Plattform) — Die Java Plattform (englisch Java Platform) definiert die Ablaufumgebung (Java Virtual Machine) und Programmierschnittstellen (Java Application Programming Interface) innerhalb der Java Technologie. Der Kern der Java Plattform ist die Java… …   Deutsch Wikipedia

  • Java Platform, Standard Edition 6 — Die Java Plattform (englisch Java Platform) definiert die Ablaufumgebung (Java Virtual Machine) und Programmierschnittstellen (Java Application Programming Interface) innerhalb der Java Technologie. Der Kern der Java Plattform ist die Java… …   Deutsch Wikipedia

  • Java Plattform — Die Java Plattform (englisch Java Platform) definiert die Ablaufumgebung (Java Virtual Machine) und Programmierschnittstellen (Java Application Programming Interface) innerhalb der Java Technologie. Der Kern der Java Plattform ist die Java… …   Deutsch Wikipedia

  • Java Desktop System — Тип Среда рабочего стола Разработчик Sun Microsystems Операционная система Solaris Последняя версия JDS Release 3 Сайт www.sun.com/software/javadesktopsystem/ …   Википедия

  • Java-Plattform — Die Java Plattform (englisch Java Platform) definiert die Ablaufumgebung (Java Virtual Machine) und Programmierschnittstellen (Java Application Programming Interface) innerhalb der Java Technologie. Der Kern der Java Plattform ist die Java… …   Deutsch Wikipedia

  • Java Native Access — (JNA) ist eine Java Programmbibliothek für den Zugriff auf plattformspezifische ( native ) dynamische Programmbibliotheken (DLL in Windows). Hierbei muss im Unterschied zu JNI kein plattform spezifischer Code geschrieben werden. JNA ist in der… …   Deutsch Wikipedia

  • Java Foundation Classes — Die Java Foundation Classes (JFC) ist eine Sammlung von Programmierschnittstellen (APIs) für die Erstellung portabler Java Graphical User Interfaces (GUIs). Die Java Foundation Classes werden durch die folgenden Features definiert: Swing GUI… …   Deutsch Wikipedia

  • Java Desktop System — infobox software name = Java Desktop System caption = Solaris 10 with Java Desktop System developer = Sun Microsystems latest release version = latest release date = operating system = Solaris genre = Desktop environment language = Multilingual… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”