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

10 messages · Page 1 of 1 (latest)

young moon
#

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();
      });
cerulean flareBOT
#
  • What's your exact discord.js npm list discord.js and node node -v version?
  • Not a discord.js issue? Check out #1081585952654360687.
  • 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!
young moon
#

node: v18.14.2
discord.js: v14.13.0

young moon
#

i added the player.on error even but it doesnt log anything

shut summit
#

What /voice version?

young moon
young moon
#

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