You are reading the documentation for the next version of discord.js. Documentation for v13/v14+ has been moved to old.discordjs.dev

AudioResource

export declare class AudioResource<T = unknown>
export declare class AudioResource<T = unknown>
Represents an audio resource that can be played by an audio player.
NameConstraintsOptionalDefaultDescription
TYesunknownthe type for the metadata (if any) of the audio resource
constructor(edges, streams, metadata, silencePaddingFrames)
Constructs a new instance of the AudioResource class
NameTypeOptionalDescription
edgesreadonly Edge[]NoNone
streamsreadonly Readable[]NoNone
metadataTNoNone
silencePaddingFramesnumberNoNone
audioPlayer?:AudioPlayer | undefined
The audio player that the resource is subscribed to, if any.
Readonly
edges:readonly Edge[]
The pipeline used to convert the input stream into a playable format. For example, this may contain an FFmpeg component for arbitrary inputs, and it may contain a VolumeTransformer component for resources with inline volume transformation enabled.
Readonly
encoder?:prism.opus.Encoder
If using an Opus encoder to create this audio resource, then this will be a prism-media opus.Encoder. You can use this to control settings such as bitrate, FEC, PLP.
Readonly
ended:boolean
Whether this resource has ended or not.
metadata:T
Optional metadata that can be used to identify the resource.
playbackDuration:number
The playback duration of this audio resource, given in milliseconds.
Readonly
playStream:Readable
An object-mode Readable stream that emits Opus packets. This is what is played by audio players.
Readonly
readable:boolean
Whether this resource is readable. If the underlying resource is no longer readable, this will still return true while there are silence padding frames left to play.
Readonly
silencePaddingFrames:number
The number of silence frames to append to the end of the resource's audio stream, to prevent interpolation glitches.
silenceRemaining:number
The number of remaining silence frames to play. If -1, the frames have not yet started playing.
started:boolean
Whether or not the stream for this resource has started (data has become readable)
Readonly
volume?:prism.VolumeTransformer
If the resource was created with inline volume transformation enabled, then this will be a prism-media VolumeTransformer. You can use this to alter the volume of the stream.