All Packages Class Hierarchy This Package Previous Next Index
Class ejmf.toolkit.multiplayer.MultiPlayer
java.lang.Object
|
+----ejmf.toolkit.multiplayer.MultiPlayer
- public class MultiPlayer
- extends Object
- implements TrackModelListener, ControllerListener
Plays multiple players. The MultiPlayerControl strategy
associated with the MutliPlayer determines how the Players
are operated.
A MultiPlayer has a TrackList. Each member of the TrackList
can be thought of as a media track in the sense of an a/v
mixing board. Each track is a Track object and maintains
the Player reference, its start time and stop time.
If a MultiPlayer has a ViewingPanel associated with it,
a Player's GUI components are displayed.
A MultiPlayer can be used in conjunction with a TrackModel
and implements the TrackModelListener interface to listen
to changes to the TrackModel.
A MultiPlayer has one of four states: NOTINITIALIZED, INITIALIZED,
STARTED, STOPPED.
- See Also:
- TrackList, Track, MultiPlayerControl
-
INITIALIZED
- Control strategy has been associated with MultiPlayer
-
NOTINITIALIZED
- No control strategy associated with MultiPlayer
-
STARTED
- At least one of associated Players is started
-
STOPPED
- All Players have stopped.
-
MultiPlayer(MediaLocator[], MultiPlayerControl)
-
Create a MultiPlayer from an array of MediaLocators
-
MultiPlayer(String[], MultiPlayerControl)
-
Create a MultiPlayer from an array of media file names.
-
MultiPlayer(TrackList, MultiPlayerControl)
-
Create a MultiPlayer from a TrackList.
-
MultiPlayer(TrackModel, MultiPlayerControl)
- Create a MultiPlayer from a TrackModel.
-
addMultiPlayerListener(MultiPlayerListener)
- Add a MultiPlayerListener
-
close()
-
Shutdown all Players.
-
controllerUpdate(ControllerEvent)
- Track number of started Players, number of stopped
Players and fire a MultiPlayerUpdate event when all tracks
have been stopped or an error has occurred.
-
displayPlayers()
- Display all Player ViewScreens
-
fireMultiPlayerUpdate(int)
- Inform listeners of a state change to MultiPlayer
-
getState()
-
Get current state of MultiPlayer.
-
getTrackList()
-
Return the TrackList associated with MultiPlayer.
-
getViewingPanel()
- Return the ViewingPanel associated with this MultiPlayer.
-
query()
- A debugging hook for dumping contents of each Track
to the file.dbg.out.
-
removeMultiPlayerListener(MultiPlayerListener)
- Remove a MultiPlayerListener
-
rewind()
-
Rewind the MultiPlayer, settings the media time of all its
Player to zero.
-
setViewingPanel(ViewingPanel)
- Associate a ViewingPanel with this MultiPlayer for
display of Player GUI Components.
-
start()
-
Start all Players.
-
stateToString(int)
- Convert MultiPlayer state to a string.
-
stop()
- Stop all Players
-
trackModelUpdate(TrackModelEvent)
- Listen for changes to TrackModel
In response to every update, the MultiPlayerControl's
update method is called with a TrackModelEvent as an argument.
NOTINITIALIZED
public static final int NOTINITIALIZED
- No control strategy associated with MultiPlayer
INITIALIZED
public static final int INITIALIZED
- Control strategy has been associated with MultiPlayer
STARTED
public static final int STARTED
- At least one of associated Players is started
STOPPED
public static final int STOPPED
- All Players have stopped.
MultiPlayer
public MultiPlayer(String mediaFiles[],
MultiPlayerControl mpc)
- Create a MultiPlayer from an array of media file names.
- Parameters:
- mediaFiles - An array of media file names
- mpc - A MultiPlayerControl strategy.
MultiPlayer
public MultiPlayer(MediaLocator mls[],
MultiPlayerControl mpc)
- Create a MultiPlayer from an array of MediaLocators
- Parameters:
- mls - An array of MediaLocators
- mpc - A MultiPlayerControl strategy.
MultiPlayer
public MultiPlayer(TrackModel tm,
MultiPlayerControl mpc)
- Create a MultiPlayer from a TrackModel. This
constructor adds the MultiPlayer as a TrackModelListener.
The MultiPlayer's TackList is obtained from the TrackModel.
- Parameters:
- tm - A TrackModel
- mpc - A MultiPlayerControl strategy.
MultiPlayer
public MultiPlayer(TrackList tracks,
MultiPlayerControl mpc)
- Create a MultiPlayer from a TrackList.
- Parameters:
- tracks - A TrackList
- mpc - A MultiPlayerControl strategy.
getTrackList
public TrackList getTrackList()
- Return the TrackList associated with MultiPlayer.
- Returns:
- TrackList associated with this MultiPlayer.
setViewingPanel
public void setViewingPanel(ViewingPanel viewingPanel)
- Associate a ViewingPanel with this MultiPlayer for
display of Player GUI Components.
- Parameters:
- a - ejmf.toolkit.gui.ViewingPanel in which
player visual components are displayed.
getViewingPanel
public ViewingPanel getViewingPanel()
- Return the ViewingPanel associated with this MultiPlayer.
- Returns:
- ejmf.toolkit.gui.ViewPanel used for display of Players.
getState
public int getState()
- Get current state of MultiPlayer.
- Returns:
- current state of MultiPlayer
close
public synchronized void close()
- Shutdown all Players.
stop
public synchronized void stop()
- Stop all Players
rewind
public synchronized void rewind() throws MultiPlayerStateException
- Rewind the MultiPlayer, settings the media time of all its
Player to zero.
- Throws: MultiPlayerStateException
- If the MultiPlayer is in the STARTED state
or has not been initialized, a MultiPlayerStateException is thrown.
start
public synchronized void start()
- Start all Players.
displayPlayers
public void displayPlayers()
- Display all Player ViewScreens
fireMultiPlayerUpdate
protected void fireMultiPlayerUpdate(int state)
- Inform listeners of a state change to MultiPlayer
- Parameters:
- The - current state of the MultiPlayer.
addMultiPlayerListener
public void addMultiPlayerListener(MultiPlayerListener mpl)
- Add a MultiPlayerListener
- Parameters:
- a - MultiPlayerListener
- See Also:
- MultiPlayerListener
removeMultiPlayerListener
public void removeMultiPlayerListener(MultiPlayerListener mpl)
- Remove a MultiPlayerListener
- See Also:
- MultiPlayerListener
query
public void query()
- A debugging hook for dumping contents of each Track
to the file.dbg.out.
trackModelUpdate
public void trackModelUpdate(TrackModelEvent tme)
- Listen for changes to TrackModel
In response to every update, the MultiPlayerControl's
update method is called with a TrackModelEvent as an argument.
- Parameters:
- tme - A TrackModelEvent
- See Also:
- TrackModelEvent
controllerUpdate
public synchronized void controllerUpdate(ControllerEvent event)
- Track number of started Players, number of stopped
Players and fire a MultiPlayerUpdate event when all tracks
have been stopped or an error has occurred.
- Parameters:
- event - A ControllerEvent
stateToString
public static String stateToString(int state)
- Convert MultiPlayer state to a string.
- Parameters:
- The - current state of the MultiPlayer
- Returns:
- A String representing current state of MultiPlayer.
All Packages Class Hierarchy This Package Previous Next Index