C#如何将麦克风语音流式传输到HTTP?

时间:2017-04-16 19:28:42

标签: c#

我可以从麦克风录制语音,然后将.wav文件上传到http网络服务器。

using Microsoft.VisualBasic.Devices;
using Microsoft.VisualBasic;
using System.Runtime.InteropServices;

[DllImport("winmm.dll", EntryPoint = "mciSendStringA", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
private static extern int mciSendString(string lpstrCommand, string lpstrReturnString, int uReturnLength, int hwndCallback);

Public static void recorder()
{
    mciSendString("open new Type waveaudio Alias recsound", "", 0, 0);
    mciSendString("record recsound", "", 0, 0);
}

Public static void stoprecord()
{
    mciSendString("save recsound " + file_output_name, "", 0, 0);
    mciSendString("close recsound ", "", 0, 0);
    Computer c = new Computer();
    c.Audio.Stop();
}
Public static void uploader()
{
    webclient wc = new webclient();
    wc.uploadfile("http://example.com/index.php", file_output_name);
}

但是如何将实时语音流式传输到http服务器?

0 个答案:

没有答案