redirection voice from one channel of guild to another channel in another guild

My code now:
const connection = voiceData.connection;

const channel = message.member.voice.channel
const voice = joinVoiceChannel({
channelId: channel.id,
guildId: channel.guild.id,
adapterCreator: channel.guild.voiceAdapterCreator
});

voiceData.listener = voice;

const receiver = connection.receiver;
const speaking = receiver.speaking;

speaking.on('start', (userId) => {

const player = createAudioPlayer({
behaviors: {
noSubscriber: NoSubscriberBehavior.Pause
}
});

const stream = receiver.subscribe(userId);

const resource = createAudioResource(stream, { inputType: StreamType.Opus });
player.play(resource);
voice.subscribe(player);

})
const connection = voiceData.connection;

const channel = message.member.voice.channel
const voice = joinVoiceChannel({
channelId: channel.id,
guildId: channel.guild.id,
adapterCreator: channel.guild.voiceAdapterCreator
});

voiceData.listener = voice;

const receiver = connection.receiver;
const speaking = receiver.speaking;

speaking.on('start', (userId) => {

const player = createAudioPlayer({
behaviors: {
noSubscriber: NoSubscriberBehavior.Pause
}
});

const stream = receiver.subscribe(userId);

const resource = createAudioResource(stream, { inputType: StreamType.Opus });
player.play(resource);
voice.subscribe(player);

})
But i have a one bug: If 2 or more peoples speaking at one time bot sending packets only from one people or bot voice have some lags and send mixed voice how fix it?
4 Replies
d.js toolkit
d.js toolkit12mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button!
duck
duck12mo ago
@discordjs/voice's VoiceConnections can only be subscribed to one AudioPlayer at a time, and each player can only play one AudioResource at a time in order to play the received audio from multiple users at once, you'd likely need a more complex setup to overlay each stream on top of each other in a single audio stream this can likely be achieved with ffmpeg, which can be accessed through prism-media, a dependency of @discordjs/voice however it's up to you to determine what args to use #useful-servers
Инот
ИнотOP12mo ago
Can you help me write a function that takes the stream array and returns the stream of all these streams?
charlcraft
charlcraft12mo ago
Bjr
Want results from more Discord servers?
Add your server