Package org.opensourcephysics.media.core
Class VideoClipControl
java.lang.Object
org.opensourcephysics.display.OSPRuntime.Supported
org.opensourcephysics.media.core.ClipControl
org.opensourcephysics.media.core.VideoClipControl
- All Implemented Interfaces:
PropertyChangeListener,EventListener
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, loadedStepNumber, looping, PROPERTY_CLIPCONTROL_FRAMEDURATION, PROPERTY_CLIPCONTROL_LOOPING, PROPERTY_CLIPCONTROL_PLAYING, PROPERTY_CLIPCONTROL_RATE, PROPERTY_CLIPCONTROL_STEPNUMBER, rate, savedFrameDuration, stepNumber, timeSource, timeStretch, video, videoFrameNumber, videoVisible -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedVideoClipControl(VideoClip videoClip) Constructs a VideoClipControl. -
Method Summary
Modifier and TypeMethodDescriptionvoidback()Steps back one step.voiddispose()Removes this listener from the video so it can be garbage collected.intGets the current frame number.static XML.ObjectLoaderReturns an XML.ObjectLoader to save and load data for this class.doubleGets the mean frame duration in milliseconds.doublegetRate()Gets the play rate.intGets the step number.doublegetStepTime(int stepNumber) Gets the start time of the specified step measured from step 0.doublegetTime()Gets the current time in milliseconds measured from step 0.booleanGets the looping status.booleanGets the playing status.voidplay()Plays the clip.voidResponds to property change events.voidsetFrameDuration(double duration) Sets the frame duration.voidsetLooping(boolean loops) Turns on/off looping.voidsetRate(double newRate) Sets the play rate.voidsetStepNumber(int n) Sets the step number.voidstep()Steps forward one step.voidstop()Stops at the next step.Methods inherited from class org.opensourcephysics.media.core.ClipControl
getControl, getMeasuredRate, getTimeSource, getVideoClip, isTimeSource, setFrameNumber, setTimeSourceMethods inherited from class org.opensourcephysics.display.OSPRuntime.Supported
addListeners, addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListenerSafely, dispose, firePropertyChange, firePropertyChange, removeListeners, removePropertyChangeListener, removePropertyChangeListener
-
Constructor Details
-
VideoClipControl
Constructs a VideoClipControl.- Parameters:
videoClip- the video clip
-
-
Method Details
-
play
public void play()Plays the clip.- Overrides:
playin classClipControl
-
stop
public void stop()Stops at the next step.- Overrides:
stopin classClipControl
-
step
public void step()Steps forward one step.- Overrides:
stepin classClipControl
-
back
public void back()Steps back one step.- Overrides:
backin classClipControl
-
setStepNumber
public void setStepNumber(int n) Sets the step number.- Overrides:
setStepNumberin classClipControl- Parameters:
n- the desired step number
-
getStepNumber
public int getStepNumber()Gets the step number.- Overrides:
getStepNumberin classClipControl- Returns:
- the current step number
-
setRate
public void setRate(double newRate) Sets the play rate.- Overrides:
setRatein classClipControl- Parameters:
newRate- the desired rate
-
getRate
public double getRate()Gets the play rate.- Overrides:
getRatein classClipControl- Returns:
- the current rate
-
setLooping
public void setLooping(boolean loops) Turns on/off looping.- Overrides:
setLoopingin classClipControl- Parameters:
loops-trueto turn looping on
-
isLooping
public boolean isLooping()Gets the looping status.- Overrides:
isLoopingin classClipControl- Returns:
trueif looping is on
-
getFrameNumber
public int getFrameNumber()Gets the current frame number.- Overrides:
getFrameNumberin classClipControl- Returns:
- the frame number
-
isPlaying
public boolean isPlaying()Gets the playing status.- Specified by:
isPlayingin classClipControl- Returns:
trueif playing
-
getTime
public double getTime()Gets the current time in milliseconds measured from step 0.- Specified by:
getTimein classClipControl- Returns:
- the current time
-
getStepTime
public double getStepTime(int stepNumber) Gets the start time of the specified step measured from step 0.- Specified by:
getStepTimein classClipControl- Parameters:
stepNumber- the step number- Returns:
- the step time
-
setFrameDuration
public void setFrameDuration(double duration) Sets the frame duration.- Specified by:
setFrameDurationin classClipControl- Parameters:
duration- the desired frame duration in milliseconds
-
getMeanFrameDuration
public double getMeanFrameDuration()Gets the mean frame duration in milliseconds.- Specified by:
getMeanFrameDurationin classClipControl- Returns:
- the frame duration in milliseconds
-
propertyChange
Responds to property change events. VideoClipControl listens for the following events: "playing", "looping", "rate" and "framenumber" from Video.- Specified by:
propertyChangein interfacePropertyChangeListener- Overrides:
propertyChangein classClipControl- Parameters:
e- the property change event
-
dispose
public void dispose()Removes this listener from the video so it can be garbage collected.- Overrides:
disposein classClipControl
-
getLoader
Returns an XML.ObjectLoader to save and load data for this class.- Returns:
- the object loader
-