Class SubpictureApi

java.lang.Object
uk.co.caprica.vlcj.player.base.SubpictureApi

public final class SubpictureApi extends Object
Behaviour pertaining to subpictures (sub-titles).
  • Method Details

    • trackCount

      public int trackCount()
      Get the number of sub-pictures/sub-title tracks.
      Returns:
      number of sub-title tracks
    • track

      public int track()
      Get the current sub-title track.
      Returns:
      sub-title number, or -1 if none
    • setTrack

      public int setTrack(int spu)
      Set the current sub-title track.

      The track identifier must be one of those returned by trackDescriptions().

      Subtitles can be disabled by passing here the identifier of the track with a description of "Disable".

      There is no guarantee that the available subtitle identifiers go in sequence from zero up to trackCount()-1. The trackDescriptions() method should always be used to ascertain the available subtitle identifiers.

      The implementation of the corresponding native method in libvlc is bugged before vlc 2.0.6, therefore vlc 2.0.6 or later is required for correct behaviour when using this method.

      Parameters:
      spu - sub-title identifier, or -1 for none
      Returns:
      current sub-title identifier
    • delay

      public long delay()
      Get the sub-title delay.
      Returns:
      sub-title delay, in microseconds
    • setDelay

      public void setDelay(long delay)
      Set the sub-title delay.

      The sub-title delay is set for the current item only and will be reset to zero each time the media changes.

      Parameters:
      delay - desired sub-title delay, in microseconds
    • setSubTitleFile

      public boolean setSubTitleFile(String subTitleFileName)
      Set the sub-title file to use.

      These sub-titles will be automatically selected.

      This method is a convenience for MediaApi.addSlave(MediaSlaveType, String, boolean).

      Parameters:
      subTitleFileName - name of the local file containing the sub-titles
      Returns:
      true if successful; false on error
    • setSubTitleFile

      public boolean setSubTitleFile(File subTitleFile)
      Set the sub-title file to use.

      These sub-titles will be automatically selected.

      This method is a convenience for MediaApi.addSlave(MediaSlaveType, String, boolean).

      Parameters:
      subTitleFile - file containing the sub-titles
      Returns:
      true if successful; false on error
    • setSubTitleUri

      public boolean setSubTitleUri(String uri)
      Set sub-titles from a URI.

      These sub-titles will be automatically selected.

      This method is a convenience for MediaApi.addSlave(MediaSlaveType, String, boolean).

      See SlaveApi.add(MediaSlaveType, MediaSlavePriority, String) for further important information regarding this method.

      Parameters:
      uri - sub-title URI
      Returns:
      true if successful; false on error
    • trackDescriptions

      public List<TrackDescription> trackDescriptions()
      Get the sub-title track descriptions.

      The media must be playing before this information is available.

      Returns:
      list of descriptions, may be empty but will never be null