Skip to content

PlayInterface

classe · Source

An interface class to allow you to play audio over VoiceConnections.

Methods

playAudio

playAudio(resource: ReadableStream | string, options?: StreamOptions): AudioDispatcher

Play an audio resource. Parameters

NameTypeDescription
resourceReadableStream | stringThe resource to play.
options?StreamOptionsThe options to play.

Returns: AudioDispatcher

js
// Play a local audio file
connection.playAudio('/home/hydrabolt/audio.mp3', { volume: 0.5 });
js
// Play a ReadableStream
connection.playAudio(ytdl('https://www.youtube.com/watch?v=ZlAU_w7-Xp8', { quality: 'highestaudio' }));
js
// Using different protocols: https://ffmpeg.org/ffmpeg-protocols.html
connection.playAudio('http://www.sample-videos.com/audio/mp3/wave.mp3');

Source

playVideo

playVideo(resource: ReadableStream | string, options?: VideoOptions): VideoDispatcher

Play a video resource. Parameters

NameTypeDescription
resourceReadableStream | stringThe resource to play.
options?VideoOptionsThe options to play.

Returns: VideoDispatcher

js
// Play a local video file
connection.playVideo('/home/hydrabolt/video.mp4');
js
// Using different protocols: https://ffmpeg.org/ffmpeg-protocols.html
connection.playVideo('http://www.sample-videos.com/video/mp4/wave.mp4');

Source

Unofficial software. Not affiliated with or supported by Discord.