#Streaming twitch audio to VC

8 messages · Page 1 of 1 (latest)

storm blaze
#

Is it possible to live stream audio to a VC?
I'm currently getting the audio as an output from streamlink and want to play it on vc.
By saving streamlink's output as a file and playing that through discord.js, I can get the bot to play what's currently on the file in the vc, but nothing after that. I suppose that the audio resource buffers what's currently on the file and nothing after that but I don't know.
Could someone tell me if this is possible?

rancid moss
#

• What's your exact discord.js npm list discord.js and node node -v version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.

storm blaze
#

important code

exec(`streamlink twitch.tv/${channelName} audio_only --output stream.ogg --force`);
setTimeout(async () => {
    const resourcePath = path.join(__dirname, '..', 'stream.ogg');
    let resource = voice.createAudioResource(fs.createReadStream(resourcePath), {
        inputType: voice.StreamType.Arbitrary
    });
    player.play(resource);

    //GET TWITCH CHAT WITH TMI.JS (ignore this)
    tmiClient.join(channelName);

    await interaction.followUp(`Connected to ${channelName}`);
}, 3000);
sleek zinc
#

you'd need to have it as stream in JS, not a file that gets constantly appended

tropic oak
rancid moss
storm blaze
#

Alright thanks a lot guys. I'm completely new to audio so I don't really understand a lot lol.
This is the final code just in case someone else wants to do this.