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

Variable Index

 o INITIALIZED
Control strategy has been associated with MultiPlayer
 o NOTINITIALIZED
No control strategy associated with MultiPlayer
 o STARTED
At least one of associated Players is started
 o STOPPED
All Players have stopped.

Constructor Index

 o MultiPlayer(MediaLocator[], MultiPlayerControl)
Create a MultiPlayer from an array of MediaLocators
 o MultiPlayer(String[], MultiPlayerControl)
Create a MultiPlayer from an array of media file names.
 o MultiPlayer(TrackList, MultiPlayerControl)
Create a MultiPlayer from a TrackList.
 o MultiPlayer(TrackModel, MultiPlayerControl)
Create a MultiPlayer from a TrackModel.

Method Index

 o addMultiPlayerListener(MultiPlayerListener)
Add a MultiPlayerListener
 o close()
Shutdown all Players.
 o 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.
 o displayPlayers()
Display all Player ViewScreens
 o fireMultiPlayerUpdate(int)
Inform listeners of a state change to MultiPlayer
 o getState()
Get current state of MultiPlayer.
 o getTrackList()
Return the TrackList associated with MultiPlayer.
 o getViewingPanel()
Return the ViewingPanel associated with this MultiPlayer.
 o query()
A debugging hook for dumping contents of each Track to the file.dbg.out.
 o removeMultiPlayerListener(MultiPlayerListener)
Remove a MultiPlayerListener
 o rewind()
Rewind the MultiPlayer, settings the media time of all its Player to zero.
 o setViewingPanel(ViewingPanel)
Associate a ViewingPanel with this MultiPlayer for display of Player GUI Components.
 o start()
Start all Players.
 o stateToString(int)
Convert MultiPlayer state to a string.
 o stop()
Stop all Players
 o 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.

Variables

 o NOTINITIALIZED
 public static final int NOTINITIALIZED
No control strategy associated with MultiPlayer

 o INITIALIZED
 public static final int INITIALIZED
Control strategy has been associated with MultiPlayer

 o STARTED
 public static final int STARTED
At least one of associated Players is started

 o STOPPED
 public static final int STOPPED
All Players have stopped.

Constructors

 o 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.
 o 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.
 o 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.
 o MultiPlayer
 public MultiPlayer(TrackList tracks,
                    MultiPlayerControl mpc)
Create a MultiPlayer from a TrackList.

Parameters:
tracks - A TrackList
mpc - A MultiPlayerControl strategy.

Methods

 o getTrackList
 public TrackList getTrackList()
Return the TrackList associated with MultiPlayer.

Returns:
TrackList associated with this MultiPlayer.
 o 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.
 o getViewingPanel
 public ViewingPanel getViewingPanel()
Return the ViewingPanel associated with this MultiPlayer.

Returns:
ejmf.toolkit.gui.ViewPanel used for display of Players.
 o getState
 public int getState()
Get current state of MultiPlayer.

Returns:
current state of MultiPlayer
 o close
 public synchronized void close()
Shutdown all Players.

 o stop
 public synchronized void stop()
Stop all Players

 o 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.
 o start
 public synchronized void start()
Start all Players.

 o displayPlayers
 public void displayPlayers()
Display all Player ViewScreens

 o fireMultiPlayerUpdate
 protected void fireMultiPlayerUpdate(int state)
Inform listeners of a state change to MultiPlayer

Parameters:
The - current state of the MultiPlayer.
 o addMultiPlayerListener
 public void addMultiPlayerListener(MultiPlayerListener mpl)
Add a MultiPlayerListener

Parameters:
a - MultiPlayerListener
See Also:
MultiPlayerListener
 o removeMultiPlayerListener
 public void removeMultiPlayerListener(MultiPlayerListener mpl)
Remove a MultiPlayerListener

See Also:
MultiPlayerListener
 o query
 public void query()
A debugging hook for dumping contents of each Track to the file.dbg.out.

 o 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
 o 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
 o 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