discordjs / voice

Implementation of the Discord Voice API for discord.js and other JS/TS libraries
Apache License 2.0
327 stars 110 forks source link

Allow users to pass a custom Opus library #185

Open Hazmi35 opened 3 years ago

Hazmi35 commented 3 years ago

Is your feature request related to a problem? Please describe. No.

Describe the ideal solution Adding an option to choose explicitly what opus lib to be used

Describe alternatives you've considered An option to use own custom opus library

Additional context Allowing users to pass what opus lib to choose explicitly or allowing them to pass custom opus library

kyranet commented 3 years ago

What's the use-case for this?

Hazmi35 commented 3 years ago

Originally, I thought of "locking" @discordjs/voice to use a specific opus library, but this can be done by the user itself. For example: Encode the audio to ogg/opus first then use inputType: "ogg/opus".

But an option to use a custom opus library or giving an option to the user to handle the opus library by itself is better, I don't know yet what the other use-cases for this are except locking down to a specific opus library or using a custom opus library.

Or is this already possible using getNode(StreamType).addEdge from TransformerGraph? I'm not that familiar with the codebase here, but I'll try to understand it.

amishshah commented 3 years ago

This would be a limitation of prism-media, as it just picks the Opus library that offers the best performance from those that are installed. I'm not really sure why you'd want to override this behaviour? If you want to lock your bot to use a specific Opus library, you can make that Opus library a dependency of your project.

Hazmi35 commented 3 years ago

Yes, sorry. The original idea was locking down to a specific opus library, but I changed my mind. The new idea was a way for users to pass a custom opus library.