TOC Prev Next Players by associating them with the same TimeBase. To do this, you use the
getTimeBase and setTimeBase methods defined by the Clock interface. For
example, you could synchronize player1 with player2 by setting player1 to use
player2's time base:
When you synchronize Players by associating them with the sameTimeBase, you
must still manage the control of each Player individually. Because managing
synchronized Players in this way can be complicated, JMF provides a mechanism
that allows a Player to assume control over any Controller. The Player
manages the states of the controllers automatically, allowing you to interact with
the entire group through a single point of control. For more information, see
"Using a Player to Manage and Synchronize other Controllers" on page 29.
In a few situations, you might want to manage the synchronization of multiple
Players and keep track of
which ones have posted events. For example, when you prefetch the Players, you
need to keep track of which ones have posted PrefetchComplete events so that
you can be sure all of the Players are Prefetched before calling syncStart. Similarly,
when you request that the synchronized Players stop at a particular time,
you need to listen for the stop event posted by each Player to determine when all
of the Players have actually stopped.
In some situations, you need to be careful about responding to events posted by
the synchronized For example, assume that you are using one
PrefetchComplete events from all of the Players
before calling syncStart isn't sufficient. You can't tell whether those events
were posted in response to the first or second prefetch operation. To avoid this
problem, you can block when you call stop and wait for all of the Players to
post stop events before continuing. This guarantees that the next PrefetchComplete
events you receive are the ones that you are really interested in.
TOC Prev Next | |||||
|
| ||||||||||||