java.lang.Object
com.craftmend.openaudiomc.api.media.Media
Direct Known Subclasses:
Media

public class Media extends Object
A Media object represents the full state of a media file, including all settings and options. This file is parsed by the client and used to play media of any type, also used internally for regions and speakers.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Media(String source)
    Create a new media based on a url the source will first be processed by the mutation api so you can just use addons without needing to wor§§ry
  • Method Summary

    Modifier and Type
    Method
    Description
    You can apply multiple options.
    int
    Fade time is the amount of milliseconds it takes to fade in or out. 0 by default, but can be used to create smooth transitions between multiple regions, or to create a fade in effect.
    The flag of the media, used to identify the type of media.
    int
    Keep timeout is the amount of seconds that the openaudiomc plugin runtime should keep track of this media for.
    The unique id of the media, used by the client to keep track of media pools.
    Source value for the media.
    int
    The starting point of the media, in milliseconds. 0 by default, but can be used to skip intros or start at a certain point.
    long
    An epoch millisecond timestamp of when the media started playing, used by the client to calculate the current position if keepup is configured (time spent + startAtMillis)
    int
    The volume of the media, 0-100
    boolean
    If the media should attempt to pick up where its currently according to the time spent since the start instant.
    boolean
    If the media should loop (jumping back to startAtMillis and playing again)
    boolean
    If this media will mute current regions while playing.
    boolean
    If this media will mute the speakers of the client.
    void
    setDoPickup(boolean doPickup)
    If the media should attempt to pick up where its currently according to the time spent since the start instant.
    void
    setFadeTime(int fadeTime)
    Fade time is the amount of milliseconds it takes to fade in or out. 0 by default, but can be used to create smooth transitions between multiple regions, or to create a fade in effect.
    void
    The flag of the media, used to identify the type of media.
    void
    setKeepTimeout(int keepTimeout)
    Keep timeout is the amount of seconds that the openaudiomc plugin runtime should keep track of this media for.
    void
    setLoop(boolean loop)
    If the media should loop (jumping back to startAtMillis and playing again)
    void
    setMediaId(String mediaId)
    The unique id of the media, used by the client to keep track of media pools.
    void
    setMuteRegions(boolean muteRegions)
    If this media will mute current regions while playing.
    void
    setMuteSpeakers(boolean muteSpeakers)
    If this media will mute the speakers of the client.
    void
    setSource(String source)
    Source value for the media.
    void
    setStartAtMillis(int startAtMillis)
    The starting point of the media, in milliseconds. 0 by default, but can be used to skip intros or start at a certain point.
    void
    setStartInstant(long startInstant)
    An epoch millisecond timestamp of when the media started playing, used by the client to calculate the current position if keepup is configured (time spent + startAtMillis)
    void
    setVolume(int volume)
    The volume of the media, 0-100

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Media

      public Media(String source)
      Create a new media based on a url the source will first be processed by the mutation api so you can just use addons without needing to wor§§ry
      Parameters:
      source - the resource url
  • Method Details

    • applySettings

      public Media applySettings(MediaOptions options)
      You can apply multiple options. Used by the commands to allow settings via JSON
      Parameters:
      options - The options. Selected via the command
      Returns:
      instance of self
    • getSource

      public String getSource()
      Source value for the media. Typically, a web compatible web link or translatable OA value
    • getMediaId

      public String getMediaId()
      The unique id of the media, used by the client to keep track of media pools. This is a random UUID by default, but can be set to a custom value and will be used to identify the media for regions, stop commands and other features.
    • getStartInstant

      public long getStartInstant()
      An epoch millisecond timestamp of when the media started playing, used by the client to calculate the current position if keepup is configured (time spent + startAtMillis)
    • getKeepTimeout

      public int getKeepTimeout()
      Keep timeout is the amount of seconds that the openaudiomc plugin runtime should keep track of this media for. Used to retroactively play media if a client connected too late. optional, -1 by default to disable.
    • isDoPickup

      public boolean isDoPickup()
      If the media should attempt to pick up where its currently according to the time spent since the start instant.
    • isLoop

      public boolean isLoop()
      If the media should loop (jumping back to startAtMillis and playing again)
    • getFadeTime

      public int getFadeTime()
      Fade time is the amount of milliseconds it takes to fade in or out. 0 by default, but can be used to create smooth transitions between multiple regions, or to create a fade in effect.
    • getVolume

      public int getVolume()
      The volume of the media, 0-100
    • isMuteRegions

      public boolean isMuteRegions()
      If this media will mute current regions while playing. This is used to prevent overlapping media in regions.
    • isMuteSpeakers

      public boolean isMuteSpeakers()
      If this media will mute the speakers of the client. This is used to prevent overlapping media with speakers.
    • getStartAtMillis

      public int getStartAtMillis()
      The starting point of the media, in milliseconds. 0 by default, but can be used to skip intros or start at a certain point.
    • getFlag

      public MediaFlag getFlag()
      The flag of the media, used to identify the type of media. This is used by the client to apply different settings based on the type of media. This is set to DEFAULT by default, but can be set to REGION or SPEAKER to apply different settings.
    • setSource

      public void setSource(String source)
      Source value for the media. Typically, a web compatible web link or translatable OA value
    • setMediaId

      public void setMediaId(String mediaId)
      The unique id of the media, used by the client to keep track of media pools. This is a random UUID by default, but can be set to a custom value and will be used to identify the media for regions, stop commands and other features.
    • setStartInstant

      public void setStartInstant(long startInstant)
      An epoch millisecond timestamp of when the media started playing, used by the client to calculate the current position if keepup is configured (time spent + startAtMillis)
    • setKeepTimeout

      public void setKeepTimeout(int keepTimeout)
      Keep timeout is the amount of seconds that the openaudiomc plugin runtime should keep track of this media for. Used to retroactively play media if a client connected too late. optional, -1 by default to disable.
    • setDoPickup

      public void setDoPickup(boolean doPickup)
      If the media should attempt to pick up where its currently according to the time spent since the start instant.
    • setLoop

      public void setLoop(boolean loop)
      If the media should loop (jumping back to startAtMillis and playing again)
    • setFadeTime

      public void setFadeTime(int fadeTime)
      Fade time is the amount of milliseconds it takes to fade in or out. 0 by default, but can be used to create smooth transitions between multiple regions, or to create a fade in effect.
    • setVolume

      public void setVolume(int volume)
      The volume of the media, 0-100
    • setMuteRegions

      public void setMuteRegions(boolean muteRegions)
      If this media will mute current regions while playing. This is used to prevent overlapping media in regions.
    • setMuteSpeakers

      public void setMuteSpeakers(boolean muteSpeakers)
      If this media will mute the speakers of the client. This is used to prevent overlapping media with speakers.
    • setStartAtMillis

      public void setStartAtMillis(int startAtMillis)
      The starting point of the media, in milliseconds. 0 by default, but can be used to skip intros or start at a certain point.
    • setFlag

      public void setFlag(MediaFlag flag)
      The flag of the media, used to identify the type of media. This is used by the client to apply different settings based on the type of media. This is set to DEFAULT by default, but can be set to REGION or SPEAKER to apply different settings.