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();
});