Parsing is always asynchronous - you must wait for a parsed changed event before you can read meta data.
Once a media has been parsed, it can not be parsed again - so if for example parse fails due to a timeout and you retry it, it will not parse again.
There are two special timeout values that can be used for parsing:
- 0 means that the call will wait indefinitely;
- -1 means that the default value set by the "preparse-timeout" native option/argument will be used
MediaEventListener
to be notified of changes to the parsed status - an event
will fire if the parsing succeeded, timed-out, or failed for any other reason as per MediaParsedStatus
.
Parsing may trigger the remote downloading of data, including for example performing a search for cover art for the media. This has clear privacy implications.
To affirmatively prevent all network access for meta data, consider trying the "--no-metadata-network-access"
argument when creating a MediaPlayerFactory
.
It should also be possible to prevent such network accesses by using appropriate ParseFlag
values, see
ParseFlag.FETCH_LOCAL
vs ParseFlag.FETCH_NETWORK
.
Even with network access disabled, some media covert art may still appear locally (e.g. ~/.cache/vlc) - this does not necessarily mean that a remote network request was made for the cover art, rather the art was embedded in the media file and extracted to this temporary cache directory.
-
Method Summary
Modifier and TypeMethodDescriptionboolean
parse()
Parse the media, asynchronously, with a timeout set by the "preparse-timeout" native option value.boolean
parse
(int timeout) Parse the media, asynchronously, with a specific timeout.boolean
Parse the media, asynchronously, with a specific timeout and specific parse flags.boolean
Parse the media, asynchronously, with specific parse flags, and a timeout set by the "preparse-timeout" native option value.status()
Get the media parsed status.void
stop()
Stop the asynchronous parsing.
-
Method Details
-
parse
public boolean parse()Parse the media, asynchronously, with a timeout set by the "preparse-timeout" native option value.- Returns:
true
if the parse request was successful;false
on error
-
parse
public boolean parse(int timeout) Parse the media, asynchronously, with a specific timeout.- Parameters:
timeout
- timeout, milliseconds- Returns:
true
if the parse request was successful;false
on error
-
parse
Parse the media, asynchronously, with specific parse flags, and a timeout set by the "preparse-timeout" native option value.- Parameters:
flags
- parse flags- Returns:
true
if the parse request was successful;false
on error
-
parse
Parse the media, asynchronously, with a specific timeout and specific parse flags.- Parameters:
timeout
- timeout, millisecondsflags
- parse flags- Returns:
true
if the parse request was successful;false
on error
-
stop
public void stop()Stop the asynchronous parsing. -
status
Get the media parsed status.It is recommended to use media events to determine the parse status instead of this.
- Returns:
- parsed status
-