Closed bymayfe closed 3 years ago
First of all, there is no function like connection.subscripte(player);
Secondly, you don't need to create AudioPlayer in that manner :
Refer to this for creating AudioPlayer
You don't need to pass a guild id in AudioPlayer like that.
Moreover, voice connection .subscribe is only a function when a connection is in ready state.
The last image is also true as connection.subscribe() returns a PlayerSubscription not a connection.
First Read DOCS completely and then create a issue
I already read DOCS completely and ı know create player.
My question are =>
Are there player and connection I created and a function that the connection from somewhere else and use ?
connection.subscribe(player);
function => sorry for the spelling mistake
I already read DOCS completely and ı know create player. My question are => Are there player and connection I created and a function that the connection from somewhere else and use ?
connection.subscribe(player);
function => sorry for the spelling mistake
Probably your codes are somewhere confusing you and forcing you to create this issue.
First start with basic examples as in guide and then start making classes.
ı know ı make already system but The main thing I was wondering was how I could use it with getter functions. When I tried, I couldn't get the system to work with the getter functions.
ı know ı make already system but The main thing I was wondering was how I could use it with getter functions. When I tried, I couldn't get the system to work with the getter functions.
Leave everything aside, tell me how can you pause a player which is in idle state ??? As clearly seen in your images
Ist just example. Try getter functins stop pause and unpause and reply please.
getVoiceConnection(message.guild.id) || new AudioPlayer()
Ist just example. Try getter functins stop pause and unpause and reply please.
getVoiceConnection(message.guild.id) || new AudioPlayer()
Ok taking your same example. First of all, AudioPlayer takes options not guild ID. So leaving that aside, now let's talk about stop and pause and unpause functions.
Suppose You have a music player ( for e.g. Groove Music ) and you open it. It will be in idle state since player has nothing to load.
Once you click a music file, its state changes from idle to playing and also controls come up. Then in playing state only, you can pause, unpause and stop functions will work. as see by your images all those functions are working great you just need to play a resource.
Okey. Let me try to explain it like this. -- https://youtu.be/-CdaH4l5Cd8
if ı set player and connection new Map(); ı can get and use pause unpause and stop function.
and maybe getVoicePlayer function must be added
Okey. Let me try to explain it like this. -- https://youtu.be/-CdaH4l5Cd8
if ı set player and connection new Map(); ı can get and use pause unpause and stop function.
and maybe getVoicePlayer function must be added
Thanks for the video, I fully understand your problem now.
You can create your own getter function named getVoicePlayer() by this code :
const { getVoiceConnection } = require('@discordjs/voice');
function getVoicePlayer(guild_id){
let connection = getVoiceConnection(guild_id);
if(!connection) return undefined
if(connection.state?.subscription?.player) return connection.state.subscription.player
else return undefined
}
Thank you so much for the explanation. So how can i make a subscription with getVoiceConnection() function. can i do it is it possible
Okey ı find this function thanks for interest <3
No Problem 👍
Please describe the problem you are having in as much detail as possible: new AudioPlayer()'s functions and getVoiceConnection()'s functions are not working. But joinVoiceChannel()'s and createAudioPlayer()'s functions are working.
Include a reproducible code sample here, if possible: new AudioPlayer().stop() and getVoiceConnection(message.guild.id).subscribe(player)
Further details:
Relevant client options: