-
Method Summary
Modifier and TypeMethodDescriptionget()
Get a snapshot of the currently playing video.get
(int width, int height) Get a snapshot of the currently playing video.boolean
save()
Save a snapshot of the currently playing video.boolean
save
(int width, int height) Save a snapshot of the currently playing video.boolean
Save a snapshot of the currently playing video.boolean
Save a snapshot of the currently playing video.void
setSnapshotDirectory
(String snapshotDirectoryName) Set the directory into which snapshots of the video are saved.
-
Method Details
-
setSnapshotDirectory
Set the directory into which snapshots of the video are saved.If the specified directory path does not yet exist, it will be created.
- Parameters:
snapshotDirectoryName
- name of the directory to save snapshots to
-
save
public boolean save()Save a snapshot of the currently playing video.The size of the image will be that produced by the libvlc native snapshot function, i.e. the size of the media itself.
The snapshot will be created in the directory set via
setSnapshotDirectory(String)
, unless that directory has not been set in which case the snapshot will be created in the user's home directory, obtained via the "user.home" system property.The snapshot will be assigned a filename based on the current time.
The size of the image will be that produced by the libvlc native snapshot function.
Taking a snapshot is an asynchronous function, the snapshot is not available until after the
MediaPlayerEventListener.snapshotTaken(MediaPlayer, String)
event is received.- Returns:
true
if the snapshot was saved, otherwisefalse
-
save
public boolean save(int width, int height) Save a snapshot of the currently playing video.The snapshot will be created in the directory set via
setSnapshotDirectory(String)
, unless that directory has not been set in which case the snapshot will be created in the user's home directory, obtained via the "user.home" system property.The snapshot will be assigned a filename based on the current time.
If one of width or height is zero the original image aspect ratio will be preserved.
If both width and height are zero, the original image size will be used, see
save()
.Taking a snapshot is an asynchronous function, the snapshot is not available until after the
MediaPlayerEventListener.snapshotTaken(MediaPlayer, String)
event is received.- Parameters:
width
- desired image widthheight
- desired image height- Returns:
true
if the snapshot was saved, otherwisefalse
-
save
Save a snapshot of the currently playing video.The size of the image will be that produced by the libvlc native snapshot function, i.e. the size of the media itself.
Any missing directory path will be created if it does not exist.
Taking a snapshot is an asynchronous function, the snapshot is not available until after the
MediaPlayerEventListener.snapshotTaken(MediaPlayer, String)
event is received.- Parameters:
file
- file to contain the snapshot- Returns:
true
if the snapshot was saved, otherwisefalse
-
save
Save a snapshot of the currently playing video.Any missing directory path will be created if it does not exist.
If one of width or height is zero the original image aspect ratio will be preserved.
If both width and height are zero, the original image size will be used, see
save(File)
.Taking a snapshot is an asynchronous function, the snapshot is not available until after the
MediaPlayerEventListener.snapshotTaken(MediaPlayer, String)
event is received.- Parameters:
file
- file to contain the snapshotwidth
- desired image widthheight
- desired image height- Returns:
true
if the snapshot was saved, otherwisefalse
-
get
Get a snapshot of the currently playing video.The size of the image will be that produced by the libvlc native snapshot function, i.e. the size of the media itself.
This implementation uses the native libvlc method to save a snapshot of the currently playing video. This snapshot is saved to a temporary file and then the resultant image is loaded from the file.
Taking a snapshot is an asynchronous function, the snapshot is not available until after the
MediaPlayerEventListener.snapshotTaken(MediaPlayer, String)
event is received.- Returns:
- snapshot image, or
null
if a snapshot could not be taken
-
get
Get a snapshot of the currently playing video.This implementation uses the native libvlc method to save a snapshot of the currently playing video. This snapshot is saved to a temporary file and then the resultant image is loaded from the file.
If one of width or height is zero the original image aspect ratio will be preserved.
If both width and height are zero, the original image size will be used, see
get()
Taking a snapshot is an asynchronous function, the snapshot is not available until after the
MediaPlayerEventListener.snapshotTaken(MediaPlayer, String)
event is received.- Parameters:
width
- desired image widthheight
- desired image height- Returns:
- snapshot image, or
null
if a snapshot could not be taken
-