#audio file isn't played
3 messages · Page 1 of 1 (latest)
const connection = joinVoiceChannel({
channelId: '1085663926592737334',
guildId: '1085663926592737330',
adapterCreator: client.guilds.cache.get("1085663926592737330").voiceAdapterCreator,
selfDeaf: false,
selfMute: false
});
const player = createAudioPlayer({
behaviors: {
noSubscriber: NoSubscriberBehavior.Play
}
});
const resource = createAudioResource(path.join(__dirname, 'response/output.wav'))
player.play(resource)
const subscription = connection.subscribe(player)
player.on(AudioPlayerStatus.Playing, () => {
console.log('Broadcasting reply to Discord.')
})
player.on('error', error => {
console.error(`Error: ${error.message} with resource ${error.resource.metadata.title}`);
});
if (subscription) {
setTimeout(() => subscription.unsubscribe(), 25000)
}
Have you tried swapping player.play() and connection.subscribe() so player.play() comes after it?