org.opensourcephysics.media.core
Interface Playable

All Known Subinterfaces:
Video
All Known Implementing Classes:
GifVideo, ImageVideo, VideoAdapter

public interface Playable

This defines methods used to control time-based media.

Version:
1.0
Author:
Douglas Brown

Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Adds a PropertyChangeListener to this object.
 void addPropertyChangeListener(java.lang.String property, java.beans.PropertyChangeListener listener)
          Adds a PropertyChangeListener to this object.
 double getDuration()
          Gets the duration of the media.
 double getEndTime()
          Gets the end time in milliseconds.
 double getRate()
          Gets the rate at which the media plays relative to its normal rate.
 double getStartTime()
          Gets the start time in milliseconds.
 double getTime()
          Gets the current media time in milliseconds.
 void goToEnd()
          Sets the time to the end time.
 void goToStart()
          Sets the time to the start time.
 boolean isLooping()
          Gets the looping behavior of the media.
 boolean isPlaying()
          Gets whether the media is playing.
 void play()
          Plays the media.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Removes a PropertyChangeListener from this object.
 void removePropertyChangeListener(java.lang.String property, java.beans.PropertyChangeListener listener)
          Removes a PropertyChangeListener from this object.
 void reset()
          Resets the media.
 void setEndTime(double millis)
          Sets the end time in milliseconds.
 void setLooping(boolean looping)
          Sets the looping behavior of the media.
 void setPlaying(boolean playing)
          Starts and stops the media.
 void setRate(double rate)
          Sets the rate at which the media plays relative to its normal rate.
 void setStartTime(double millis)
          Sets the start time in milliseconds.
 void setTime(double millis)
          Sets the media time in milliseconds.
 void stop()
          Stops the media.
 

Method Detail

play

void play()
Plays the media.


stop

void stop()
Stops the media.


reset

void reset()
Resets the media.


getTime

double getTime()
Gets the current media time in milliseconds.

Returns:
the current time in milliseconds

setTime

void setTime(double millis)
Sets the media time in milliseconds.

Parameters:
millis - the desired time in milliseconds

getStartTime

double getStartTime()
Gets the start time in milliseconds.

Returns:
the start time in milliseconds

setStartTime

void setStartTime(double millis)
Sets the start time in milliseconds.

Parameters:
millis - the desired start time in milliseconds

getEndTime

double getEndTime()
Gets the end time in milliseconds.

Returns:
the end time in milliseconds

setEndTime

void setEndTime(double millis)
Sets the end time in milliseconds.

Parameters:
millis - the desired end time in milliseconds

goToStart

void goToStart()
Sets the time to the start time.


goToEnd

void goToEnd()
Sets the time to the end time.


getDuration

double getDuration()
Gets the duration of the media.

Returns:
the duration of the media in milliseconds

getRate

double getRate()
Gets the rate at which the media plays relative to its normal rate.

Returns:
the relative play rate. A rate of 1.0 plays at the normal rate.

setRate

void setRate(double rate)
Sets the rate at which the media plays relative to its normal rate.

Parameters:
rate - the relative play rate. A rate of 1.0 plays at the normal rate.

setPlaying

void setPlaying(boolean playing)
Starts and stops the media.

Parameters:
playing - true starts the media, and false stops it

isPlaying

boolean isPlaying()
Gets whether the media is playing.

Returns:
true if the media is playing

setLooping

void setLooping(boolean looping)
Sets the looping behavior of the media. When true, the media restarts when reaching the end.

Parameters:
looping - true if the media is looping

isLooping

boolean isLooping()
Gets the looping behavior of the media. When true, the video restarts when reaching the end.

Returns:
true if the media is looping

addPropertyChangeListener

void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener to this object.

Parameters:
listener - the listener requesting property change notification

addPropertyChangeListener

void addPropertyChangeListener(java.lang.String property,
                               java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener to this object.

Parameters:
property - the name of the property of interest to the listener
listener - the listener requesting property change notification

removePropertyChangeListener

void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a PropertyChangeListener from this object.

Parameters:
listener - the listener requesting removal

removePropertyChangeListener

void removePropertyChangeListener(java.lang.String property,
                                  java.beans.PropertyChangeListener listener)
Removes a PropertyChangeListener from this object.

Parameters:
property - the name of the property of interest to the listener
listener - the listener requesting removal