FileDocCategorySizeDatePackage
MediaPlayer.javaAPI DocJMF 2.1.1e2733Mon May 12 12:20:50 BST 2003com.sun.media

MediaPlayer

public class MediaPlayer extends BasicPlayer
MediaPlayer extends BasicPlayer and uses PlaybackEngine to play media.

Fields Summary
protected PlaybackEngine
engine
Constructors Summary
public MediaPlayer()

	engine = new PlaybackEngine(this);
    
Methods Summary
protected booleanaudioEnabled()

	return engine.audioEnabled();
    
public javax.media.GainControlgetGainControl()
Obtain the gain control from the media engine.

	int state = getState();
	if (state < Realized) {
	    throwError(new NotRealizedError("Cannot get gain control on an unrealized player"));
	} 
	return engine.getGainControl();
    
protected javax.media.TimeBasegetMasterTimeBase()
Obtain the time base from the media engine.

	return engine.getTimeBase();
    
public longgetMediaNanoseconds()

	// When add controller is used, we want to use the
	// less accurate clock but still allows the time base
	// to take consideration of the slave controllers.
	// Otherwise, we'll use the more accurate engine time.
	if (controllerList.size() > 1)
	    return super.getMediaNanoseconds();
	else
	    return engine.getMediaNanoseconds();
    
public javax.media.TimegetMediaTime()
Obtain media time directly from the engine.

	// When add controller is used, we want to use the
	// less accurate clock but still allows the time base
	// to take consideration of the slave controllers.
	// Otherwise, we'll use the more accurate engine time.
	if (controllerList.size() > 1)
	    return super.getMediaTime();
	else
	    return engine.getMediaTime();
    
public java.awt.ComponentgetVisualComponent()
Obtain the visiual component from the media engine.

	/**
	 * Call the superclass method to ensure that restrictions
	 * on player methods are enforced
	 */
	super.getVisualComponent();
	return engine.getVisualComponent();
    
public voidsetProgressControl(com.sun.media.controls.ProgressControl p)

	engine.setProgressControl(p);
    
public voidsetSource(javax.media.protocol.DataSource source)

	// Ask the engine to verify the source.
	engine.setSource(source);

	// Put the media engine under the management of this player.
	// BasicPlayer will be responsible to transition the engine
	// to the realized state.
	manageController(engine);

	super.setSource(source);
    
public voidupdateStats()

	engine.updateRates();
    
protected booleanvideoEnabled()

	return engine.videoEnabled();