From 3b1c5d3494aed2d4d428cda5388f7cc7da262e69 Mon Sep 17 00:00:00 2001 From: Amish Shah Date: Fri, 19 Jan 2018 14:39:51 +0000 Subject: [PATCH] Expose VoiceBroadcast#dispatcher so that the broadcast can be controlled --- src/client/voice/VoiceBroadcast.js | 8 ++++++++ src/client/voice/player/BroadcastAudioPlayer.js | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/client/voice/VoiceBroadcast.js b/src/client/voice/VoiceBroadcast.js index 421988a65..8f83c4749 100644 --- a/src/client/voice/VoiceBroadcast.js +++ b/src/client/voice/VoiceBroadcast.js @@ -28,6 +28,14 @@ class VoiceBroadcast extends EventEmitter { this.player = new BroadcastAudioPlayer(this); } + /** + * The current master dispatcher, if any. This dispatcher controls all that is played by subscribed dispatchers. + * @type {?BroadcastDispatcher} + */ + get dispatcher() { + return this.player.dispatcher; + } + /** * Plays the given file in the voice connection. * @param {string} file The absolute path to the file diff --git a/src/client/voice/player/BroadcastAudioPlayer.js b/src/client/voice/player/BroadcastAudioPlayer.js index a26f90efc..052c9ea0b 100644 --- a/src/client/voice/player/BroadcastAudioPlayer.js +++ b/src/client/voice/player/BroadcastAudioPlayer.js @@ -18,7 +18,7 @@ class AudioPlayer extends BasePlayer { createDispatcher(options, streams) { this.destroyDispatcher(); - const dispatcher = new BroadcastDispatcher(this, options, streams); + const dispatcher = this.dispatcher = new BroadcastDispatcher(this, options, streams); return dispatcher; } }