MediaBox (1): Hello MediaBox!

JavaFX 1.2 SDK comes with the MediaBox sample. It can be tried out from the JavaFX samples website as well. It replaced the old SimleVideoPlayer sample and its dependent library, mediacomponent.jar (the source wasn't available in public) in JavaFX 1.1 release. MediaBox comes with fully opened sources and is currently used to play the JavaFX launching videos.

MediaBox is not just a sample that replaced the SimpleVideoPlayer. Here are some different usecases of MediaBox with JavaFX 1.2.

Media UI Controls

MediaBox has the following UI Controls that are extended from javafx.scene.control.Control. It would have more media controls over the time.

Basic UI Controls:

  • PlayControl: A toggle button with media play and pause.
  • MediaSlider: A media progress bar that has 2 time positions, one for the current time and other for the buffer time.
  • MediaTime: A configurable media time data label with either the elapsed time or the remaining time.
  • SpeakerControl: A toggle button that turns on and off speaker volume.
  • VolumeControl: A volume slider.
  • BufferIndicator: A spinning buffer indicator. It centers on the MediaScreen control.
  • MediaInfo: A media information pane that contains media title, description and media duration information. It rolls down when a mouse enter the MediaScreen control by default.
  • ErrorInfo: A media information pane that shows an error information when something failed. When it happens it overlaps on the top of the MediaScreen control.

Compound UI Controls:

  • MediaControlBar: A Compound UI Control that contains individual PlayControl, MediaSlider, MediaTime, SpeakerControl, VolumeControl and BufferIndicator controls.
  • MediaScreen: A Compound UI Control that contains MediaView node, MediaInfo and ErrorInfo controls.

MediaBox Node:

  • MediaBox: It's not a UI Control but simply a FX Scene Graph node that contains both MediaScreen and MediaControlBar compound UI Controls. 

Hello MediaBox!

The easiest way to use MediaBox can be illustrated in the following hello world example:

Stage {
    scene: Scene {
        content: MediaBox {
            mediaSourceURL: "http://a.server.com/your_media"
        }
    }
}

You will get this pre-fabricated media player with only a few lines:


I plan to write a few more series of MediaBox blogs.
See you later.


Comments:

Hi,

this has been very useful, thank you. Do you plan to add fullscreen support? Do you know if there is a newer version of the control? maybe in a subversion or cvs repository..

thanks again,
luca

Posted by luca on October 15, 2009 at 12:44 AM PDT #

Hi I am a student interested in JavaFX, I need to make Media player which may play my on encrypted video files. Please help me...

Posted by Renju on May 10, 2010 at 01:39 PM PDT #

hi everybody,
How to play two mediaview together on Scene with a Group control : play, pause, stop, volume . I try but cannot adjust Group with once mediaview .
help me , please

Posted by Truong on March 22, 2011 at 05:18 PM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Hello,
I am Baechul and live in Santa Clara, U.S.A. This is my blog that will talk about Java and JavaFX technologies.

Search

Top Tags
Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today