package simplevideoplayer;

import javafx.stage.Stage;
import javafx.scene.Scene;
import com.sun.fxmediacomponent.*;
import javafx.scene.Group;

var mediaUrl:String = "http://sun.edgeboss.net/download/sun/media/1460825906/1460825906_2956241001_big-buck-bunny-640x360.flv";
if(FX.getArgument("mediaURL")!=null) {
    mediaUrl = FX.getArgument("mediaURL").toString();
}
println("playing {mediaUrl}");

def vidWidth = 640;
def vidHeight = 360;

var mediaBox:MediaComponent = MediaComponent {

    // set the media and make the component visible
    mediaSourceURL : mediaUrl
    visible:true

    // the position and size of the media on screen
    translateX: 0
    translateY: 0
    mediaViewWidth : vidWidth
    mediaViewHeight: vidHeight

    // determines if the control bar is below the media or on top with a fade in
    staticControlBar: false

    // make the movie play as soon as it's loaded
    mediaPlayerAutoPlay: true

    // set the volume
    volume: 0.5
};


// Currently these variables have to be set after the component is created

// Description to be displayed when the mouse is over the component
mediaBox.mediaDescriptionStr = "A well-tempered rabbit finds his day spoiled by the rude actions of the...";
// Duration to be displayed when the mouse is over the component
mediaBox.mediaDurationStr = "9:56";
// Title to be displayed when the mouse is over the component
mediaBox.mediaTitleStr = "Big Buck Bunny";

Stage {
   title: "Simple Media Player"
   scene: Scene{
       width: vidWidth
       height: vidHeight
       content: mediaBox
       stylesheets: [
          MediaComponent.css_skins
      ]
   }
}