ziplayer 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +150 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +29 -0
- package/dist/index.js.map +1 -0
- package/dist/plugins/BasePlugin.d.ts +17 -0
- package/dist/plugins/BasePlugin.d.ts.map +1 -0
- package/dist/plugins/BasePlugin.js +19 -0
- package/dist/plugins/BasePlugin.js.map +1 -0
- package/dist/plugins/SoundCloudPlugin.d.ts +22 -0
- package/dist/plugins/SoundCloudPlugin.d.ts.map +1 -0
- package/dist/plugins/SoundCloudPlugin.js +171 -0
- package/dist/plugins/SoundCloudPlugin.js.map +1 -0
- package/dist/plugins/SpotifyPlugin.d.ts +26 -0
- package/dist/plugins/SpotifyPlugin.d.ts.map +1 -0
- package/dist/plugins/SpotifyPlugin.js +183 -0
- package/dist/plugins/SpotifyPlugin.js.map +1 -0
- package/dist/plugins/YouTubePlugin.d.ts +25 -0
- package/dist/plugins/YouTubePlugin.d.ts.map +1 -0
- package/dist/plugins/YouTubePlugin.js +314 -0
- package/dist/plugins/YouTubePlugin.js.map +1 -0
- package/dist/plugins/index.d.ts +12 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +31 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/structures/Player.d.ts +54 -0
- package/dist/structures/Player.d.ts.map +1 -0
- package/dist/structures/Player.js +444 -0
- package/dist/structures/Player.js.map +1 -0
- package/dist/structures/PlayerManager.d.ts +16 -0
- package/dist/structures/PlayerManager.d.ts.map +1 -0
- package/dist/structures/PlayerManager.js +77 -0
- package/dist/structures/PlayerManager.js.map +1 -0
- package/dist/structures/Queue.d.ts +24 -0
- package/dist/structures/Queue.d.ts.map +1 -0
- package/dist/structures/Queue.js +78 -0
- package/dist/structures/Queue.js.map +1 -0
- package/dist/types/index.d.ts +75 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -0
- package/package.json +29 -0
- package/src/index.ts +10 -0
- package/src/plugins/BasePlugin.ts +29 -0
- package/src/plugins/index.ts +32 -0
- package/src/structures/Player.ts +526 -0
- package/src/structures/PlayerManager.ts +86 -0
- package/src/structures/Queue.ts +87 -0
- package/src/types/index.ts +82 -0
- package/tsconfig.json +23 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { VoiceConnection } from "@discordjs/voice";
|
|
2
|
+
import { VoiceChannel } from "discord.js";
|
|
3
|
+
import { Readable } from "stream";
|
|
4
|
+
|
|
5
|
+
export interface Track {
|
|
6
|
+
id: string;
|
|
7
|
+
title: string;
|
|
8
|
+
url: string;
|
|
9
|
+
duration: number;
|
|
10
|
+
thumbnail?: string;
|
|
11
|
+
requestedBy: string;
|
|
12
|
+
source: string;
|
|
13
|
+
metadata?: Record<string, any>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface SearchResult {
|
|
17
|
+
tracks: Track[];
|
|
18
|
+
playlist?: {
|
|
19
|
+
name: string;
|
|
20
|
+
url: string;
|
|
21
|
+
thumbnail?: string;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface StreamInfo {
|
|
26
|
+
stream: Readable;
|
|
27
|
+
type: "webm/opus" | "ogg/opus" | "arbitrary";
|
|
28
|
+
metadata?: Record<string, any>;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface PlayerOptions {
|
|
32
|
+
leaveOnEnd?: boolean;
|
|
33
|
+
leaveOnEmpty?: boolean;
|
|
34
|
+
leaveTimeout?: number;
|
|
35
|
+
volume?: number;
|
|
36
|
+
quality?: "high" | "low";
|
|
37
|
+
/**
|
|
38
|
+
* Timeout in milliseconds for plugin operations (search, streaming, etc.)
|
|
39
|
+
* to prevent long-running tasks from blocking the player.
|
|
40
|
+
*/
|
|
41
|
+
extractorTimeout?: number;
|
|
42
|
+
userdata?: Record<string, any>;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface PlayerManagerOptions {
|
|
46
|
+
plugins?: SourcePlugin[];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface ProgressBarOptions {
|
|
50
|
+
size?: number;
|
|
51
|
+
barChar?: string;
|
|
52
|
+
progressChar?: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface PlayerEvents {
|
|
56
|
+
debug: [message: string, ...args: any[]];
|
|
57
|
+
willPlay: [track: Track, upcomingTracks: Track[]];
|
|
58
|
+
trackStart: [track: Track];
|
|
59
|
+
trackEnd: [track: Track];
|
|
60
|
+
queueEnd: [];
|
|
61
|
+
playerError: [error: Error, track?: Track];
|
|
62
|
+
connectionError: [error: Error];
|
|
63
|
+
volumeChange: [oldVolume: number, newVolume: number];
|
|
64
|
+
queueAdd: [track: Track];
|
|
65
|
+
queueRemove: [track: Track, index: number];
|
|
66
|
+
playerPause: [track: Track];
|
|
67
|
+
playerResume: [track: Track];
|
|
68
|
+
playerStop: [];
|
|
69
|
+
playerDestroy: [];
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Plugin interfaces
|
|
73
|
+
export interface SourcePlugin {
|
|
74
|
+
name: string;
|
|
75
|
+
version: string;
|
|
76
|
+
canHandle(query: string): boolean;
|
|
77
|
+
search(query: string, requestedBy: string): Promise<SearchResult>;
|
|
78
|
+
getStream(track: Track): Promise<StreamInfo>;
|
|
79
|
+
getRelatedTracks?(track: string | number, opts?: { limit?: number; offset?: number }): Promise<Track[]>;
|
|
80
|
+
validate?(url: string): boolean;
|
|
81
|
+
extractPlaylist?(url: string, requestedBy: string): Promise<Track[]>;
|
|
82
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"module": "commonjs",
|
|
5
|
+
"lib": ["ES2020"],
|
|
6
|
+
"outDir": "./dist",
|
|
7
|
+
"rootDir": "./src",
|
|
8
|
+
"strict": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"forceConsistentCasingInFileNames": true,
|
|
12
|
+
"declaration": true,
|
|
13
|
+
"declarationMap": true,
|
|
14
|
+
"sourceMap": true,
|
|
15
|
+
"moduleResolution": "node",
|
|
16
|
+
"allowSyntheticDefaultImports": true,
|
|
17
|
+
"experimentalDecorators": true,
|
|
18
|
+
"emitDecoratorMetadata": true,
|
|
19
|
+
"resolveJsonModule": true
|
|
20
|
+
},
|
|
21
|
+
"include": ["src/**/*"],
|
|
22
|
+
"exclude": ["node_modules", "dist", "examples"]
|
|
23
|
+
}
|