Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add VideoPlayer1 example.

  • Loading branch information...
commit b95aa76c2348be078328d2b9c3119d8731115592 1 parent 273e9de
Jarek Sacha authored
BIN  media/omgrobots.flv
View
Binary file not shown
28 src/proscalafx/ch08/VideoPlayer1/VideoPlayer1.scala
View
@@ -0,0 +1,28 @@
+package proscalafx.ch08.VideoPlayer1
+
+import java.io.File
+import scalafx.application.JFXApp
+import scalafx.scene.Scene
+import scalafx.scene.layout.StackPane
+import scalafx.scene.media.{Media, MediaPlayer, MediaView}
+import scalafx.stage.Stage
+
+
+/**
+ * @author Jarek Sacha
+ */
+object VideoPlayer1 extends JFXApp {
+
+ val file = new File("media/omgrobots.flv")
+ val media = new Media(file.toURI.toString)
+ val mediaPlayer = new MediaPlayer(media)
+ val mediaView = new MediaView(mediaPlayer)
+ val root = new StackPane {content = mediaView}
+
+ stage = new Stage {
+ title = "Video Player 1"
+ scene = new Scene(root, 960, 540)
+ }
+
+ mediaPlayer.play()
+}
Please sign in to comment.
Something went wrong with that request. Please try again.