From eacbfbd520565a5516de83fafb7062f14d48fb68 Mon Sep 17 00:00:00 2001 From: Amish Shah Date: Fri, 30 Dec 2016 19:13:25 +0000 Subject: [PATCH] Add VoiceBroadcast#playArbitraryInput and VoiceConnection#playArbitraryInput --- src/client/voice/VoiceBroadcast.js | 11 +++++++++++ src/client/voice/VoiceConnection.js | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/client/voice/VoiceBroadcast.js b/src/client/voice/VoiceBroadcast.js index 963342941..bce054583 100644 --- a/src/client/voice/VoiceBroadcast.js +++ b/src/client/voice/VoiceBroadcast.js @@ -252,6 +252,17 @@ class VoiceBroadcast extends EventEmitter { return this; } + /** + * Play an arbitrary input that can be [handled by ffmpeg](https://ffmpeg.org/ffmpeg-protocols.html#Description) + * @param {string} input the arbitrary input + * @param {StreamOptions} [options] Options for playing the stream + * @returns {VoiceBroadcast} + */ + playArbitraryInput(input, { seek = 0, volume = 1, passes = 1 } = {}) { + const options = { seek, volume, passes }; + return this.player.playUnknownStream(input, options); + } + /** * Pauses the entire broadcast - all dispatchers also pause */ diff --git a/src/client/voice/VoiceConnection.js b/src/client/voice/VoiceConnection.js index 304769145..4a064a5c1 100644 --- a/src/client/voice/VoiceConnection.js +++ b/src/client/voice/VoiceConnection.js @@ -241,6 +241,17 @@ class VoiceConnection extends EventEmitter { return this.player.playUnknownStream(file, options); } + /** + * Play an arbitrary input that can be [handled by ffmpeg](https://ffmpeg.org/ffmpeg-protocols.html#Description) + * @param {string} input the arbitrary input + * @param {StreamOptions} [options] Options for playing the stream + * @returns {StreamDispatcher} + */ + playArbitraryInput(input, { seek = 0, volume = 1, passes = 1 } = {}) { + const options = { seek, volume, passes }; + return this.player.playUnknownStream(input, options); + } + /** * Plays and converts an audio stream in the voice connection. * @param {ReadableStream} stream The audio stream to play