aelia
aelia copied to clipboard
Feat(Music): Add autoplay
What does this mean exactly? Considering that it starts playing automatically when you add a song.
Is this issue still needed?
When autoplay is on and the queue finishes, Skyra plays songs related to the last one, similarly to how YouTube's "Play Next" works.
It was a feature in Skyra until we moved to Lavalink, ytdl-core gives us the related videos and a ton more of metadata, but Lavalink doesn't share that much information.
Hey there @kyranet , here is how you can implement autoplay system.
- When the track ends you need the information of the track that ends. With that information you get the identifier (ID) of the song
2.Then you will create a mix from YouTube, with this link https://www.youtube.com/watch?v=${identifier}&list=RD${identifier};
-
Search it using the lavalink library and add the second song from the mix to the queue. Because the first song would be the same one which you played before
-
When the song ends you will have repeat the steps again.
Example:
Song link : https://www.youtube.com/watch?v=Xgs99T6CKPg
Identifier: Xgs99T6CKPg
Mix Link: https://www.youtube.com/watch?v=Xgs99T6CKPg&list=RDXgs99T6CKPg
Result:
