Wednesday Nov 12, 2008

Message to developers

Here is a demonstration of the power of the JavaFX platform. We are still fixing some issues, so the clip will only play if you are within Sun's internal network an it will only play on the Mac since the clip is encoded as mp4. 

Media player - written in JavaFX Script

<script src="http://jfx.sfbay.sun.com/hudson/job/javafx1.0/label=macosx-universal/776/artifact/build/macosx-universal/release/javaws/dtfx.js"></script> <script> javafx( { archive: "http://blogs.sun.com/octav/resource/SimpleVideoPlayer.jar", width: 530, height: 305, code: "simplevideoplayer.Main", name: "SimpleVideoPlayer" } ); </script> Below is the code of the JavaFX applet that creates the video player. This sample is bundled with NetBeans 6.5, the upcoming  distribution that  has support for JavaFX Script.
package simplevideoplayer;

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

def mediaUrl:String =
    "http://sun.edgeboss.net/download/sun/09b01806/09b01806_00.mp4";
println("using mediaUrl = {mediaUrl}");
var vidWidth = 512;
var vidHeight = 288;
var fullWidth = 700;
var fullHeight = 400;

var mediaBox:MediaComponent = MediaComponent {
    
    // set the media and make the component visible
    mediaSourceURL : bind mediaUrl
    visible:true

    // the position and size of the media on screen
    mediaX: (fullWidth-vidWidth)/2 // center
    mediaY: (fullHeight-vidHeight)/2 // center
    mediaViewWidth : vidWidth
    mediaViewHeight: vidHeight
    mediaVisible: true

    // determines if the control bar is visible at all
    controlBarVisible: true

    // determines if the control bar is below the media or on top 
    staticControlBar: false
    
    // the position of the scroll bar.
    //leave as the defaults to have it be below the media
    //controlBarX: -1
    //controlBarY: -1

    // set the size for full screen.
    fullScreenWidth: fullWidth
    fullScreenHeight: fullHeight
    
    // make the movie play as soon as it's loaded
    mediaPlayerAutoPlay: true

    // set the volume
    volume: 0.5
};

Stage {
   title: "Simple Media Player"
   scene: Scene{
       width: fullWidth
       height: fullHeight
       content: mediaBox
   }
}
About

octav

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today