Over a million developers have joined DZone.

Video: Getting Started with JavaFX Media

· Java Zone

Learn more about Kotlin, a new programming language designed to solve problems that software developers face every day brought to you in partnership with JetBrains.

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{

var player = MediaPlayer{

Stage {
title: "Application title"
width: 250
height: 250
scene: Scene {
content: [
MediaView {
SwingButton {
text: "Play"
action: function() {


The Java Zone is brought to you in partnership with JetBrains.  Discover how powerful static code analysis and ergonomic design make development not only productive but also an enjoyable experience.


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

{{ parent.tldr }}

{{ parent.urlSource.name }}