T
- The type of the video framepublic class VideoPlayer<T extends Image<?,T>> extends VideoDisplay<T> implements VideoDisplayStateListener
VideoDisplay
class that provides
GUI elements for starting, stopping, pausing and rewinding video.
The class relies on the underlying VideoDisplay
to actually provide
the main functionality for video playing and indeed still allows its methods
to be used. This class then provides a simple API for starting, pausing and
stopping video.
Unlike VideoDisplay
, the VideoPlayer class does not create a frame
when the createVideoPlayer(Video)
methods are called. Use the
showFrame()
method to produce a visible frame.
Modifier and Type | Class and Description |
---|---|
protected class |
VideoPlayer.VideoPlayerComponent
The video player components encapsulates the buttons and their
functionalities, as well as animating buttons, etc.
|
VideoDisplay.BasicVideoTimeKeeper, VideoDisplay.EndAction, VideoDisplay.Mode
Modifier | Constructor and Description |
---|---|
|
VideoPlayer(Video<T> v)
Create the video player to play the given video.
|
|
VideoPlayer(Video<T> v,
AudioStream audio)
Create the video player to play the given video.
|
protected |
VideoPlayer(Video<T> v,
AudioStream audio,
DisplayUtilities.ImageComponent screen)
Created the video player for the given video on the given image
component.
|
Modifier and Type | Method and Description |
---|---|
static <T extends Image<?,T>> |
createVideoPlayer(Video<T> video)
Creates a new video player in a new thread and starts it running
(initially in pause mode).
|
static <T extends Image<?,T>> |
createVideoPlayer(Video<T> video,
AudioStream audio)
Creates a new video player in a new thread and starts it running
(initially in pause mode).
|
JPanel |
getVideoPlayerPanel()
Returns a JPanel video player which can be incorporated into other GUIs.
|
void |
pause()
Pause the video
|
void |
play()
Play the video.
|
void |
setButtons(String[] buttons)
Set the buttons to show on this video player.
|
JFrame |
showFrame()
Shows the video player in a frame.
|
void |
stepBack()
Step back a frame.
|
void |
stepForward()
Step forward a frame.
|
void |
stop()
Stop the video
|
void |
videoPaused(VideoDisplay<?> v)
Called when the video display is paused.
|
void |
videoPlaying(VideoDisplay<?> v)
Called when the video display is set to play.
|
void |
videoStateChanged(VideoDisplay.Mode mode,
VideoDisplay<?> v)
Called when the video display's state changes.
|
void |
videoStopped(VideoDisplay<?> v)
Called when the video display is stopped.
|
addVideoDisplayStateListener, addVideoListener, addVideoPositionListener, changeVideo, close, createOffscreenVideoDisplay, createVideoDisplay, createVideoDisplay, createVideoDisplay, createVideoDisplay, createVideoDisplay, createVideoDisplay, createVideoDisplay, createVideoDisplay, displayMode, fireBeforeUpdate, fireStateChanged, fireVideoEndEvent, fireVideoStartEvent, fireVideoUpdate, getDisplayFPS, getDroppedFrameCount, getMode, getPosition, getScreen, getVideo, isCalculateFPS, isPaused, isStopped, processEndAction, removeVideoDisplayStateListener, removeVideoPositionListener, resetDroppedFrameCount, run, seek, setCalculateFPS, setEndAction, setMode, setPosition, setTimeKeeper, togglePause
public VideoPlayer(Video<T> v)
v
- The video to playpublic VideoPlayer(Video<T> v, AudioStream audio)
v
- The video to playaudio
- The audio to playprotected VideoPlayer(Video<T> v, AudioStream audio, DisplayUtilities.ImageComponent screen)
v
- The videoaudio
- The audioscreen
- The screen to draw the video to.public static <T extends Image<?,T>> VideoPlayer<T> createVideoPlayer(Video<T> video)
video
- The videopublic static <T extends Image<?,T>> VideoPlayer<T> createVideoPlayer(Video<T> video, AudioStream audio)
video
- The videoaudio
- The udiopublic JFrame showFrame()
public JPanel getVideoPlayerPanel()
public void play()
public void stop()
public void pause()
public void stepBack()
public void stepForward()
public void videoStopped(VideoDisplay<?> v)
videoStopped
in interface VideoDisplayStateListener
v
- The video display that was stopped.VideoDisplayStateListener.videoStopped(org.openimaj.video.VideoDisplay)
public void videoPlaying(VideoDisplay<?> v)
videoPlaying
in interface VideoDisplayStateListener
v
- The video display that was set to play.VideoDisplayStateListener.videoPlaying(org.openimaj.video.VideoDisplay)
public void videoPaused(VideoDisplay<?> v)
videoPaused
in interface VideoDisplayStateListener
v
- The video display that was paused.VideoDisplayStateListener.videoPaused(org.openimaj.video.VideoDisplay)
public void videoStateChanged(VideoDisplay.Mode mode, VideoDisplay<?> v)
videoStateChanged
in interface VideoDisplayStateListener
mode
- The mode the video display changed tov
- The video display whose state changed.VideoDisplayStateListener.videoStateChanged(org.openimaj.video.VideoDisplay.Mode,
org.openimaj.video.VideoDisplay)
public void setButtons(String[] buttons)
Buttons not from this list will be ignored.
The order of the array will determine the order of the buttons shown on the player.
buttons
- The buttons to show on the player.