Package org.opensourcephysics.media.mov
Class JSMovieVideo
java.lang.Object
org.opensourcephysics.display.OSPRuntime.Supported
org.opensourcephysics.media.core.VideoAdapter
org.opensourcephysics.media.mov.MovieVideo
org.opensourcephysics.media.mov.JSMovieVideo
- All Implemented Interfaces:
PropertyChangeListener
,EventListener
,Drawable
,Interactive
,Measurable
,AsyncVideoI
,DrawableImage
,InteractiveImage
,Trackable
,Video
This is a video that uses HTML5/JS to read mp4, mov, and other movie video formats.
status: Only fleshed in; not implemented.
- Author:
- rhanson
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
A class to save and load JSMovieVideo data. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected int
Fields inherited from class org.opensourcephysics.media.mov.MovieVideo
allowControlData, control, fileName, frameRateMaximum, frameRateMinimum, frameTimes, isExport, isLocal, isVariableFrameRate, nominalFrameRate, path, PLATFORM_JAVA, PROPERTY_VIDEO_PROGRESS, PROPERTY_VIDEO_STALLED, rawDuration, rawFrameCount, TIME_SLOP_MS, url
Fields inherited from class org.opensourcephysics.media.core.VideoAdapter
aspects, baseDir, bufferedImage, clearRaster, coords, displayedSize, endFrameNumber, filteredImage, filterStack, frameCount, frameNumber, isMeasured, isValidFilteredImage, isValidImage, isValidMeasure, looping, maxX, maxY, minX, minY, mouseEnabled, playing, properties, rate, rawImage, size, startFrameNumber, startTimesMS, visible, widthDominates
Fields inherited from interface org.opensourcephysics.media.core.AsyncVideoI
PROPERTY_ASYNCVIDEOI_HAVEFRAMES, PROPERTY_ASYNCVIDEOI_IMAGEREADY, PROPERTY_ASYNCVIDEOI_READY
Fields inherited from interface org.opensourcephysics.media.core.Trackable
PROPERTY_ADJUSTING
Fields inherited from interface org.opensourcephysics.media.core.Video
PROPERTY_VIDEO_COORDS, PROPERTY_VIDEO_ENDFRAME, PROPERTY_VIDEO_FILTERCHANGED, PROPERTY_VIDEO_FRAMENUMBER, PROPERTY_VIDEO_IMAGE, PROPERTY_VIDEO_LOOPING, PROPERTY_VIDEO_NEXTFRAME, PROPERTY_VIDEO_PLAYING, PROPERTY_VIDEO_RATE, PROPERTY_VIDEO_SIZE, PROPERTY_VIDEO_VIDEOVISIBLE
-
Method Summary
Modifier and TypeMethodDescriptionvoid
cantRead()
protected void
Plays the next time-appropriate frame at the current rate.static File
createThumbnailFile
(Dimension defaultThumbnailDimension, String sourcePath, String thumbPath) void
dispose()
Disposes of this video.protected void
double
Gets the duration of the media, including a time for the last frame From XuggleVideo code, now also for JSMovieVideogetImage()
Gets the current video image after applying enabled filters.protected BufferedImage
getImageForMSTimePoint
(double timeMS) int
static XML.ObjectLoader
Returns an XML.ObjectLoader to save and load JSMovieVideo data.protected String
Get this platform's nameint
getProperty
(String name) Gets a user property of the video.Returns the VideoType name of this video.void
play()
Plays the video at the current rate.protected boolean
seekMS
(double timeMS) seek to a time in milliseconds.protected void
setFrameCount
(int n) void
setFrameNumber
(int n) Sets the frame number.void
setFrameNumberContinued
(int n, double t) void
setRate
(double rate) Sets the relative play rate.void
stop()
Stops the video.Methods inherited from class org.opensourcephysics.media.mov.MovieVideo
getFrameNumberBefore, setFromControl, setFromMediaTrackInfo, setStartTimes
Methods inherited from class org.opensourcephysics.media.core.VideoAdapter
back, draw, finalize, findInteractive, findMinMaxValues, getAbsolutePath, getAngle, getCoords, getEndFrameNumber, getEndTime, getFilterStack, getFrameCount, getFrameDuration, getFrameNumber, getFrameTime, getHeight, getImageSize, getPropertyNames, getRate, getRawBufferedImage, getRelativeAspect, getStartFrameNumber, getStartTime, getWidth, getX, getXMax, getXMin, getY, getYMax, getYMin, goToEnd, goToStart, initialize, invalidateVideoAndFilter, isEnabled, isLooping, isMeasured, isPlaying, isVisible, notifyFrame, notifySize, propertyChange, refreshBufferedImage, reset, setAngle, setCoords, setEnabled, setEndFrameNumber, setEndTime, setFilterStack, setFrameAngle, setFrameHeight, setFrameRelativeAspect, setFrameWidth, setFrameX, setFrameXY, setFrameY, setHeight, setLooping, setNotify, setPlaying, setProperty, setRelativeAspect, setStartFrameNumber, setStartTime, setVisible, setWidth, setX, setXY, setY, step, updateBufferedImage
Methods inherited from class org.opensourcephysics.display.OSPRuntime.Supported
addListeners, addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListenerSafely, dispose, firePropertyChange, firePropertyChange, removeListeners, removePropertyChangeListener, removePropertyChangeListener
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.opensourcephysics.display.Interactive
isInteractive
Methods inherited from interface org.opensourcephysics.media.core.Video
addListener, addPropertyChangeListener, addPropertyChangeListener, getAverageFrameDuration, getAverageFrameRate, getOutliers, isValid, removeListener, removePropertyChangeListener, removePropertyChangeListener
-
Field Details
-
err
-
progress
protected int progress -
mediaInfo
-
-
Method Details
-
getProperty
Description copied from class:VideoAdapter
Gets a user property of the video. May return null.- Specified by:
getProperty
in interfaceDrawableImage
- Overrides:
getProperty
in classVideoAdapter
- Parameters:
name
- the name of the property- Returns:
- the value of the property
-
play
public void play()Plays the video at the current rate. Overrides VideoAdapter method. -
stop
public void stop()Stops the video. -
getImage
Description copied from class:VideoAdapter
Gets the current video image after applying enabled filters.- Specified by:
getImage
in interfaceDrawableImage
- Overrides:
getImage
in classVideoAdapter
- Returns:
- the current video image with filters applied
-
setFrameNumber
public void setFrameNumber(int n) Sets the frame number. Overrides VideoAdapter setFrameNumber method.- Specified by:
setFrameNumber
in interfaceVideo
- Overrides:
setFrameNumber
in classVideoAdapter
- Parameters:
n
- the desired frame number- See Also:
-
setFrameNumberContinued
public void setFrameNumberContinued(int n, double t) -
getFrameCountDurationMS
public double getFrameCountDurationMS()Description copied from interface:Video
Gets the duration of the media, including a time for the last frame From XuggleVideo code, now also for JSMovieVideo// ....[0][1][2]...[startFrame][i]...[j][endFrame]...[frameCount-1] // ....|--------frameCountDurationMS--(nframes * aveDuration)-----| // ....^..^..^..^..^...........^..^..^..^.........^..^ startTimes[i] // ............................|--| frameDuration[i] // ..................................................|------------| // ..................................................frameDuration[frameCoumt-1] // ....|-------------video-specified rawDuration------------------|
- Specified by:
getFrameCountDurationMS
in interfaceVideo
- Returns:
- the duration of the media in milliseconds or -1 if no video, or 100 if one frame
-
setRate
public void setRate(double rate) Sets the relative play rate. Overrides VideoAdapter method.- Specified by:
setRate
in interfaceVideo
- Overrides:
setRate
in classVideoAdapter
- Parameters:
rate
- the relative play rate.
-
dispose
public void dispose()Disposes of this video.- Specified by:
dispose
in interfaceVideo
- Overrides:
dispose
in classVideoAdapter
-
continuePlaying
protected void continuePlaying()Plays the next time-appropriate frame at the current rate. -
getTypeName
Description copied from interface:Video
Returns the VideoType name of this video.- Specified by:
getTypeName
in interfaceVideo
-
setFrameCount
protected void setFrameCount(int n) - Overrides:
setFrameCount
in classVideoAdapter
-
finalizeLoading
protected void finalizeLoading()- Specified by:
finalizeLoading
in classMovieVideo
-
cantRead
public void cantRead() -
getLoader
Returns an XML.ObjectLoader to save and load JSMovieVideo data.- Returns:
- the object loader
-
createThumbnailFile
-
getProgress
public int getProgress()- Specified by:
getProgress
in interfaceAsyncVideoI
-
getLoadedFrameCount
public int getLoadedFrameCount()- Specified by:
getLoadedFrameCount
in interfaceAsyncVideoI
-
seekMS
protected boolean seekMS(double timeMS) Description copied from class:MovieVideo
seek to a time in milliseconds.- Specified by:
seekMS
in classMovieVideo
- Returns:
-
getImageForMSTimePoint
- Specified by:
getImageForMSTimePoint
in classMovieVideo
-
getPlatform
Description copied from class:MovieVideo
Get this platform's name- Specified by:
getPlatform
in classMovieVideo
- Returns:
- "Java" or navigator.userAgent
-