Class MediaApi

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

public final class MediaApi extends Object
Behaviour pertaining to the current media.
  • Method Details

    • prepare

      public boolean prepare(String mrl, String... options)
      Prepare new media (set it, do not play it).
      Parameters:
      mrl - media resource locator
      options - zero or more options to attach to the new media
      Returns:
      true if successful; false on error
    • play

      public boolean play(String mrl, String... options)
      Set new media and play it.
      Parameters:
      mrl - media resource locator
      options - zero or more options to attach to the new media
      Returns:
      true if successful; false on error
    • start

      public boolean start(String mrl, String... options)
      Set new media, play it, and wait for it to start playing (or error).

      This method should be used only when the media player is in a stopped state, otherwise behaviour is undefined.

      Parameters:
      mrl - media resource locator
      options - zero or more options to attach to the new media
      Returns:
      true if successful; false on error
    • prepare

      public boolean prepare(CallbackMedia callbackMedia, String... options)
      Prepare new media (set it, do not play it).
      Parameters:
      callbackMedia - callback media
      options - zero or more options to attach to the new media
      Returns:
      true if successful; false on error
    • play

      public boolean play(CallbackMedia callbackMedia, String... options)
      Set new media and play it.
      Parameters:
      callbackMedia - callback media
      options - zero or more options to attach to the new media
      Returns:
      true if successful; false on error
    • start

      public boolean start(CallbackMedia callbackMedia, String... options)
      Set new media, play it, and wait for it to start playing (or error).

      This method should be used only when the media player is in a stopped state, otherwise behaviour is undefined.

      Parameters:
      callbackMedia - callback media
      options - zero or more options to attach to the new media
      Returns:
      true if successful; false on error
    • prepare

      public boolean prepare(MediaRef mediaRef, String... options)
      Prepare new media (set it, do not play it).

      The supplied MediaRef is not kept by this component and must be released by the caller when the caller no longer has any use for it.

      Parameters:
      mediaRef - media reference
      options - zero or more options to attach to the new media
      Returns:
      true if successful; false on error
    • play

      public boolean play(MediaRef mediaRef, String... options)
      Set new media and play it.

      The supplied MediaRef is not kept by this component and must be released by the caller when the caller no longer has any use for it.

      Parameters:
      mediaRef - media reference
      options - zero or more options to attach to the new media
      Returns:
      true if successful; false on error
    • start

      public boolean start(MediaRef mediaRef, String... options)
      Set new media, play it, and wait for it to start playing (or error).

      This method should be used only when the media player is in a stopped state, otherwise behaviour is undefined.

      The supplied MediaRef is not kept by this component and must be released by the caller when the caller no longer has any use for it.

      Parameters:
      mediaRef - media reference
      options - zero or more options to attach to the new media
      Returns:
      true if successful; false on error
    • startPaused

      public boolean startPaused(String mrl, String... options)
      Set new media, play it, and wait for it to start playing (or error), pausing immediately on the first frame.

      This method should be used only when the media player is in a stopped state, otherwise behaviour is undefined.

      Setting media is now an asynchronous operation.

      Parameters:
      mrl - media resource locator
      options - zero or more options to attach to the new media
      Returns:
      true if successful; false on error
    • startPaused

      public boolean startPaused(CallbackMedia callbackMedia, String... options)
      Set new media, play it, and wait for it to start playing (or error), pausing immediately on the first frame.

      This method should be used only when the media player is in a stopped state, otherwise behaviour is undefined.

      Setting media is now an asynchronous operation.

      Parameters:
      callbackMedia - callback media
      options - zero or more options to attach to the new media
      Returns:
      true if successful; false on error
    • startPaused

      public boolean startPaused(MediaRef mediaRef, String... options)
      Set new media, play it, and wait for it to start playing (or error), pausing immediately on the first frame.

      This method should be used only when the media player is in a stopped state, otherwise behaviour is undefined.

      The supplied MediaRef is not kept by this component and must be released by the caller when the caller no longer has any use for it.

      Setting media is now an asynchronous operation.

      Parameters:
      mediaRef - media reference
      options - zero or more options to attach to the new media
      Returns:
      true if successful; false on error
    • addSlave

      public boolean addSlave(MediaSlaveType type, String uri, boolean select)
      Add an input slave to the current media.

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

      Parameters:
      type - type of slave to add
      uri - URI of the slave to add
      select - true if this slave should be automatically selected when added
      Returns:
      true on success; false otherwise
    • newMedia

      public Media newMedia()
      Create a new Media component for the current media.

      The caller must release the returned Media when it no longer has any use for it.

      Returns:
      media
    • newMediaRef

      public MediaRef newMediaRef()
      Create a new MediaRef for the current media.

      The caller must release the returned MediaRef when it no longer has any use for it.

      Returns:
      media reference
    • isValid

      public boolean isValid()
      Is the media valid?

      This method could be used to check there is media before using the various behaviours.

      Returns:
      true if there is a valid media; false if there is not
    • events

      public EventApi events()
      Delegated behaviour pertaining to the associated media events.
      Returns:
      media event behaviour
    • info

      public InfoApi info()
      Delegated behaviour pertaining to the associated media information.
      Returns:
      media information behaviour
    • meta

      public MetaApi meta()
      Delegated behaviour pertaining to the associated media meta data.
      Returns:
      media meta data behaviour
    • options

      public OptionsApi options()
      Delegated behaviour pertaining to media options.
      Returns:
      media option behaviour
    • parsing

      public ParseApi parsing()
      Delegated behaviour pertaining to parsing of the associated media.
      Returns:
      parsing behaviour
    • slaves

      public SlaveApi slaves()
      Delegated behaviour pertaining to media slaves for the associated media.
      Returns:
      media slave behaviour
    • subitems

      public SubitemApi subitems()
      Delegated behaviour pertaining to the associated media subitems.
      Returns:
      subitem behaviour