mirror of
https://github.com/danbulant/discord.js
synced 2026-06-19 14:41:36 +00:00
Add setPLP and setFEC
This commit is contained in:
parent
45ef80b92f
commit
387d96bd6b
1 changed files with 23 additions and 1 deletions
|
|
@ -120,7 +120,7 @@ class StreamDispatcher extends Writable {
|
|||
}
|
||||
|
||||
/**
|
||||
* Set the bitrate of the current Opus encoder.
|
||||
* Set the bitrate of the current Opus encoder if using a compatible Opus stream.
|
||||
* @param {number} value New bitrate, in kbps
|
||||
* If set to 'auto', the voice channel's bitrate will be used
|
||||
* @returns {boolean} true if the bitrate has been successfully changed.
|
||||
|
|
@ -132,6 +132,28 @@ class StreamDispatcher extends Writable {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the expected packet loss percentage if using a compatible Opus stream.
|
||||
* @param {number} value between 0 and 1
|
||||
* @returns {boolean} Returns true if it was successfully set.
|
||||
*/
|
||||
setPLP(value) {
|
||||
if (!this.bitrateEditable) return false;
|
||||
this.streams.opus.setPLP(value);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables or disables forward error correction if using a compatible Opus stream.
|
||||
* @param {boolean} enabled true to enable
|
||||
* @returns {boolean} Returns true if it was successfully set.
|
||||
*/
|
||||
setFEC(enabled) {
|
||||
if (!this.bitrateEditable) return false;
|
||||
this.streams.opus.setPLP(enabled);
|
||||
return true;
|
||||
}
|
||||
|
||||
_step(done) {
|
||||
if (this.pausedSince) {
|
||||
this._writeCallback = done;
|
||||
|
|
|
|||
Loading…
Reference in a new issue