FileDocCategorySizeDatePackage
MediaPlayer.javaAPI DocExample907Sat Apr 23 22:35:40 BST 2005None

MediaPlayer

public class MediaPlayer extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

		final JFrame frame = new JFrame("MediaPlayer");
		frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
		URL url = new URL( args[0] );
		final Player player = Manager.createPlayer( url );


		player.addControllerListener( new ControllerListener() {
			public void controllerUpdate( ControllerEvent ce ) {
				if ( ce instanceof RealizeCompleteEvent ) 
				{
					Component visual = player.getVisualComponent();
					Component control = player.getControlPanelComponent();
					if ( visual != null ) 
						frame.getContentPane().add( visual, "Center" );
					frame.getContentPane().add( control, "South" );
					frame.pack();
					frame.setVisible( true );
					player.start();
				}
			}
		});

		player.realize();