streamify-audio 2.0.4 → 2.0.6
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/package.json +1 -1
- package/src/discord/Stream.js +18 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "streamify-audio",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.6",
|
|
4
4
|
"description": "Dual-mode audio library: HTTP streaming proxy + Discord player (Lavalink alternative). Supports YouTube, Spotify, SoundCloud with audio filters.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
package/src/discord/Stream.js
CHANGED
|
@@ -34,9 +34,26 @@ class StreamController {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
this.startTime = Date.now();
|
|
37
|
-
const videoId = this.track._resolvedId || this.track.id;
|
|
38
37
|
const source = this.track.source || 'youtube';
|
|
39
38
|
|
|
39
|
+
let videoId = this.track._resolvedId || this.track.id;
|
|
40
|
+
|
|
41
|
+
if (source === 'spotify' && !this.track._resolvedId) {
|
|
42
|
+
log.info('STREAM', `Resolving Spotify track to YouTube: ${this.track.title}`);
|
|
43
|
+
try {
|
|
44
|
+
const spotify = require('../providers/spotify');
|
|
45
|
+
videoId = await spotify.resolveToYouTube(this.track.id, this.config);
|
|
46
|
+
this.track._resolvedId = videoId;
|
|
47
|
+
} catch (error) {
|
|
48
|
+
log.error('STREAM', `Spotify resolution failed: ${error.message}`);
|
|
49
|
+
throw new Error(`Failed to resolve Spotify track: ${error.message}`);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (!videoId || videoId === 'undefined') {
|
|
54
|
+
throw new Error(`Invalid track ID: ${videoId} (source: ${source}, title: ${this.track.title})`);
|
|
55
|
+
}
|
|
56
|
+
|
|
40
57
|
log.info('STREAM', `Creating stream for ${videoId} (${source})`);
|
|
41
58
|
|
|
42
59
|
let url;
|