Class ParseApi

java.lang.Object
uk.co.caprica.vlcj.media.ParseApi

public final class ParseApi extends Object
Behaviour pertaining to parsing of media.

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
Client applications should add a 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 Type
    Method
    Description
    boolean
    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(int timeout, ParseFlag... flags)
    Parse the media, asynchronously, with a specific timeout and specific parse flags.
    boolean
    parse(ParseFlag... flags)
    Parse the media, asynchronously, with specific parse flags, and a timeout set by the "preparse-timeout" native option value.
    Get the media parsed status.
    void
    Stop the asynchronous parsing.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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

      public boolean parse(ParseFlag... flags)
      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

      public boolean parse(int timeout, ParseFlag... flags)
      Parse the media, asynchronously, with a specific timeout and specific parse flags.
      Parameters:
      timeout - timeout, milliseconds
      flags - parse flags
      Returns:
      true if the parse request was successful; false on error
    • stop

      public void stop()
      Stop the asynchronous parsing.
    • status

      public MediaParsedStatus status()
      Get the media parsed status.

      It is recommended to use media events to determine the parse status instead of this.

      Returns:
      parsed status