Bot joining voice channel but not playing audio

Hi everyone. I am making a soundboard and while the bot is successfully joining the voice channel the audio file is not playing. Here are my versions

+-- @discordjs/builders@1.7.0
+-- @discordjs/rest@2.2.0
+-- @discordjs/voice@0.16.1
+-- discord-api-types@0.37.75
+-- discord.js@14.14.1
+-- ffmpeg-static@5.2.0
+-- libsodium-wrappers@0.7.13
-- opusscript@0.0.8 Here is where I cam creating my client ```javascript const client = new Client({ intents: [ GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.GuildVoiceStates ] }); ``` And here is where I am trying to play an audio file. ```javascript /// file - '/audio/audioFile.mp3' const play = (file, voiceChannelId, guild) => { let voiceConnection = joinVoiceChannel({ channelId: voiceChannelId, guildId: guild.id, adapterCreator: guild.voiceAdapterCreator, selfDeaf: false }); const stream = createReadStream(file); const resource = createAudioResource(stream); let audioPlayer = createAudioPlayer({ behaviors: { noSubscriber: NoSubscriberBehavior.Stop } }); audioPlayer.play(resource); voiceConnection.subscribe(audioPlayer); audioPlayer.on(AudioPlayerStatus.Idle, () => { console.log('end'); //voiceConnection.destroy(); }); audioPlayer.on(AudioPlayerStatus.Playing, () => console.log('playing')) audioPlayer.on('error', err => console.log(err)); }; ``` I am not getting any error messages and both the 'playing' and 'end' logs are printed to the console. This is code I have from a file called client.js` the structure in which it is related to the audio file is the following:

client.js
/audio
   audioFile.mp3
Was this page helpful?