* URL naming a media source
*/
public void begin() {
playerpanel = getPlayerPanel();
player = playerpanel.getPlayer();
StateWaiter waiter = new StateWaiter(player);
// Add ourselves as a listener to the player's events
player.addControllerListener(this);
// Wait for the Player to realize, then add the components
if (!waiter.blockingRealize()) {
System.err.println("Can't realize Player");
return;
}
Runnable r = new Runnable() {
public void run() {
scp = new StandardControlPanel(player,
AbstractControlPanel.USE_START_CONTROL |
AbstractControlPanel.USE_STOP_CONTROL);
JButton startButton = new JButton("Start");
scp.setStartButton(startButton);
JButton stopButton = new JButton("Stop");
stopButton.setEnabled(false);
scp.setStopButton(stopButton);
playerpanel.addControlComponent(scp);
playerpanel.addVisualComponent();
redraw();
}
};
try {
SwingUtilities.invokeAndWait(r);
} catch (Exception e) {
e.printStackTrace();
}
if (!waiter.blockingPrefetch()) {
System.err.println("Can't prefetch Player");
return;
}
}