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
| Name | Type | Description |
|---|---|---|
resource | ReadableStream | string | The resource to play. |
options? | StreamOptions | The options to play. |
Returns: AudioDispatcher
js
// Play a local audio file
connection.playAudio('/home/hydrabolt/audio.mp3', { volume: 0.5 });1
2
2
js
// Play a ReadableStream
connection.playAudio(ytdl('https://www.youtube.com/watch?v=ZlAU_w7-Xp8', { quality: 'highestaudio' }));1
2
2
js
// Using different protocols: https://ffmpeg.org/ffmpeg-protocols.html
connection.playAudio('http://www.sample-videos.com/audio/mp3/wave.mp3');1
2
2
playVideo
playVideo(resource: ReadableStream | string, options?: VideoOptions): VideoDispatcher
Play a video resource. Parameters
| Name | Type | Description |
|---|---|---|
resource | ReadableStream | string | The resource to play. |
options? | VideoOptions | The options to play. |
Returns: VideoDispatcher
js
// Play a local video file
connection.playVideo('/home/hydrabolt/video.mp4');1
2
2
js
// Using different protocols: https://ffmpeg.org/ffmpeg-protocols.html
connection.playVideo('http://www.sample-videos.com/video/mp4/wave.mp4');1
2
2