Search...

createAudioResource

declare function createAudioResource<T>(input: string | Readable, options: CreateAudioResourceOptions<T> & Pick<T extends null | undefined ? CreateAudioResourceOptions<T> : Required<CreateAudioResourceOptions<T>>, 'metadata'>): AudioResource<T extends null | undefined ? null : T>;
declare function createAudioResource<T>(input: string | Readable, options: CreateAudioResourceOptions<T> & Pick<T extends null | undefined ? CreateAudioResourceOptions<T> : Required<CreateAudioResourceOptions<T>>, 'metadata'>): AudioResource<T extends null | undefined ? null : T>;
Creates an audio resource that can be played by audio players.
Remarks
If the input is given as a string, then the inputType option will be overridden and FFmpeg will be used.If the input is not in the correct format, then a pipeline of transcoders and transformers will be created to ensure that the resultant stream is in the correct format for playback. This could involve using FFmpeg, Opus transcoders, and Ogg/WebM demuxers.
NameConstraintsOptionalDefaultDescription
TNoNone
NameTypeOptionalDescription
inputstring | ReadableNoThe resource to play
optionsCreateAudioResourceOptions<T> & Pick<T extends null | undefined ? CreateAudioResourceOptions<T> : Required<CreateAudioResourceOptions<T>>, 'metadata'>NoConfigurable options for creating the resource T - the type for the metadata (if any) of the audio resource