Discord.js: Discord Js playRawStream Error: spawn help ENOENT

Created on 30 Aug 2016  路  11Comments  路  Source: discordjs/discord.js

I try to use the playRawStream function but it doesn't working. I found this code on another post around here. Could you explain me what is wrong here ?

        var chaine = msg.content.split(" ");
        bot.joinVoiceChannel(bot.channels.get("name", "G茅n茅ral").id).then(function(r){
        }).catch(function(error){
            console.log(error);
        });

        if (bot.internal.voiceConnection) {
            var connection = bot.internal.voiceConnection;
            var request = require("request");
            var url = chaine[1];
            var stream = request(url);
            connection.playRawStream(stream).then(intent => {
                bot.reply(m, "playing!").then((msg) => {
                    intent.on("end", () => {
                        bot.updateMessage(msg, "that song has finished now.");
                    });
                }).catch(error);
            }).catch(error); //error is a function who show errors on the console
        }
question (please use Discord instead)

Most helpful comment

Okay it's working nice with youtube-audio-stream package. Thanks a lot for help :-)

All 11 comments

Basically, you need to install ffmpeg and add it to the path.
Duplicate of #500 #429 #418 #286 #205

I already saw some other posts and I installed ffmpeg, still doesn't work.

(For guys who need to install it on Ubuntu : https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu )

When you do ffmpeg in the console, does it error? If yes, add it to the PATH

Or do you get another error now?
(Or does it just not work)

Okay thanks, it wasn't in the PATH. However the error is still here, always on "playRawStream"
I just follow instructions here : http://discordjs.readthedocs.io/en/indev/troubleshooting.html
But nothing works

Did you install Python 2.7.x correctly : python --version return 2.7.X so I guess it's right
Did you install FFMPEG correctly? : seems to be ok, path ok too
Did you install the required C++ compiler tool for your OS? : yes
Is your system supported? Linux x64

Try clearing the npm cache and reinstalling discord.js, do you get any errors?
Also how does the output of ffmpeg look like?

Okay no more errors, but there is no sound emit by the bot.

I haven't tested this at all, but consider doing something along these lines. https://gist.github.com/appellation/6ad6ba2446be7e2d76873ecfc43a6a1f

Thanks for the code but it's the same, no errors and no sound (no green circle around bot icon)
Maybe the link is wrong. Is that correct to send a youtube (https) link to "url" ?

             var stream = request(url);
             vc.playRawStream(stream);

Oh, if you're looking for a YouTube audio stream, check out this package. https://www.npmjs.com/package/youtube-audio-stream

After doing some testing, it seems that there aren't any errors if the stream URL isn't actually an audio stream. This could be your problem.

Okay it's working nice with youtube-audio-stream package. Thanks a lot for help :-)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SirDeadlystrike picture SirDeadlystrike  路  32Comments

tacodan picture tacodan  路  73Comments

chadrien picture chadrien  路  29Comments

zechaos031 picture zechaos031  路  45Comments

tandpfun picture tandpfun  路  27Comments