Skip to content
This repository has been archived by the owner on Jun 24, 2024. It is now read-only.

Local files support #3

Closed
widepeepoclap opened this issue Feb 18, 2022 · 13 comments
Closed

Local files support #3

widepeepoclap opened this issue Feb 18, 2022 · 13 comments

Comments

@widepeepoclap
Copy link

Hello,
I have a sound pad bot that plays a lot of audio files directly from disk to reduce load times. Is it possible to implement local files support or is there already a way to do it?
Thank you!

@davidzeng0
Copy link
Owner

There is currently no way to play directly from the disk, however you can set up an http server to serve those files and use a network FileTrack (see docs/FileTrack.md)

@davidzeng0
Copy link
Owner

If this is something you need then I can work on this issue

@widepeepoclap
Copy link
Author

Was thinking about doing the same thing after making this issue. I believe that should work, but I'd love to see it natively supported in the future.
I deeply appreciate your efforts on this perfect project, thanks a lot!

@davidzeng0
Copy link
Owner

May I know why you are using this as opposed to lavaplayer (lavalink)?

@widepeepoclap
Copy link
Author

Lavalink has this problem where the track would start playing briefly before the bot becomes fully connected since it doesn't emit a ready event. Sometimes it just stops sending the audio out of nowhere. I've tried other packages like djs/opus and they all cause memory leaks and fragmentation, and have inferior audio quality.

@davidzeng0
Copy link
Owner

davidzeng0 commented Feb 20, 2022

See docs/FileTrack.md on how to use it

For security purposes, you may want to prevent users from attempting to play local files on your system if you allow them to play from any arbitrary url

if(track.isLocalFile) return;

@davidzeng0
Copy link
Owner

I forgot to mention that local file support is added, let me know if you have any issues

@widepeepoclap
Copy link
Author

I've been able to run it perfectly on local Ubuntu 20 but on Ubuntu 18 I'm getting this error for some reason.. [Error: Invalid data found when processing input]
It's obviously related to ffmpeg because I couldn't install these packages (libavcodec58 libavformat58 libavutil56 libavfilter7 libswresample3) for sange since they're not available on bionic. I've also built ffmpeg from source but it still didn't help.
I can't update my vps to ubuntu 20 at the moment. Should I just dockerize everything or is there something I can do to get it working on bionic?

@davidzeng0
Copy link
Owner

I don't have experience with docker. Could you paste the error message from building ffmpeg from source?

@davidzeng0
Copy link
Owner

Also if your bot serves many people, its recommended to install ffmpeg from source to avoid the infinite loop problem
The packages are probably just outdated on Ubuntu 18 so if you type out most of the name (e.g sudo apt install libavfilter) and then spam tab key it will show up with the version that's available

@davidzeng0
Copy link
Owner

Another thing is it may be required to update the npm packages via npm update

@widepeepoclap
Copy link
Author

Could you paste the error message from building ffmpeg from source?

I didn't get any errors from that, the error was emitted from the TrackPlayer instance after calling start().
Anyways, the problem was that I installed ffmpeg libraries then built if from source on top.
Everything is working perfectly, as well as playing local files. Thank you a lot.

@davidzeng0
Copy link
Owner

davidzeng0 commented Feb 24, 2022

No problem 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants