Audio bitrate support (#1439)

* Audio bitrate support

Note: not implemented for VoiceBroadcasts

* Fix default args, auto bitrate

* Late night typos are the best

* Changes bitrate to kbps for VoiceChannel stuff

* Add methods to manipulate bitrate while encoding
This commit is contained in:
Crawl
2017-08-12 11:23:47 +02:00
parent d513c4bbb9
commit cba4cc2400
9 changed files with 97 additions and 55 deletions

View File

@@ -25,7 +25,7 @@ class VoiceChannel extends GuildChannel {
* The bitrate of this voice channel
* @type {number}
*/
this.bitrate = data.bitrate;
this.bitrate = data.bitrate * 0.001;
/**
* The maximum amount of users allowed in this channel - 0 means unlimited.
@@ -76,16 +76,17 @@ class VoiceChannel extends GuildChannel {
}
/**
* Sets the bitrate of the channel.
* Sets the bitrate of the channel (in kbps).
* @param {number} bitrate The new bitrate
* @returns {Promise<VoiceChannel>}
* @example
* // Set the bitrate of a voice channel
* voiceChannel.setBitrate(48000)
* .then(vc => console.log(`Set bitrate to ${vc.bitrate} for ${vc.name}`))
* voiceChannel.setBitrate(48)
* .then(vc => console.log(`Set bitrate to ${vc.bitrate}kbps for ${vc.name}`))
* .catch(console.error);
*/
setBitrate(bitrate) {
bitrate *= 1000;
return this.edit({ bitrate });
}