Permalink
Browse files

Add VideoPlayer1 example.

  • Loading branch information...
1 parent 273e9de commit b95aa76c2348be078328d2b9c3119d8731115592 Jarek Sacha committed Dec 4, 2012
Showing with 28 additions and 0 deletions.
  1. BIN media/omgrobots.flv
  2. +28 −0 src/proscalafx/ch08/VideoPlayer1/VideoPlayer1.scala
View
Binary file not shown.
@@ -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()
+}

0 comments on commit b95aa76

Please sign in to comment.