streamify-audio 2.1.13 → 2.1.14
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/Player.js +24 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "streamify-audio",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.14",
|
|
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/Player.js
CHANGED
|
@@ -47,6 +47,7 @@ class Player extends EventEmitter {
|
|
|
47
47
|
this._prefetchedTrack = null;
|
|
48
48
|
this._prefetching = false;
|
|
49
49
|
this._changingStream = false;
|
|
50
|
+
this._manualSkip = false;
|
|
50
51
|
|
|
51
52
|
this.autoLeave = {
|
|
52
53
|
enabled: options.autoLeave?.enabled ?? true,
|
|
@@ -197,15 +198,17 @@ class Player extends EventEmitter {
|
|
|
197
198
|
|
|
198
199
|
this.emit('trackEnd', track, 'finished');
|
|
199
200
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
if (this.autoplay.enabled && track) {
|
|
205
|
-
await this._handleAutoplay(track);
|
|
201
|
+
if (!this._manualSkip) {
|
|
202
|
+
const next = this.queue.shift();
|
|
203
|
+
if (next) {
|
|
204
|
+
this._playTrack(next);
|
|
206
205
|
} else {
|
|
207
|
-
this.
|
|
208
|
-
|
|
206
|
+
if (this.autoplay.enabled && track) {
|
|
207
|
+
await this._handleAutoplay(track);
|
|
208
|
+
} else {
|
|
209
|
+
this.emit('queueEnd');
|
|
210
|
+
this._resetInactivityTimeout();
|
|
211
|
+
}
|
|
209
212
|
}
|
|
210
213
|
}
|
|
211
214
|
});
|
|
@@ -481,8 +484,16 @@ class Player extends EventEmitter {
|
|
|
481
484
|
this.stream = null;
|
|
482
485
|
}
|
|
483
486
|
|
|
487
|
+
this._manualSkip = true;
|
|
488
|
+
const next = this.queue.shift();
|
|
484
489
|
this.audioPlayer.stop();
|
|
485
|
-
|
|
490
|
+
|
|
491
|
+
if (next) {
|
|
492
|
+
await this._playTrack(next);
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
this._manualSkip = false;
|
|
496
|
+
return next;
|
|
486
497
|
}
|
|
487
498
|
|
|
488
499
|
async previous() {
|
|
@@ -495,8 +506,11 @@ class Player extends EventEmitter {
|
|
|
495
506
|
this.stream = null;
|
|
496
507
|
}
|
|
497
508
|
|
|
509
|
+
this._manualSkip = true;
|
|
498
510
|
this.audioPlayer.stop();
|
|
499
|
-
|
|
511
|
+
const result = await this._playTrack(prev);
|
|
512
|
+
this._manualSkip = false;
|
|
513
|
+
return result;
|
|
500
514
|
}
|
|
501
515
|
|
|
502
516
|
stop() {
|