receiving audio from a user and playing it with ffplay

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

let subscription = connection.receiver.subscribe(message.author.id, {
    autoDestroy: false,
    emitClose: false
});

const ffplay = exec('ffplay -');

subscription.pipe(ffplay.stdin)

It looks like the subscription is giving audio but the ffplay is not playing it.
Was this page helpful?