public MJPEGVideo() { _bitmapSourceProvider = new DrawingImageProvider(); _connector = new MediaConnector(); _mjpegConnection = new MJPEGConnection(); SetImageProvider(_bitmapSourceProvider); }
private void materialFlatButton1_Click(object sender, EventArgs e) { try { if (_mjpegConnection1 != null) { _mjpegConnection1.Disconnect(); } var config1 = new OzMJPEGClient_Config(bunifuMaterialTextbox4.Text, bunifuMaterialTextbox1.Text, bunifuMaterialTextbox2.Text); _mjpegConnection1 = new MJPEGConnection(config1); _mjpegConnection1.Connect(); _connector1.Connect(_mjpegConnection1.VideoChannel, _bitmapSourceProvider1); _connector1.Connect(_mjpegConnection1.VideoChannel, _snapShot1); _videoSender = _mjpegConnection1.VideoChannel; videoViewerWF1.Start(); } catch (Exception ex) { Console.WriteLine(ex.Message); MessageBox.Show("Please enter IP, Username and Password !"); } }
private void btnConnect3_Click(object sender, EventArgs e) { try { if (_mjpegConnection3 != null) { _mjpegConnection3.Disconnect(); } var config3 = new OzMJPEGClient_Config(bunifuMaterialTextbox9.Text, bunifuMaterialTextbox11.Text, bunifuMaterialTextbox12.Text); _mjpegConnection3 = new MJPEGConnection(config3); _mjpegConnection3.Connect(); _connector3.Connect(_mjpegConnection3.VideoChannel, _bitmapSourceProvider3); _connector3.Connect(_mjpegConnection3.VideoChannel, _snapShot3); videoViewerWF3.Start(); } catch (Exception ex) { Console.WriteLine(ex.Message); MessageBox.Show("Please enter IP, Username and Password !"); } }
public video_chat_room(string myListening, string videop, string aup, string vclient_n, string vclient_ipadd, string client_videop, string client_aup, string camn, string audioinputn, string audiooutputn) { try { InitializeComponent(); string[] splitmessage = myListening.Split(':'); myListeningUrl = splitmessage[0]; videoport = videop; auport = aup; vclient_name = vclient_n; splitmessage = vclient_ipadd.Split(':'); vclient_ipaddress = splitmessage[0]; client_videoport = client_videop; client_auport = client_aup; camName = camn; audioinputname = audioinputn; audiooutputname = audiooutputn; close_button.Enabled = false; this.client_label.Text = vclient_name; //client vconnector = new MediaConnector(); mjpegConnection = new MJPEGConnection(); vprovider = new DrawingImageProvider(); this.zoom = new Zoom(); videoViewer = new VideoViewerWF() { Name = "Video Preview", Size = new Size(300, 210), Location = new Point(20, 20), BackColor = Color.Black }; vvideoViewer = new VideoViewerWF() { Name = "Video Preview", Size = new Size(300, 210), Location = new Point(20, 20), BackColor = Color.Black }; connector = new MediaConnector(); provider = new DrawingImageProvider(); videoViewer.SetImageProvider(provider); vvideoViewer.SetImageProvider(vprovider); groupBox1.Controls.Add(videoViewer); webCamera = null; foreach (var info in WebCameraFactory.GetDevices()) { if (info.Name == camName) { webCamera = WebCameraFactory.GetDevice(info); break; } } if (webCamera == null) { MessageBox.Show("Couldn't connect to the camera"); return; } connector.Connect(webCamera.VideoChannel, provider); videoSender = webCamera.VideoChannel; webCamera.Start(); videoViewer.Start(); streamer = new MJPEGStreamer(myListeningUrl, int.Parse(videoport)); if (!connector.Connect(videoSender, streamer.VideoChannel)) { MessageBox.Show("Failed to create connection.."); } streamer.ClientConnected += ClientConnected; streamer.ClientDisconnected += ClientDisconnected; streamer.Start(); if (!this.vconnected) { IPEndPoint endPoint = new IPEndPoint(IPAddress.Parse(this.myListeningUrl), int.Parse(this.auport)); this.selectedCodec = new AcmMuLawChatCodec(); this.ServerConnect(endPoint, int.Parse(audioinputn), selectedCodec); } else { this.ServerDisconnect(); } this.lblStatus.Text = "Server & camera started\n" + lblStatus.Text; } catch (Exception ex) { lblStatus.Text = ex.ToString() + "\n" + lblStatus.Text; } }