Expose VoiceBroadcast#dispatcher so that the broadcast can be controlled

This commit is contained in:
Amish Shah
2018-01-19 14:39:51 +00:00
parent e7375aa0fd
commit 3b1c5d3494
2 changed files with 9 additions and 1 deletions

View File

@@ -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

View File

@@ -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;
}
}