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

how can i record the voice to disk? #1119

Open
KoIIIeY opened this issue May 17, 2023 · 1 comment
Open

how can i record the voice to disk? #1119

KoIIIeY opened this issue May 17, 2023 · 1 comment
Labels

Comments

@KoIIIeY
Copy link

KoIIIeY commented May 17, 2023

          $discord->joinVoiceChannel($channel, false, false, null, true)->then(function (VoiceClient $vc) use ($channel, $ffmpeg, 
                $audioOutput)  {
                $vc->playFile(storage_path('44.wav')); // work

                $vc->on('ready', function(...$data) use($vc, $audioOutput){ //never called
                    dump(['ready', $data]);

                    $receiveStream = $vc->getRecieveStream(272445599360614401);
                    dump(['receive stream', $receiveStream?->isReadable()]);


                    $dest = new \React\Stream\WritableResourceStream(fopen($audioOutput, 'a'));
                    $receiveStream?->pipeOpus($dest);


                    echo "Stream recorded.", PHP_EOL;
                });

                $vc->on('channel-opus', function(...$data) use($audioOutput){ //never called
                    dump(['speak', $data]);

                });

                $vc->on('channel-pcm', function(...$data) use($audioOutput){ //never called
                    dump(['speak', $data]);
                });


            },function ($err){ dump($err); });

Can someone write an example of recording voice to disk?

@SQKo
Copy link
Member

SQKo commented May 22, 2023

The voice receive is non functioning, this part of code is unfinished since there is no official documentation to implement it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants