sedmelluq / lavaplayer

Audio player library for Discord
Apache License 2.0
964 stars 247 forks source link

c.s.d.l.p.DefaultAudioPlayerManager - No matches for track with identifier #585

Closed alhen18 closed 3 years ago

alhen18 commented 3 years ago

Hey!

My bot can not load any songs from youtube, every time I put in a new track the message in the title shows up in my debug console.

I am running Java 15, but I have tried Java 8 and 11 also. I build my application in gradle and I am running lavaplayer 1.3.71.

I do hope that someone in here can point me in a direction on where my problem is, if you should need any kind of information to help me out, then just tell me.

MCOfficer commented 3 years ago

Aare you sure you registered the YouTubeAudioSourceManager?

alhen18 commented 3 years ago

I did not use YouTubeAudioSourceManager, but i did it like this insteed: final AudioPlayerManager playerManager = new DefaultAudioPlayerManager(); playerManager.getConfiguration() .setFrameBufferFactory(NonAllocatingAudioFrameBuffer::new); AudioSourceManagers.registerLocalSource(playerManager); final AudioPlayer player = playerManager.createPlayer(); AudioProvider provider = new LavaPlayerAudioProvider(player);

There are ofc some more code behind that do the connection to discord and other stuff like that, which works find

This is a play command for the bot, I do use discord4j for the connection to the bot. final TrackScheduler scheduler = new TrackScheduler(player); commands.put("play", event -> Mono.justOrEmpty(event.getMessage().getContent()) .map(content -> Arrays.asList(content.split(" "))) .doOnNext(command -> playerManager.loadItem(command.get(1), scheduler)) .then());

MCOfficer commented 3 years ago

Judging by that code, you never call AudioSourceManagers.registerRemoteSources or manually register the YoutubeAudioSourceManager. That would by why.

freyacodes commented 3 years ago

The source manager you registered is the local source manager, which is only useful for playing local files.

(PS: Looks like we're almost studying the same uni course, except I'm SE 2018)

alhen18 commented 3 years ago

Okay, I just thought that the AudioSourceMananger cover every source, but i will try and call the RemoteSoures register or manually call the YouTubeAudioSoruce.

And Frederikam we are taking the same courses at SUD, im just on the ST insteed

freyacodes commented 3 years ago

Okay, I just thought that the AudioSourceMananger cover every source

It's an interface