Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

discord-player

Package Overview
Dependencies
Maintainers
2
Versions
359
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

discord-player - npm Package Compare versions

Comparing version 5.3.2-dev.0 to 5.3.2-dev.1

43

dist/index.d.ts
/// <reference types="node" />
import { User, VoiceChannel, StageChannel, Collection, Snowflake, Client, GuildResolvable, Guild, GuildChannelResolvable, UserResolvable } from 'discord.js';
import { Readable, Duplex } from 'stream';
import { Readable, Duplex, TransformOptions, Transform } from 'stream';
import { TypedEmitter } from 'tiny-typed-emitter';

@@ -349,2 +349,7 @@ import { AudioPlayerError, AudioResource, VoiceConnection, AudioPlayer, StreamType, AudioPlayerStatus } from '@discordjs/voice';

/**
* Forces next play
* @returns {Promise<void>}
*/
forceNext(): Promise<void>;
/**
* Returns current track

@@ -1003,2 +1008,3 @@ * @type {Track}

* @property {number} [connectionTimeout=20000] The voice connection timeout
* @property {boolean} [smoothVolume=true] Toggle smooth volume transition
*/

@@ -1009,2 +1015,3 @@ interface PlayerInitOptions {

connectionTimeout?: number;
smoothVolume?: boolean;
}

@@ -1097,2 +1104,34 @@

interface VolumeTransformerOptions extends TransformOptions {
type?: "s16le" | "s16be" | "s32le" | "s32be";
smoothness?: number;
volume?: number;
}
declare class VolumeTransformer extends Transform {
private _bits;
private _smoothing;
private _bytes;
private _extremum;
private _chunk;
volume: number;
private _targetVolume;
type: "s16le" | "s32le" | "s16be" | "s32be";
constructor(options?: VolumeTransformerOptions);
_readInt(buffer: Buffer, index: number): number;
_writeInt(buffer: Buffer, int: number, index: number): number;
_applySmoothness(): void;
_transform(chunk: Buffer, encoding: BufferEncoding, done: () => unknown): unknown;
_destroy(err: Error, cb: (error: Error) => void): void;
setVolume(volume: number): void;
setVolumeDecibels(db: number): void;
setVolumeLogarithmic(value: number): void;
get volumeDecibels(): number;
get volumeLogarithmic(): number;
get smoothness(): number;
setSmoothness(smoothness: number): void;
smoothingEnabled(): boolean;
get hasSmoothness(): boolean;
static get hasSmoothing(): boolean;
}
declare class Util {

@@ -1166,2 +1205,2 @@ /**

export { AudioFilters, ErrorStatusCode, ExtractorModel, ExtractorModelData, FFMPEG_ARGS_PIPED, FFMPEG_ARGS_STRING, FFmpegStreamOptions, FiltersName, PlayOptions, Player, PlayerError, PlayerEvents, PlayerInitOptions, PlayerOptions, PlayerProgressbarOptions, PlayerSearchResult, Playlist, PlaylistInitData, PlaylistJSON, QueryResolver, QueryType, Queue, QueueFilters, QueueRepeatMode, RawTrackData, SearchOptions, StreamDispatcher, TimeData, Track, TrackJSON, TrackSource, Util, VoiceEvents, VoiceUtils, createFFmpegStream, version };
export { AudioFilters, ErrorStatusCode, ExtractorModel, ExtractorModelData, FFMPEG_ARGS_PIPED, FFMPEG_ARGS_STRING, FFmpegStreamOptions, FiltersName, PlayOptions, Player, PlayerError, PlayerEvents, PlayerInitOptions, PlayerOptions, PlayerProgressbarOptions, PlayerSearchResult, Playlist, PlaylistInitData, PlaylistJSON, QueryResolver, QueryType, Queue, QueueFilters, QueueRepeatMode, RawTrackData, SearchOptions, StreamDispatcher, TimeData, Track, TrackJSON, TrackSource, Util, VoiceEvents, VoiceUtils, VolumeTransformer, VolumeTransformerOptions, createFFmpegStream, version };

@@ -28,2 +28,3 @@ "use strict";

Object.defineProperty(exports, "StreamDispatcher", { enumerable: true, get: function () { return StreamDispatcher_1.StreamDispatcher; } });
tslib_1.__exportStar(require("./VoiceInterface/VolumeTransformer"), exports);
var Util_1 = require("./utils/Util");

@@ -30,0 +31,0 @@ Object.defineProperty(exports, "Util", { enumerable: true, get: function () { return Util_1.Util; } });

5

dist/Player.js

@@ -35,3 +35,4 @@ "use strict";

},
connectionTimeout: 20000
connectionTimeout: 20000,
smoothVolume: true
};

@@ -168,3 +169,3 @@ this.queues = new discord_js_1.Collection();

delete queueInitOptions["metadata"];
queueInitOptions.volumeSmoothness ?? (queueInitOptions.volumeSmoothness = 0.08);
queueInitOptions.volumeSmoothness ?? (queueInitOptions.volumeSmoothness = this.options.smoothVolume ? 0.08 : 0);
queueInitOptions.ytdlOptions ?? (queueInitOptions.ytdlOptions = this.options.ytdlOptions);

@@ -171,0 +172,0 @@ const queue = new Queue_1.Queue(this, guild, queueInitOptions);

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const VolumeTransformer_1 = require("./VoiceInterface/VolumeTransformer");
try {
// eslint-disable-next-line
const mod = require("prism-media");
if (typeof mod.VolumeTransformer.hasSmoothing !== "boolean") {
Reflect.set(mod, "VolumeTransformer", VolumeTransformer_1.VolumeTransformer);
if (!("DISABLE_DISCORD_PLAYER_SMOOTH_VOLUME" in process.env)) {
try {
// eslint-disable-next-line
const mod = require("prism-media");
if (typeof mod.VolumeTransformer.hasSmoothing !== "boolean") {
Reflect.set(mod, "VolumeTransformer", VolumeTransformer_1.VolumeTransformer);
}
}
catch {
/* do nothing */
}
}
catch {
/* do nothing */
}

@@ -105,2 +105,14 @@ "use strict";

/**
* Forces next play
* @returns {Promise<void>}
*/
async forceNext() {
if (this.connection.audioResource) {
this.connection.emit("finish", this.connection.audioResource);
}
else if (this.tracks.length) {
await this.play();
}
}
/**
* Returns current track

@@ -107,0 +119,0 @@ * @type {Track}

@@ -174,4 +174,5 @@ "use strict";

throw new PlayerError_1.PlayerError("Audio resource is not available!", PlayerError_1.ErrorStatusCode.NO_AUDIO_RESOURCE);
if (resource.ended)
return void this.emit("error", new PlayerError_1.PlayerError("Cannot play a resource that has already ended."));
if (resource.ended) {
return void this.emit("finish", resource);
}
if (!this.audioResource)

@@ -178,0 +179,0 @@ this.audioResource = resource;

@@ -111,3 +111,3 @@ "use strict";

smoothingEnabled() {
return Number.isFinite(this._smoothing) && this._smoothing > 0;
return typeof this._smoothing === "number" && !Number.isNaN(this._smoothing) && Number.isFinite(this._smoothing) && this._smoothing > 0;
}

@@ -114,0 +114,0 @@ get hasSmoothness() {

{
"name": "discord-player",
"version": "5.3.2-dev.0",
"version": "5.3.2-dev.1",
"description": "Complete framework to facilitate music commands using discord.js",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc