fix: docs dispatcher

This commit is contained in:
Elysia
2024-07-24 19:42:12 +07:00
parent 515615cb04
commit f96c623b04
5 changed files with 12 additions and 8 deletions

File diff suppressed because one or more lines are too long

View File

@@ -696,6 +696,7 @@ class VoiceConnection extends EventEmitter {
* .then(connection => { * .then(connection => {
* *
* }); * });
* ```
* @extends {VoiceConnection} * @extends {VoiceConnection}
*/ */
class StreamConnection extends VoiceConnection { class StreamConnection extends VoiceConnection {

View File

@@ -19,7 +19,7 @@ const VolumeInterface = require('../util/VolumeInterface');
* }); * });
* ``` * ```
* @implements {VolumeInterface} * @implements {VolumeInterface}
* @extends {WritableStream} * @extends {BaseDispatcher}
*/ */
class AudioDispatcher extends BaseDispatcher { class AudioDispatcher extends BaseDispatcher {
constructor(player, { seek = 0, volume = 1, fec, plp, bitrate = 96, highWaterMark = 12 } = {}, streams) { constructor(player, { seek = 0, volume = 1, fec, plp, bitrate = 96, highWaterMark = 12 } = {}, streams) {

View File

@@ -17,6 +17,9 @@ const nonce = Buffer.alloc(24);
* @see {@link https://nodejs.org/api/stream.html#stream_class_stream_writable} * @see {@link https://nodejs.org/api/stream.html#stream_class_stream_writable}
*/ */
/**
* @extends {Writable}
*/
class BaseDispatcher extends Writable { class BaseDispatcher extends Writable {
constructor(player, highWaterMark = 12, payloadType, extensionEnabled, streams = {}) { constructor(player, highWaterMark = 12, payloadType, extensionEnabled, streams = {}) {
super({ super({
@@ -59,7 +62,7 @@ class BaseDispatcher extends Writable {
const streamError = (type, err) => { const streamError = (type, err) => {
/** /**
* Emitted when the dispatcher encounters an error. * Emitted when the dispatcher encounters an error.
* @event AudioDispatcher#error * @event BaseDispatcher#error
*/ */
if (type && err) { if (type && err) {
err.message = `${type} stream: ${err.message}`; err.message = `${type} stream: ${err.message}`;
@@ -112,7 +115,7 @@ class BaseDispatcher extends Writable {
if (!this.startTime) { if (!this.startTime) {
/** /**
* Emitted once the stream has started to play. * Emitted once the stream has started to play.
* @event AudioDispatcher#start * @event BaseDispatcher#start
*/ */
this.emit('start'); this.emit('start');
this.startTime = performance.now(); this.startTime = performance.now();
@@ -333,7 +336,7 @@ class BaseDispatcher extends Writable {
_sendPacket(packet) { _sendPacket(packet) {
/** /**
* Emitted whenever the dispatcher has debug information. * Emitted whenever the dispatcher has debug information.
* @event AudioDispatcher#debug * @event BaseDispatcher#debug
* @param {string} info The debug info * @param {string} info The debug info
*/ */
this._setSpeaking(1); this._setSpeaking(1);
@@ -379,7 +382,7 @@ class BaseDispatcher extends Writable {
} }
/** /**
* Emitted when the dispatcher starts/stops video. * Emitted when the dispatcher starts/stops video.
* @event AudioDispatcher#videoStatus * @event VideoDispatcher#videoStatus
* @param {boolean} value Whether or not the dispatcher is enable video * @param {boolean} value Whether or not the dispatcher is enable video
*/ */
this.emit('videoStatus', value); this.emit('videoStatus', value);
@@ -391,7 +394,7 @@ class BaseDispatcher extends Writable {
} }
/** /**
* Emitted when the dispatcher starts/stops video. * Emitted when the dispatcher starts/stops video.
* @event AudioDispatcher#streamStatus * @event VideoDispatcher#streamStatus
* @param {boolean} isPaused Whether or not the dispatcher is pause video * @param {boolean} isPaused Whether or not the dispatcher is pause video
*/ */
this.emit('streamStatus', value); this.emit('streamStatus', value);

View File

@@ -12,7 +12,7 @@ const BaseDispatcher = require('./BaseDispatcher');
* }); * });
* ``` * ```
* @implements {VolumeInterface} * @implements {VolumeInterface}
* @extends {WritableStream} * @extends {BaseDispatcher}
*/ */
class VideoDispatcher extends BaseDispatcher { class VideoDispatcher extends BaseDispatcher {
constructor(player, highWaterMark = 12, streams, fps) { constructor(player, highWaterMark = 12, streams, fps) {