diff --git a/src/Player.js b/src/Player.js index c9f8a41..419425e 100644 --- a/src/Player.js +++ b/src/Player.js @@ -1094,14 +1094,6 @@ class Player extends EventEmitter { }) } - newStream.on('error', (error) => { - if (error.message === 'Video unavailable') { - this.emit('error', 'VideoUnavailable', queue.firstMessage) - } else { - this.emit('error', error, queue.firstMessage) - } - }) - setTimeout(() => { if (queue.stream) queue.stream.destroy() queue.stream = newStream @@ -1124,6 +1116,14 @@ class Player extends EventEmitter { // Play the next track return this._playTrack(queue, false) }) + newStream.on('error', (error) => { + if (error.message.includes('Video unavailable')) { + this.emit('error', 'VideoUnavailable', queue.firstMessage) + this._playTrack(queue, false) + } else { + this.emit('error', error, queue.firstMessage) + } + }) }, 1000) }) }