Platinum Partner
java

Video: Getting Started with JavaFX Media

A very simple demo, showing the absolutely simplest approach to creating a JavaFX media player in under 5 minutes.

For offline viewing, download it here.

The demo is, in fact, so simple that the end result isn't very useful. However, without going into any kind of detail, it gives you an understanding of the basic JavaFX concepts and you see a movie running at the end of it.

And here's all the code you end up with at the end of the demo:

package samplemovieplayer1;

import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.text.Text;
import javafx.scene.text.Font;
import javafx.scene.media.*;
import javafx.ext.swing.SwingButton;

var media = Media{
source:"http://capra.sfbay.sun.com/~jm158417/javafx_videos/big_buck_bunny_512x288_h264.flv"}

var player = MediaPlayer{
media:media,
autoPlay:false}

Stage {
title: "Application title"
width: 250
height: 250
scene: Scene {
content: [
MediaView {
mediaPlayer:player
}
SwingButton {
text: "Play"
action: function() {
player.play()
}
}
]
}
}

 

{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks
Tweet

{{parent.nComments}}