I have set up a REST service, and I am attempting to read the audio stream, but I am getting 0 bytes. Here is the call in C#:
Code: Select all
public string Read(Stream s)
{
string output = "No input";
if (s != null)
{
output = "Input detected ";
s.Seek(0, SeekOrigin.Begin);
output += " | Type = " + s.GetType();
output += " | Length = " + s.Length;
int size = 0;
byte[] b = new byte[1024];
int bytesRead = 0;
do
{
bytesRead = s.Read(b, 0, b.Length);
size += bytesRead;
} while (bytesRead > 0);
if (size > 0)
{
output = size + " bytes";
}
s.Close();
}
return "Read Result: " + output;
}
Code: Select all
Read Result: Input detected | Type = System.IO.MemoryStream | Length = 0
So far I have tried to change the input to be a MemoryStream object, but that comes in as null. Any other suggestions to get this REST service to receive the audio?