Class: PlayInterface

PlayInterface

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

Constructor

new PlayInterface()

Source:

Methods

play(resource, optionsopt) → {StreamDispatcher}

Play an audio resource.
Parameters:
Name Type Attributes Description
resource VoiceBroadcast | ReadableStream | string The resource to play.
options StreamOptions <optional>
The options to play.
Source:
Returns:
Type
StreamDispatcher
Examples
// Play a local audio file
connection.play('/home/hydrabolt/audio.mp3', { volume: 0.5 });
// Play a ReadableStream
connection.play(ytdl('https://www.youtube.com/watch?v=ZlAU_w7-Xp8', { quality: 'highestaudio' }));
// Play a voice broadcast
const broadcast = client.voice.createBroadcast();
broadcast.play('/home/hydrabolt/audio.mp3');
connection.play(broadcast);
// Using different protocols: https://ffmpeg.org/ffmpeg-protocols.html
connection.play('http://www.sample-videos.com/audio/mp3/wave.mp3');