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

@@ -431,6 +431,8 @@ class VoiceConnection extends EventEmitter {
* @property {number} [seek=0] The time to seek to
* @property {number} [volume=1] The volume to play at
* @property {number} [passes=1] How many times to send the voice packet to reduce packet loss
* @property {number|string} [bitrate=48000] The bitrate (quality) of the audio.
* If set to 'auto', the voice channel's bitrate will be used
*/
/**
@@ -481,7 +483,7 @@ class VoiceConnection extends EventEmitter {
}
/**
* Plays a stream of 16-bit signed stereo PCM at 48KHz.
* Plays a stream of 16-bit signed stereo PCM.
* @param {ReadableStream} stream The audio stream to play
* @param {StreamOptions} [options] Options for playing the stream
* @returns {StreamDispatcher}
@@ -491,7 +493,7 @@ class VoiceConnection extends EventEmitter {
}
/**
* Plays an Opus encoded stream at 48KHz.
* Plays an Opus encoded stream.
* <warn>Note that inline volume is not compatible with this method.</warn>
* @param {ReadableStream} stream The Opus audio stream to play
* @param {StreamOptions} [options] Options for playing the stream
@@ -504,6 +506,7 @@ class VoiceConnection extends EventEmitter {
/**
* Plays a voice broadcast.
* @param {VoiceBroadcast} broadcast The broadcast to play
* @param {StreamOptions} [options] Options for playing the stream
* @returns {StreamDispatcher}
* @example
* // Play a broadcast
@@ -512,8 +515,8 @@ class VoiceConnection extends EventEmitter {
* .playFile('./test.mp3');
* const dispatcher = voiceConnection.playBroadcast(broadcast);
*/
playBroadcast(broadcast) {
return this.player.playBroadcast(broadcast);
playBroadcast(broadcast, options) {
return this.player.playBroadcast(broadcast, options);
}
/**