lavalink-devs / Lavalink

Standalone audio sending node based on Lavaplayer.
https://lavalink.dev/
MIT License
1.56k stars 673 forks source link

Playing local audio files #76

Closed ShyPianoGuy closed 6 years ago

ShyPianoGuy commented 6 years ago

how would i go on about playing a local file?

freyacodes commented 6 years ago

Never tried this. Presumably, you would have to send the file path as the identifier. Bear in mind that the file is local to the lavalink server receiving the request.

ShyPianoGuy commented 6 years ago

oh so something like ?identifier=/path/to/file?

MrJacz commented 6 years ago

I'd assume so

ShyPianoGuy commented 6 years ago

i tried, got nothing :(

freyacodes commented 6 years ago

You need to URL encode the parameter.

/path/to/file becomes %2Fpath%2Fto%2Ffile

devoxin commented 6 years ago

Also don't forget to enable the local audio source manager in application.yml

ShyPianoGuy commented 6 years ago

still didn't seem to work. My application has local: true and i did the URL encoded way and tried multiple paths and still didn't seem to work

Macleykun commented 6 years ago

You need to use it like this: .play file://Music/RickRolledMe.mp3 Music would be the folder you added in the same folder where the fredboat.jar file is.

However there is a little bug. You can't have any spaces in your path or it won't work.

I'm so dump. Tottaly unrelated to the issue. Please ignore this.

freyacodes commented 6 years ago

The audio file is on the server, right?

ShyPianoGuy commented 6 years ago

yes @Frederikam

MrJacz commented 6 years ago

So after testing, the file has to be in the same folder as the Lavalink.jar file, the URL to get the track is http://localhost:2333/loadtracks?identifier=TheFileName.extension Image

devoxin commented 6 years ago

I'm not sure the file has to be in the same folder, I've had MP3 tracks in my music folder on Windows (no spaces, though), identifier isn't URL encoded (using lavalink.py V2) and it works

devoxin commented 6 years ago

image

devoxin commented 6 years ago

Also to clarify, paths containing spaces are also working for me.

MrJacz commented 6 years ago

Thats werid, didnt work for me

devoxin commented 6 years ago

What lavalink wrapper are you using?

MrJacz commented 6 years ago

Discord.js-lavalink (My own) but wrapper doesn't matter, its what you use to resolve the track, lol

shikhir-arora commented 6 years ago

Can also confirm it works for me and it doesn't have to be in the Lavalink folder.

screen shot 2018-02-24 at 11 14 37 pm screen shot 2018-02-24 at 11 14 21 pm
freyacodes commented 6 years ago

Discord.js-lavalink (My own) but wrapper doesn't matter, its what you use to resolve the track, lol

If your wrapper doesn't percent encode the string it should fail. Eg you need %20 instead of a space.

MrJacz commented 6 years ago

@Frederikam The users of my wrapper are to handle resolving of the tracks themselves... it doesnt do anything on the rest side...

schnapster commented 6 years ago

To sum up the given answers:

If this does not resolve the issue, please post logs of the server and/or show what happens when you curl the /loadtracks endpoint.