Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] VoiceChannel Stream #81

Closed
koo04 opened this issue Dec 6, 2015 · 4 comments
Closed

[Question] VoiceChannel Stream #81

koo04 opened this issue Dec 6, 2015 · 4 comments

Comments

@koo04
Copy link

koo04 commented Dec 6, 2015

I am attempting to now stream to the discord server. After connecting to the Voice Channel, I can use 'connection' to do 'playStream(stream)' but what is it wanting exactly? I used 'playRawStream(stream, callback)' but it did not seem to start speaking on the server. Is there something I am missing?

Here is a snippet of my current code:

          myBot.joinVoiceChannel(myBot.channels[channelId], function (err, connection) {
            if(err) console.error("Error joining Voice Channel:\n   " + err);

            console.log("Starting Radio");
            Icy.get(settings.radioCast, function (res) {
  //            console.error(res.headers);

              res.on('metadata', function (metadata) {
                var parsed = Icy.parse(metadata);
                console.info(parsed);
              });

//              var dec = res.pipe(new Lame.Decoder()).pipe(connection.playRawStream());
              connection.playStream(res, function(err, str){console.log(err); console.log(str)});

I apologize if this is annoying. There is no documentation on this and I would like to get it working sooner rather then later.

@amishshah
Copy link
Member

Do you have ffmpeg/avconv and node-opus (should be installed with discord.js) and also what type of audio is res? Is res a eadable stream?

@koo04
Copy link
Author

koo04 commented Dec 7, 2015

I am not sure that I have ffmpeg. I didn't think about that. I will check. Node-opus I am pretty sure was there, but will install it in case.

I am unsure the audio format of res. If you notice, I had commented out a line that is the res pipe which I used Lame's decoder on. I think that decoder changes it to mp3 format, but not completely sure. It comes from Icy.

@amishshah
Copy link
Member

Ok, well first I'd try installing ffmpeg and adding it to your path. Before you run your bot, make sure you can run ffmpeg from command line.

If it doesn't work after that, then try re-adding the Lame decoder bit

@koo04
Copy link
Author

koo04 commented Dec 7, 2015

It seemed that it was that ffmpeg was not installed right. I re-installed using npm and it works like a charm. I did have to pipe the decode as well.

Thank you tons for the help! I will be submitting ACTUAL bug reports from now on, as you develop the voice side of this. Maybe even PRs. We will see.

@koo04 koo04 closed this as completed Dec 7, 2015
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants