locked
Voice Capture from Mic its working server machine but no working client pc RRS feed

  • Question

  • User-177445701 posted

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

    SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["con"].ConnectionString.ToString());
    Timer t = new Timer();

    protected void Page_Load(object sender, EventArgs e)
    {
    btnStop.Enabled = false;
    }

    protected void btnRecord_Click(object sender, EventArgs e)
    {
    record("open new Type waveaudio Alias recsound", "", 0, 0);
    record("record recsound", "", 0, 0);
    btnRecord.Enabled = false;
    btnStop.Enabled = true;
    }

    protected void btnStop_Click(object sender, EventArgs e)
    {
    //timer1.Enabled = false;
    string strPath = Server.MapPath("Uploads");
    strPath = strPath + "\\example.wav";
    record("save recsound " + strPath, "", 0, 0);
    record("close recsound", "", 0, 0);

    RecAudio.Visible = true;
    RecAudio.Src = "~/Uploads/example.wav";


    //System.IO.File.WriteAllBytes("f:\\Test.wav", bytes);

    btnRecord.Enabled = true;
    //btnSave.Enabled = true;
    UpdateTimer.Enabled = true;
    }

    Above code is working properly on server machine but it can not record voice of client pc microphone.

    Thursday, July 19, 2018 8:15 AM

All replies

  • User753101303 posted

    Hi,

    Keep in mind that this code runs on the web server. It is a classic catch when starting as you are developping on a machine which is both the server and the client. Still you need to think about "where" each part will really run.

    It needs to be done client side using  JavaScript for example start with https://www.html5rocks.com/en/tutorials/getusermedia/intro/

    Thursday, July 19, 2018 8:58 AM