Skip to content

how can i record the voice to disk?Β #1119

@KoIIIeY

Description

@KoIIIeY
          $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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    staleInformation contained within may be old or outdated.voice

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions