mirror of
https://github.com/danbulant/discord.js
synced 2026-06-07 16:52:16 +00:00
rewrite some docs and refactor some names
This commit is contained in:
parent
7f9ea762ed
commit
efd1d0c738
4 changed files with 27 additions and 7 deletions
File diff suppressed because one or more lines are too long
|
|
@ -6,7 +6,12 @@ const EventEmitter = require('events').EventEmitter;
|
||||||
const DefaultPlayer = require('./player/DefaultPlayer');
|
const DefaultPlayer = require('./player/DefaultPlayer');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a connection to a Voice Channel in Discord
|
* Represents a connection to a Voice Channel in Discord.
|
||||||
|
* ```js
|
||||||
|
* // obtained using:
|
||||||
|
* voiceChannel.join().then(connection => {
|
||||||
|
*
|
||||||
|
* });
|
||||||
* @extends {EventEmitter}
|
* @extends {EventEmitter}
|
||||||
*/
|
*/
|
||||||
class VoiceConnection extends EventEmitter {
|
class VoiceConnection extends EventEmitter {
|
||||||
|
|
@ -220,7 +225,7 @@ class VoiceConnection extends EventEmitter {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Play the given stream in the voice connection
|
* Plays and converts an audio stream in the voice connection
|
||||||
* @param {ReadableStream} stream the audio stream to play
|
* @param {ReadableStream} stream the audio stream to play
|
||||||
* @returns {StreamDispatcher}
|
* @returns {StreamDispatcher}
|
||||||
* @example
|
* @example
|
||||||
|
|
@ -238,13 +243,13 @@ class VoiceConnection extends EventEmitter {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Plays a stream of PCM data
|
* Plays a stream of 16-bit signed stereo PCM at 48KHz.
|
||||||
* @param {ReadableStream} pcmStream the PCM stream
|
* @param {ReadableStream} stream the audio stream to play.
|
||||||
* @returns {StreamDispatcher}
|
* @returns {StreamDispatcher}
|
||||||
*/
|
*/
|
||||||
playPCMStream(pcmStream) {
|
playConvertedStream(stream) {
|
||||||
this._shutdown();
|
this._shutdown();
|
||||||
const dispatcher = this.player.playPCMStream(pcmStream);
|
const dispatcher = this.player.playPCMStream(stream);
|
||||||
return dispatcher;
|
return dispatcher;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,15 @@ nonce.fill(0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The class that sends voice packet data to the voice connection.
|
* The class that sends voice packet data to the voice connection.
|
||||||
|
* ```js
|
||||||
|
* // obtained using:
|
||||||
|
* voiceChannel.join().then(connection => {
|
||||||
|
* // you can play a file or a stream here:
|
||||||
|
* connection.playFile('./file.mp3').then(dispatcher => {
|
||||||
|
*
|
||||||
|
* });
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
* @extends {EventEmitter}
|
* @extends {EventEmitter}
|
||||||
*/
|
*/
|
||||||
class StreamDispatcher extends EventEmitter {
|
class StreamDispatcher extends EventEmitter {
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,12 @@ nonce.fill(0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Receives voice data from a voice connection.
|
* Receives voice data from a voice connection.
|
||||||
|
* ```js
|
||||||
|
* // obtained using:
|
||||||
|
* voiceChannel.join().then(connection => {
|
||||||
|
* const receiver = connection.createReceiver();
|
||||||
|
* });
|
||||||
|
* ```
|
||||||
* @extends {EventEmitter}
|
* @extends {EventEmitter}
|
||||||
*/
|
*/
|
||||||
class VoiceReceiver extends EventEmitter {
|
class VoiceReceiver extends EventEmitter {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue