In the DiscordJs Voice documentation it is stated that AudioPlayer is reusable, so I can create only one instance of it and use it all the time. However, I did not find any mentions about reusability of AudioResource. For example, I want to play the first song in the array:
JavaScript
x
3
1
resource = createAudioResource(playlist[0]);
2
player.play(resource);
3
But if I want to create queue by adding more songs to the playlist, what should I do with the resource? Declare another resource1? Or can I do something like:
JavaScript
1
2
1
resource.read(playlist[1])
2
Advertisement
Answer
Audio resources are not reusable. You will need to simply make another resource
You can however reuse the variable, not the resource
JavaScript
1
2
1
resource = createAudioResource(playlist[1])
2