Trying to play a local wav file in a vc but it doesn't play more than a min.

Trying to play a local wav audio file in a vc but it doesn't play for more than a min even though the actual file is of 3 mins. Code:
if (GuildVoice.has(message.guild.id))
return message.reply("Sorry! already in another voice channel");

let connection;
connection = await joinVoiceChannel({
channelId: message.member.voice.channelId,
guildId: message.guild.id,
selfMute: false,
selfDeaf: true,
adapterCreator: message.guild.voiceAdapterCreator,
});

let filePath =
"./Audio/path/to-file.wav";

let src = await createAudioResource(filePath, {
inputType: StreamType.Arbitrary,
});

const player = await createAudioPlayer({
behaviors: { noSubscriber: "pause" },
});
await connection.subscribe(player);
await player.play(src);

player.on(AudioPlayerStatus.Idle, async () => {
await sleep(1500);
connection.destroy();
});
if (GuildVoice.has(message.guild.id))
return message.reply("Sorry! already in another voice channel");

let connection;
connection = await joinVoiceChannel({
channelId: message.member.voice.channelId,
guildId: message.guild.id,
selfMute: false,
selfDeaf: true,
adapterCreator: message.guild.voiceAdapterCreator,
});

let filePath =
"./Audio/path/to-file.wav";

let src = await createAudioResource(filePath, {
inputType: StreamType.Arbitrary,
});

const player = await createAudioPlayer({
behaviors: { noSubscriber: "pause" },
});
await connection.subscribe(player);
await player.play(src);

player.on(AudioPlayerStatus.Idle, async () => {
await sleep(1500);
connection.destroy();
});
5 Replies
d.js toolkit
d.js toolkit15mo 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!
wen
wenOP15mo ago
node: v18.14.2 discord.js: v14.13.0 i added the player.on error even but it doesnt log anything
wen
wenOP15mo ago
No description
wen
wenOP15mo ago
ok uh nvm it got fixed after i updated to v0.16.0 but i have another problem the volume.setVolume() isn't changing the volume
Lillie
Lillie15mo ago
You don't pass the inlineVolume parameter in createAudioResouce.
Want results from more Discord servers?
Add your server