Using the "play" command

You can think of the '/oa play' command as one you can use to manually trigger precise playback, for use in effects, shows, or one-off sounds.

Basic usage

The basic syntax for the play command is as follows:

Command Example
/oa play <selector> <source> [options]
<>Required
[]Optional

and this command will just play the specified source for the selected players, once. But you can also add optional parameters to modify the playback behavior, such as looping, volume, and fade-in time.

Playback options

The playback options are formatted as a JSON object, and can include the following properties:

KeyValueDescriptionExample
loopbooleanSets if this track should loop until stoppedtrue
idstringAssigns a custom 'id' to this track, letting you update the options or stop this track latermy-song
expirationTimeoutintKeep expirationTimeout/keepTimeout 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 late120
pickUpbooleanIf the media should attempt to pick up where its currently according to the time spent since the initial invocation.true
fadeTimeintFade 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 or to create a fade in effect.1500
startAtMillisintThe starting point of the media, in milliseconds. 0 by default, but can be used to skip intros or start at a certain point.8500
volumeintThe volume of the media, 0-10085
muteSpeakersbooleanIf this media will mute current regions while playing. This is used to prevent overlapping media in regions.true
muteRegionsbooleanIf this media will mute current speakers while playing. This is used to prevent overlapping media in speakers.true
speedintThe speed of the media, 100 by default, but can be used to speed up or slow down the media. 100 = normal speed, 200 = double speed, 50 = half speed, etc.150

Examples

Here are some examples of how to use the '/oa play' command with different options:

  • Play a sound once for all players:
    Command Example
    /oa play @a files:welcome.mp3
    <>Required
    []Optional
  • Play a sound on loop for a specific player with fade-in:
    Command Example
    /oa play @p files:background-music.mp3 {"loop":true,"fadeTime":2000}
    <>Required
    []Optional
  • Play a sound with custom volume and starting point:
    Command Example
    /oa play @a files:effect.mp3 {"volume":70,"startAtMillis":5000}
    <>Required
    []Optional
  • Play a sound that will overwrite all regions temporarily:
    Command Example
    /oa play @a files:announcement.mp3 {"muteRegions":true}
    <>Required
    []Optional

Permissions

openaudiomc.commands.play

This permission is required to use the /oa play command

Default access level: op

Javadoc related to this feature (currently based on the dev branch)