🐛 Handle videos unavailable
This commit is contained in:
parent
d79c39949d
commit
0c5223fea8
1 changed files with 8 additions and 8 deletions
|
@ -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(() => {
|
setTimeout(() => {
|
||||||
if (queue.stream) queue.stream.destroy()
|
if (queue.stream) queue.stream.destroy()
|
||||||
queue.stream = newStream
|
queue.stream = newStream
|
||||||
|
@ -1124,6 +1116,14 @@ class Player extends EventEmitter {
|
||||||
// Play the next track
|
// Play the next track
|
||||||
return this._playTrack(queue, false)
|
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)
|
}, 1000)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue