NateRickard / Plugin.AudioRecorder

Audio Recorder plugin for Xamarin and Windows
MIT License
164 stars 68 forks source link

Streaming Concurrent Audio does not work #66

Open MikeBrooks-NT opened 2 years ago

MikeBrooks-NT commented 2 years ago

We are using this plugin, we want to stream the audio data as the user speaks to a server and write to a file. Once we use the following code as the documents indicate is the way to retrieve a concurrent stream.

using (var stream = recorder.GetAudioFileStream()) {

                        // this will begin sending the recording audio data as it continues to record
                        byte[] buffer = new byte[stream.Length];
                        stream.Read(buffer, 0, buffer.Length);
                        //var wav = new WavePcmFormat(buffer, numChannels: 1, sampleRate: 8000, bitsPerSample: 128);
                        //var rawDataWithHeader = wav.ToBytesArray();
                        ws.Send(System.Convert.ToBase64String(buffer, 0, buffer.Length));
                    }

This only sends through one line and stops, it does not send everything while recording. Can you please provide some insight on how to get the whole stream while the recording is happening in real time? Thanks a mil