Open KoIIIeY opened 1 year ago
$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?
The voice receive is non functioning, this part of code is unfinished since there is no official documentation to implement it.
Can someone write an example of recording voice to disk?