Common actions
Using Shared Audio Player
Learn how to optimize resource usage by sharing same audio player across multiple queues
For music bots who basically broadcast same stream on all guilds, it is possible to share same audio player in order to reduce resource usage. Sharing audio player basically means using one single audio player for all queues.
Pros of using shared audio player
- Less memory usage
- Useful for radio streams or broadcasted streams
- Saves bandwidth by using only one stream source
Cons of using shared audio player
- Volume controls, audio filters are not independent
- It means that if one queue updates volume, the volume will change for all other queues who are using this audio player
- If the source panics, all the subscribers are affected
- If not done properly, destroying one queue can end stream for all other queues
Setting Up
With this setup, only one queue needs to initialize the player.
Performing commands such as pause()
, play()
, skip()
etc will affect all subscribers since they all share same
source.