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 classA class to save and load JSMovieVideo data. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intFields 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, urlFields 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, widthDominatesFields inherited from interface org.opensourcephysics.media.core.AsyncVideoI
PROPERTY_ASYNCVIDEOI_HAVEFRAMES, PROPERTY_ASYNCVIDEOI_IMAGEREADY, PROPERTY_ASYNCVIDEOI_READYFields inherited from interface org.opensourcephysics.media.core.Trackable
PROPERTY_ADJUSTINGFields 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 TypeMethodDescriptionvoidcantRead()protected voidPlays the next time-appropriate frame at the current rate.static FilecreateThumbnailFile(Dimension defaultThumbnailDimension, String sourcePath, String thumbPath) voiddispose()Disposes of this video.protected voiddoubleGets 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 BufferedImagegetImageForMSTimePoint(double timeMS) intstatic XML.ObjectLoaderReturns an XML.ObjectLoader to save and load JSMovieVideo data.protected StringGet this platform's nameintgetProperty(String name) Gets a user property of the video.Returns the VideoType name of this video.voidplay()Plays the video at the current rate.protected booleanseekMS(double timeMS) seek to a time in milliseconds.protected voidsetFrameCount(int n) voidsetFrameNumber(int n) Sets the frame number.voidsetFrameNumberContinued(int n, double t) voidsetRate(double rate) Sets the relative play rate.voidstop()Stops the video.Methods inherited from class org.opensourcephysics.media.mov.MovieVideo
getFrameNumberBefore, setFromControl, setFromMediaTrackInfo, setStartTimesMethods 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, updateBufferedImageMethods inherited from class org.opensourcephysics.display.OSPRuntime.Supported
addListeners, addPropertyChangeListener, addPropertyChangeListener, addPropertyChangeListenerSafely, dispose, firePropertyChange, firePropertyChange, removeListeners, removePropertyChangeListener, removePropertyChangeListenerMethods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.opensourcephysics.display.Interactive
isInteractiveMethods 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:VideoAdapterGets a user property of the video. May return null.- Specified by:
getPropertyin interfaceDrawableImage- Overrides:
getPropertyin 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:VideoAdapterGets the current video image after applying enabled filters.- Specified by:
getImagein interfaceDrawableImage- Overrides:
getImagein 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:
setFrameNumberin interfaceVideo- Overrides:
setFrameNumberin 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:VideoGets 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:
getFrameCountDurationMSin 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:
setRatein interfaceVideo- Overrides:
setRatein classVideoAdapter- Parameters:
rate- the relative play rate.
-
dispose
public void dispose()Disposes of this video.- Specified by:
disposein interfaceVideo- Overrides:
disposein classVideoAdapter
-
continuePlaying
protected void continuePlaying()Plays the next time-appropriate frame at the current rate. -
getTypeName
Description copied from interface:VideoReturns the VideoType name of this video.- Specified by:
getTypeNamein interfaceVideo
-
setFrameCount
protected void setFrameCount(int n) - Overrides:
setFrameCountin classVideoAdapter
-
finalizeLoading
protected void finalizeLoading()- Specified by:
finalizeLoadingin 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:
getProgressin interfaceAsyncVideoI
-
getLoadedFrameCount
public int getLoadedFrameCount()- Specified by:
getLoadedFrameCountin interfaceAsyncVideoI
-
seekMS
protected boolean seekMS(double timeMS) Description copied from class:MovieVideoseek to a time in milliseconds.- Specified by:
seekMSin classMovieVideo- Returns:
-
getImageForMSTimePoint
- Specified by:
getImageForMSTimePointin classMovieVideo
-
getPlatform
Description copied from class:MovieVideoGet this platform's name- Specified by:
getPlatformin classMovieVideo- Returns:
- "Java" or navigator.userAgent
-