private void button2_Click_1(object sender, EventArgs e) { if (webCam == null || live == false) { codec = new MicrosoftAdpcmChatCodec(); webCam = new IWebCam(this.Handle); live = true; timer1.Start(); btnLiveStreaming.Text = "Stop"; connectLiveAudio(0, codec); btnLive.BackColor = Color.Red; } else { socket.Emit("stop streaming", ""); btnLive.BackColor = Color.Gray; disconnectLiveAudio(); disconnectVideo(); } }