JavaFX Media: Platform, Format, and RTSP Support

This document lists the platforms and media engines supported by JavaFX Media, along with the video and audio codecs that can be used in JavaFX applications. This document also clarifies which platforms support Real-Time Streaming Protocol (RTSP) and provides recommendations for enabling streaming media in JavaFX applications.

Supported Platforms

JavaFX Media functionality consists of two components: a platform-independent layer of JavaFX APIs that enable developers to create applications for multiple devices, and a platform-dependent implementation of the media engine.

Two Components of JavaFX Media Figure 1


The platform-independent component is a set of APIs that are part of the JavaFX SDK. The platform-specific part is the implementation of the APIs for the particular platform.

The following platforms are supported by JavaFX Media:

Operating System JRE Version Browser
Windows XP, Vista JRE 1.6.x Internet Explorer 6, Internet Explorer 7, Internet Explorer 8, FireFox 3
Mac Mac OS X 10.4, 10.5 JDK 1.5 for applets and JDK 1.6 for stand-alone applications Safari, FireFox 3
Linux[*] Ubuntu 8.04 JRE 1.6.x FireFox 3
Solaris[*] OpenSolaris 2009.06 JRE 1.6.x FireFox 3

Supported Media Codecs

The following table shows the media engines supported by the JavaFX Media functionality as well as video and audio codecs that can be used in JavaFX applications.

Cross-Platform Windows XP and Vista Mac OS X 10.4 and 10.5 Ubuntu 8.04 and OpenSolaris 2009.06[*]
Media Engine Cross-platform engine for FLV playback DirectShow Core Video GStreamer
Video Codecs On2 VP6 All the codecs supported by Windows Media Player All the codecs supported by Mac through Core Video All the codecs supported by GStreamer.
Audio MP3 playback on all platforms including desktop and mobile All the audio formats supported by Windows Media Player All the audio formats listed in QuickTime specification for Mac OS All the audio formats supported by GStreamer.
Reference Information On2 VP6 for Adobe Flash Player and JavaFX. Multimedia File Types that Windows Media Player Supports. Getting Started With QuickTime

QuickTime Specification
GStreamer Documentation

The FLV container is supported by the media stack on all JavaFX platforms. A single movie encoded in this format works seamlessly on Windows, Mac, Linux, Solaris, and operating systems for mobile devices. Standard FLV mime settings are required on the server side to enable media streaming.

Because the major supported media engines are DirectShow, Core Video, and GStreamer, most of the features supported by these engines on the given operating system are provided for free, including the following:

  • VP6+MP3 using FLV container
  • MP3 for audio
  • HTTP, file protocol support
  • Progressive download
  • Seeking
  • Buffer progress
  • Playback functions (Play, Pause, Mute, Balance, Volume)

The set of supported features and codecs for the mobile devices depends on the particular operating system installed. For example, Windows mobile OS supports WMV, 3GP, MP4, and MP3 formats. However, other operating systems might not support these codecs.

Supported Media Tools

The FLV, MOV, MP4, and WMV media files generated by the following tools have been tested with the JavaFX platform:

  • On2 Flix
  • Adobe Premier Pro CS4
  • Telestream Episode Pro
  • Sorenson Squeeze 5 for Flash Pro
  • Apple Final Cut Pro
  • Telestream Flip4Mac WMV

Recommended Resolution and Frame Rates

The following resolution parameters are recommended for applets and applications with animation.

  • Applications with graphics
    • 320x240
    • 480x270
    • 640x480
  • Applications without graphics: 720p

The recommended frame rates are in the range of 16 through 30 fps.

Media Deployment

JavaFX Media applications can be deployed by all the standard means available on the JavaFX platform. Refer to the following documents for more information about different deployment models:

RTSP Support

Available in JavaFX SDK since the 1.2 version, Real-Time Streaming Protocol (RTSP) enables applications to communicate with RTSP servers and incorporate media from streaming media servers. The following table shows the levels of RTSP support available on different platforms.

Media Source

Windows Platform Mac OS X Linux Platform[*]
Windows Server 2008 - Enterprise Edition, WMV Format playing not playing not playing
Windows Server 2008 - Enterprise Edition, MP3 Format playing not playing not playing
QuickTime Streaming Server/Darwin Streaming Server not playing playing not playing

playing - Functionality is supported not playing - Functionality is not supported

Live streaming media format is not supported on any of the platforms mentioned in the previous table.

To play back the streaming media files in your JavaFX application, specify the source URL as follows:

 rtsp://host:port/mediafile 

If the port number is omitted the default RTSP port 554 is used. The following code fragment constructs a simple embedded media player.

Source Code
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.media.*;

Stage {
   title: "Media test"
   width: 250
   height: 80
   scene: Scene {
       content: [
          MediaView{
              fitWidth: 200
              preserveRatio: true
              mediaPlayer: MediaPlayer{
                  autoPlay: true
                  media: Media{source: "rtsp://<media server>/myVideo.wmv"}
              }
          }
       ]
   }
} 

Tip: Use the bufferProgressTime instance variable of the MediaPlayer class for a bufferred media stream to obtain the following:

  • Position of the current buffer
  • Indication of how much media can be played without stalling the MediaPlayer object

Unsupported Formats and Features

The following features are not supported on desktop devices:

  • Sorenson FLV (most of YouTube)
  • SWF (Flash)
  • MPEG-4 or MOV on Windows
  • WMV on Mac
  • Third-party plugin

Related Topics

Refer to the related How-To topics to learn more about media functionality in the JavaFX SDK:

[*] Media capabilities for JavaFX are still in development (or Alpha) on Ubuntu Linux and OpenSolaris.