All Packages Class Hierarchy This Package Previous Next Index
Class ejmf.toolkit.multiplayer.Track
java.lang.Object
|
+----ejmf.toolkit.multiplayer.Track
- public class Track
- extends Object
A Track maintains information on a Player over time.
It does this in two ways. First, it simply provides a
repository for Player data, such as start time and stop
stop time. Additionally, it does a 'look-ahead', moving
the Player to prefetched state, obtaining information that
is only valid at that point like duration and start latency.
By treating a Player as a Track, you don't have to worry
Player is in proper state to get that information.
The Player is moved into prefetched with a call to
setPlayer
. This method is called at construction
when the version of the constructor that takes a Player argument
is called.
Since Track does not implement ControllerListener, if you want a
track to be more active and listen to its Player, you will need to
subclass Track.
A Track may have a view associated with it. This is
typically a slider and can be set with setTrackSlider
method.
Each Track has a track number assigned upon creation.
-
Track(int)
- Create a track with an assigned track number.
-
Track(int, MediaLocator, Player)
- Create a Track from a Player, including its media file
(or string representation of URL).
-
close()
- Close Track.
-
createTrack(int, MediaLocator, double, double)
-
Create and return a Track from input values.
-
getDuration()
- Get the total duration of the media associated with this
track.
-
getLatency()
- Get start latency of Player associated with Track
-
getMediaLocator()
- Get media locator of Player associated with Track
-
getMediaURL()
- Get media file of Player associated with Track
-
getPlayer()
- Get Player associated with Track
-
getPlayingTime()
- Get playing time of Player associated with Track
-
getStartTime()
- Get start time of Player associated with Track
-
getState()
-
-
getTrackNumber()
- Get track number associated with Track
-
getTrackSlider()
- Get slider view.
-
isAssigned()
-
-
isAvailable()
- Tracks can be used for different Players.
-
setMediaLocator(MediaLocator)
- Set MediaLocator of Player associated with Track
-
setPlayer(Player)
- Assign a Player to this Track.
-
setPlayingTime(double)
- Set playing time of Player associated with Track
This is different than duration, ie.
-
setStartTime(double)
- Set start time of Player associated with Track
-
setState(int)
-
-
setTrackSlider(TrackSlider)
- Set slider view.
Track
public Track(int trackNumber,
MediaLocator ml,
Player player)
- Create a Track from a Player, including its media file
(or string representation of URL).
- Parameters:
- trackNumber - Assigned track number
- player - Player associated with Track
- fileName - Media file name of string representation of URL
Track
public Track(int trackNumber)
- Create a track with an assigned track number. Other relevant
data is set later.
- Parameters:
- trackNumber - Assigned track number
setPlayer
public void setPlayer(Player player)
- Assign a Player to this Track. The Player
is put in the Prefetch state so that it can
get from the Player all the info it needs about it.
The Player is moved to prefetched using StateWaiter's
blockingPrefetch.
If a Player is assigned to this track already, it
it is closed.
- Parameters:
- player - A javax.media.Player
- See Also:
- StateWaiter
close
public void close()
- Close Track. Stop and deallocate player if necessary,
finally, closing the Player.
getPlayer
public Player getPlayer()
- Get Player associated with Track
- Returns:
- A player associated with Track
getTrackNumber
public int getTrackNumber()
- Get track number associated with Track
- Parameters:
- the - index of Track
setMediaLocator
public void setMediaLocator(MediaLocator ml)
- Set MediaLocator of Player associated with Track
- Parameters:
- ml - MediaLocator of Player associated with Track
getMediaLocator
public MediaLocator getMediaLocator()
- Get media locator of Player associated with Track
- Returns:
- MediaLocator of Player associated with Track
getMediaURL
public URL getMediaURL()
- Get media file of Player associated with Track
- Returns:
- The URL associated with the Track's MediaLocator.
setPlayingTime
public void setPlayingTime(double seconds)
- Set playing time of Player associated with Track
This is different than duration, ie. it may be shorter.
- Parameters:
- seconds - Playing time in milliseconds
getPlayingTime
public double getPlayingTime()
- Get playing time of Player associated with Track
- Returns:
- Playing time in milliseconds
getDuration
public Time getDuration()
- Get the total duration of the media associated with this
track. This value can not be changed.
- Returns:
- A javax.media.Time object representing duration of Player
setStartTime
public void setStartTime(double startTime)
- Set start time of Player associated with Track
- Parameters:
- startTime - Offset in milliseconds at which Player
should be started.
getStartTime
public double getStartTime()
- Get start time of Player associated with Track
- Returns:
- Offset in milliseconds at which Player
is to be started.
getLatency
public long getLatency()
- Get start latency of Player associated with Track
- Returns:
- Startup latency of Player associated with this
track. If Player reports UNKNOWN, getLatency will report
zero.
isAvailable
public synchronized boolean isAvailable()
- Tracks can be used for different Players. This method
reports whether this Track is available for use. A
Track may is available after its close method is called.
Additionally, a Track may be created without an associated
Player. In that case also isAvailable returns true.
- Returns:
- true if Track is available.
isAssigned
public boolean isAssigned()
- Returns:
- true if this Track has a Player assigned to it.
setTrackSlider
public void setTrackSlider(TrackSlider trackSlider)
- Set slider view.
- Parameters:
- trackSlider - Display representation of Track
getTrackSlider
public TrackSlider getTrackSlider()
- Get slider view.
- Returns:
- Display representation of Track
setState
public void setState(int state)
getState
public int getState()
createTrack
public static Track createTrack(int i,
MediaLocator ml,
double startTime,
double playingTime) throws IOException, NoPlayerException
- Create and return a Track from input values.
- Parameters:
- i - The index of Track
- ml - The MediaLocator for locating Player
- startTime - start time offset in milliseconds
- playingTime - playing time in milliseconds
- Throws: IOException
- thrown if DataSource can not
be connected to.
- Throws: NoPlayerException
- thrown if no handler exists
for Player
All Packages Class Hierarchy This Package Previous Next Index