QUICK NAVIGATOR
PRODUCTS
TECHNOLOGIES
DEVELOPMENT TOOLS
* News
* Java Media Framework
* Intel Animation for Java
* Intel Spatial Audio for Java
* Runtime Software License
* SDK Software License
* System Requirements
* Download Area
* Documentation Online
* Gallery
* General FAQ
* Support Information

[INTEL NAVIGATION HEADER]

Java* Media Framework Tutorial - Lesson 3B

Managing Player States

The Player has four primary states — Unrealized, Realized, Prefetched, and Started. When the transition from one state to another is slow, the Player can be said to be in aA transitory state. There are two transitory states — Realizing and Prefetching.

Some methods require the Player to be in a given state. The Player will throw a MediaError if it is not in the required state when the method is called. For example, setTimeBase() requires the Player to be stopped. If the Player is started, it will throw a ClockStartedError.

Methods that require the Player to be Realized will allow later states: Prefetching, Prefetched and Started. These methods include:

getTimeBase(), setMediaTime(), setRate(), setStopTime(), getStartLatency(), getControlPanelComponent(), getGainControl(), getVisualComponent()

Methods which require the Player to be Prefetched:

setTimeBase(), syncStart()

Methods which require the Player to be Started:

mapToTimeBase()

Once the Player has been created, you can tell it to move to the Realized state by calling realize(). Since it may take a long time for the Player to Realize, the process is done asynchronously. This means that the Player will be in the Realizing state when the realize() call returns. Once the Player reaches the Realized state, it will send a RealizeCompleteEvent to all of the ControllerListeners.

For example, if an Applet wants to display a Player's visual component, it must wait until the Player is Realized before requesting the visual component. The example Applet requests the Player to realize() and then does a getVisualComponent() when the ControllerListener receives the RealizeCompleteEvent.

Player prefetch() and start() behave much like the realize() method. If prefetch() is called when the Player is Unrealized, then the Player will first become Realized, and only then move to the Prefetching state. This means that if prefetch() is called on an Unrealized Player, then the ControllerListener will receive a RealizeCompleteEvent and a PrefetchCompleteEvent.

Previous Lesson Tutorial Contents Next Lesson

View Source

 

This page was last updated on Feb 11th, 1997.

Legal Stuff

Free Web Hosting