From 3dc617b38b9bc644eaad5c691aa58b1e7523e225 Mon Sep 17 00:00:00 2001 From: Wizzard Date: Mon, 5 Feb 2024 23:25:44 -0500 Subject: [PATCH] Fix video not looping on end --- commands/livestream.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/commands/livestream.js b/commands/livestream.js index 6b76db2..29db3fa 100644 --- a/commands/livestream.js +++ b/commands/livestream.js @@ -47,23 +47,22 @@ module.exports = { player.on('error', err => console.error(err)); - player.on('end', () => { - player.play({ + const playStream = () => { + player.play(videoLink, { kbpsVideo: 7000, fps: 60, hwaccel: true, kbpsAudio: 128, volume: 1, }); + }; + + player.on('finish', () => { + console.log('Media ended, replaying...'); + playStream(); }); - player.play({ - kbpsVideo: 7000, - fps: 60, - hwaccel: true, - kbpsAudio: 128, - volume: 1, - }); + playStream(); message.channel.send('Livestream started with the provided video link.') .then(msg => setTimeout(() => msg.delete().catch(console.error), deleteTimeout));