org.opensourcephysics.media.core
Class VideoClipControl

java.lang.Object
  extended by org.opensourcephysics.media.core.ClipControl
      extended by org.opensourcephysics.media.core.VideoClipControl
All Implemented Interfaces:
java.beans.PropertyChangeListener, java.util.EventListener

public class VideoClipControl
extends ClipControl

This is a ClipControl that uses the video itself for timing.

Version:
1.0
Author:
Douglas Brown

Field Summary
 
Fields inherited from class org.opensourcephysics.media.core.ClipControl
clip, looping, rate, stepNumber, support, timeStretch, video, videoFrameNumber
 
Constructor Summary
protected VideoClipControl(VideoClip videoClip)
          Constructs a VideoClipControl.
 
Method Summary
 void back()
          Steps back one step.
 void dispose()
          Removes this listener from the video so it can be garbage collected.
 int getFrameNumber()
          Gets the current frame number.
static XML.ObjectLoader getLoader()
          Returns an XML.ObjectLoader to save and load data for this class.
 double getMeanFrameDuration()
          Gets the mean frame duration in milliseconds.
 double getRate()
          Gets the play rate.
 int getStepNumber()
          Gets the step number.
 double getStepTime(int stepNumber)
          Gets the start time of the specified step measured from step 0.
 double getTime()
          Gets the current time in milliseconds measured from step 0.
 boolean isLooping()
          Gets the looping status.
 boolean isPlaying()
          Gets the playing status.
 void play()
          Plays the clip.
 void propertyChange(java.beans.PropertyChangeEvent e)
          Responds to property change events.
 void setFrameDuration(double duration)
          Sets the frame duration.
 void setLooping(boolean loops)
          Turns on/off looping.
 void setRate(double newRate)
          Sets the play rate.
 void setStepNumber(int n)
          Sets the step number.
 void step()
          Steps forward one step.
 void stop()
          Stops at the next step.
 
Methods inherited from class org.opensourcephysics.media.core.ClipControl
addPropertyChangeListener, addPropertyChangeListener, getControl, getVideoClip, removePropertyChangeListener, removePropertyChangeListener, setFrameNumber
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VideoClipControl

protected VideoClipControl(VideoClip videoClip)
Constructs a VideoClipControl.

Parameters:
videoClip - the video clip
Method Detail

play

public void play()
Plays the clip.

Overrides:
play in class ClipControl

stop

public void stop()
Stops at the next step.

Overrides:
stop in class ClipControl

step

public void step()
Steps forward one step.

Overrides:
step in class ClipControl

back

public void back()
Steps back one step.

Overrides:
back in class ClipControl

setStepNumber

public void setStepNumber(int n)
Sets the step number.

Overrides:
setStepNumber in class ClipControl
Parameters:
n - the desired step number

getStepNumber

public int getStepNumber()
Gets the step number.

Overrides:
getStepNumber in class ClipControl
Returns:
the current step number

setRate

public void setRate(double newRate)
Sets the play rate.

Overrides:
setRate in class ClipControl
Parameters:
newRate - the desired rate

getRate

public double getRate()
Gets the play rate.

Overrides:
getRate in class ClipControl
Returns:
the current rate

setLooping

public void setLooping(boolean loops)
Turns on/off looping.

Overrides:
setLooping in class ClipControl
Parameters:
loops - true to turn looping on

isLooping

public boolean isLooping()
Gets the looping status.

Overrides:
isLooping in class ClipControl
Returns:
true if looping is on

getFrameNumber

public int getFrameNumber()
Gets the current frame number.

Overrides:
getFrameNumber in class ClipControl
Returns:
the frame number

isPlaying

public boolean isPlaying()
Gets the playing status.

Specified by:
isPlaying in class ClipControl
Returns:
true if playing

getTime

public double getTime()
Gets the current time in milliseconds measured from step 0.

Specified by:
getTime in class ClipControl
Returns:
the current time

getStepTime

public double getStepTime(int stepNumber)
Gets the start time of the specified step measured from step 0.

Specified by:
getStepTime in class ClipControl
Parameters:
stepNumber - the step number
Returns:
the step time

setFrameDuration

public void setFrameDuration(double duration)
Sets the frame duration.

Specified by:
setFrameDuration in class ClipControl
Parameters:
duration - the desired frame duration in milliseconds

getMeanFrameDuration

public double getMeanFrameDuration()
Gets the mean frame duration in milliseconds.

Specified by:
getMeanFrameDuration in class ClipControl
Returns:
the frame duration in milliseconds

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent e)
Responds to property change events. VideoClipControl listens for the following events: "playing", "looping", "rate" and "framenumber" from Video.

Specified by:
propertyChange in interface java.beans.PropertyChangeListener
Overrides:
propertyChange in class ClipControl
Parameters:
e - the property change event

dispose

public void dispose()
Removes this listener from the video so it can be garbage collected.

Overrides:
dispose in class ClipControl

getLoader

public static XML.ObjectLoader getLoader()
Returns an XML.ObjectLoader to save and load data for this class.

Returns:
the object loader