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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "streamify-audio",
3
- "version": "2.1.13",
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",
@@ -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
- const next = this.queue.shift();
201
- if (next) {
202
- this._playTrack(next);
203
- } else {
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.emit('queueEnd');
208
- this._resetInactivityTimeout();
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
- return this.queue.current;
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
- return this._playTrack(prev);
511
+ const result = await this._playTrack(prev);
512
+ this._manualSkip = false;
513
+ return result;
500
514
  }
501
515
 
502
516
  stop() {