Package jltk.gui
Class Video
- java.lang.Object
-
- jltk.Component
-
- jltk.gui.Video
-
public class Video extends Component
The Video class represents a video in the gui. You can use a video from file or web.- Version:
- 22.08.2022
- Author:
- ms
-
-
Field Summary
-
Fields inherited from class jltk.Component
fxNode, hasFocus, myWindow, onFocusGained, onFocusLost
-
-
Constructor Summary
Constructors Constructor Description Video(double pLeft, double pTop, double pWidth, double pHeight, String pVideoPath)
Creates a video view with the specified size.Video(double pLeft, double pTop, double pWidth, String pVideoPath)
Creates a video view with the specified width.Video(Window pWindow, double pLeft, double pTop, double pWidth, double pHeight, String pVideoPath)
Creates a video view on the specified window with the specified size.Video(Window pWindow, double pLeft, double pTop, double pWidth, String pVideoPath)
Creates a video view on the specified window with the specified width.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
autoplay()
double
getCurrentTime()
Return the current time in secondsdouble
getDuration()
Return the Duration of this video in secondsdouble
getVolume()
Return the current video playback volume.void
pause()
Pauses playing the video.void
play()
Starts playing the video.void
setHeight(double pHeight)
Set the new height of this media to the specified value.void
setSize(double pWidth, double pHeight)
Sets the new size of the media.void
setVolume(double pVolume)
Set the video playback volume.void
setWidth(double pWidth)
Set the new width of this media to the specified value.void
stop()
Stops playing the video.-
Methods inherited from class jltk.Component
activate, deactivate, focus, getX, getY, hasFocus, hide, init, istActive, isVisible, runMethodByName, setOnFocusGained, setOnFocusLost, setPosition, show, toBack, toFront
-
-
-
-
Constructor Detail
-
Video
public Video(double pLeft, double pTop, double pWidth, double pHeight, String pVideoPath)
Creates a video view with the specified size. As video path you can use a file path or an url.- Parameters:
pLeft
- The horizontal coordinatepTop
- The vertical coordinatepWidth
- The width of the VideopHeight
- The height of the VideopVideoPath
- A file or url
-
Video
public Video(double pLeft, double pTop, double pWidth, String pVideoPath)
Creates a video view with the specified width. The height is scaled to preserve ratio. As video path you can use a file path or an url.- Parameters:
pLeft
- The horizontal coordinatepTop
- The vertical coordinatepWidth
- The width of the VideopVideoPath
- A file or url
-
Video
public Video(Window pWindow, double pLeft, double pTop, double pWidth, String pVideoPath)
Creates a video view on the specified window with the specified width. The height is scaled to preserve ratio. As video path you can use a file path or an url.- Parameters:
pLeft
- The horizontal coordinatepTop
- The vertical coordinatepWidth
- The width of the VideopVideoPath
- A file or url
-
Video
public Video(Window pWindow, double pLeft, double pTop, double pWidth, double pHeight, String pVideoPath)
Creates a video view on the specified window with the specified size. As video path you can use a file path or an url.- Parameters:
pLeft
- The horizontal coordinatepTop
- The vertical coordinatepWidth
- The width of the VideopHeight
- The height of the VideopVideoPath
- A file or url
-
-
Method Detail
-
setWidth
public void setWidth(double pWidth)
Set the new width of this media to the specified value.- Parameters:
pWidth
- The new width of this component
-
setHeight
public void setHeight(double pHeight)
Set the new height of this media to the specified value.- Parameters:
pHeight
- The new height of this component
-
setSize
public void setSize(double pWidth, double pHeight)
Sets the new size of the media.- Parameters:
pWidth
- the new widthpHeight
- the new height
-
getDuration
public double getDuration()
Return the Duration of this video in seconds- Returns:
- The video duration in second
-
getCurrentTime
public double getCurrentTime()
Return the current time in seconds- Returns:
- The current time
-
getVolume
public double getVolume()
Return the current video playback volume.- Returns:
- The video playback volume
-
play
public void play()
Starts playing the video.
-
autoplay
public void autoplay()
-
stop
public void stop()
Stops playing the video. (Reset everything to start)
-
pause
public void pause()
Pauses playing the video.
-
setVolume
public void setVolume(double pVolume)
Set the video playback volume. By default volume is 1.0.- Parameters:
pVolume
- The video playback volume
-
-