Class Media
java.lang.Object
com.craftmend.openaudiomc.api.media.Media
- Direct Known Subclasses:
Media
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 -
Method Summary
Modifier and TypeMethodDescriptionapplySettings(MediaOptions options) You can apply multiple options.intFade 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.getFlag()The flag of the media, used to identify the type of media.intKeep 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.intThe starting point of the media, in milliseconds. 0 by default, but can be used to skip intros or start at a certain point.longAn 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)intThe volume of the media, 0-100booleanIf the media should attempt to pick up where its currently according to the time spent since the start instant.booleanisLoop()If the media should loop (jumping back to startAtMillis and playing again)booleanIf this media will mute current regions while playing.booleanIf this media will mute the speakers of the client.voidsetDoPickup(boolean doPickup) If the media should attempt to pick up where its currently according to the time spent since the start instant.voidsetFadeTime(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.voidThe flag of the media, used to identify the type of media.voidsetKeepTimeout(int keepTimeout) Keep timeout is the amount of seconds that the openaudiomc plugin runtime should keep track of this media for.voidsetLoop(boolean loop) If the media should loop (jumping back to startAtMillis and playing again)voidsetMediaId(String mediaId) The unique id of the media, used by the client to keep track of media pools.voidsetMuteRegions(boolean muteRegions) If this media will mute current regions while playing.voidsetMuteSpeakers(boolean muteSpeakers) If this media will mute the speakers of the client.voidSource value for the media.voidsetStartAtMillis(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.voidsetStartInstant(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)voidsetVolume(int volume) The volume of the media, 0-100
-
Constructor Details
-
Media
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
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
Source value for the media. Typically, a web compatible web link or translatable OA value -
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
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
Source value for the media. Typically, a web compatible web link or translatable OA value -
setMediaId
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
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.
-