How do I delete a voice recording when I have communicated / sent a voice packet in file stream?

Viewed 28

I can't get rid of the sound before, even though I have given the clear button, when sending a sound, the previous sound is still there. is there something wrong ? I need help

string TEMP_FILE=System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\temp";
string BUFF_FILE=System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\data";  



private void btnPlayVoice_Click(object sender, EventArgs e)
    {
        playMedia(BUFF_FILE);
        lblRecive.Text = "";
    }
private void playMedia(string path )
{if (string.IsNullOrEmpty(path))
 return;
 mPlayer = new SoundPlayer(BUFF_FILE);
 mPlayer.Play();
 btnStopStop.Enabled = true;}

private void btnClearDec_Click(object sender, EventArgs e)
    {

        if (File.Exists(TEMP_FILE))
        File.Delete(TEMP_FILE); 

        if (File.Exists(BUFF_FILE))
            File.Delete(BUFF_FILE);
        lblRecive.Text = "";
        txtKeyDec.Text = "";
        txtMsgDec.Text = "";
        btnPlay.Visible = false;
        btnDec.Visible = false;
    }

when sending voice messages several times, the first sound cannot be deleted, so it is still heard when sending the next message. if the code is unclear, then I can give the project, maybe I will get a solution

0 Answers
Related