mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 00:23:30 +01:00
Add VoiceBroadcast.pause and VoiceBroadcast.resume
This commit is contained in:
@@ -77,6 +77,20 @@ class VoiceBroadcast extends EventEmitter {
|
||||
return this;
|
||||
}
|
||||
|
||||
pause() {
|
||||
for (const dispatcher of this.dispatchers) {
|
||||
dispatcher.pause();
|
||||
}
|
||||
clearInterval(this.tickInterval);
|
||||
}
|
||||
|
||||
resume() {
|
||||
for (const dispatcher of this.dispatchers) {
|
||||
dispatcher.resume();
|
||||
}
|
||||
this._startPlaying();
|
||||
}
|
||||
|
||||
_startPlaying() {
|
||||
if (this.tickInterval) clearInterval(this.tickInterval);
|
||||
this.tickInterval = this.client.setInterval(this.tick.bind(this), 20);
|
||||
|
||||
@@ -183,6 +183,7 @@ class StreamDispatcher extends EventEmitter {
|
||||
}
|
||||
|
||||
if (this.paused) {
|
||||
this.setSpeaking(false);
|
||||
// data.timestamp = data.timestamp + 4294967295 ? data.timestamp + 960 : 0;
|
||||
data.pausedTime += data.length * 10;
|
||||
// if buffer is provided we are assuming a master process is controlling the dispatcher
|
||||
|
||||
Reference in New Issue
Block a user