示例#1
0
        public Bitmap GetImage(string streamUrl)
        {
            Bitmap               bitmap         = new Bitmap(1280, 720);
            MediaConnector       mediaConnector = new MediaConnector();
            DrawingImageProvider imageProvider  = new DrawingImageProvider();
            IIPCamera            _camera        = IPCameraFactory.GetCamera(streamUrl, "root", "pass");

            mediaConnector.Connect(_camera.VideoChannel, imageProvider);
            _camera.Start();
            VideoViewerWF video = new VideoViewerWF();

            video.SetImageProvider(imageProvider);
            video.Name = "videoViewerWF1";
            video.Size = new Size(300, 300);
            video.Start();
            Thread.Sleep(10000);
            try
            {
                video.DrawToBitmap(bitmap, new System.Drawing.Rectangle()
                {
                    Height = 720,
                    Width  = 1280
                });
            }
            catch (Exception ex)
            {
            }
            finally
            {
                video.Stop();
                _camera.Stop();
            }
            return(bitmap);
        }
示例#2
0
        public void Initialize()
        {
            _videoViewer.Size = PanelViewer.Size;
            PanelViewer.Controls.Add(_videoViewer);

            _videoViewer.SetImageProvider(_Imageprovider);
        }
示例#3
0
 private void button_Connect_Click(object sender, EventArgs e)
 {
     _camera = IPCameraFactory.GetCamera("192.168.115.175:8080", "admin", "admin");
     _connector.Connect(_camera.VideoChannel, _imageProvider);
     _videoViewerWf.SetImageProvider(_imageProvider);
     _videoViewerWf.Start();
     _camera.Start();
 }
示例#4
0
 public static void ConnectUSBCamera()
 {
     _mediaConnector.Connect(_webCamera, _imageProvider);
     _videoViewer.SetImageProvider(_imageProvider);
     _mediaConnector.Connect(_webCamera, _snapshotHandler);
     _webCamera.Start();
     _videoViewer.Start();
     timAnimation.Enabled = true;
 }
示例#5
0
 private void buttonOzeki_Click(object sender, EventArgs e)
 {
     _camera = IPCameraFactory.GetCamera("rtsp://192.168.42.1/live", "", "");
     _connector.Connect(_camera.VideoChannel, _imageProvider);
     _connector.Connect(_camera.VideoChannel, _snapshotHandler);
     _videoViewerWF1.SetImageProvider(_imageProvider);
     _videoViewerWF1.Start();
     buttonOzeki.BackgroundImage = GUI_KRTI_BismillahNyoba.Properties.Resources.icons8_wi_fi_filled_50;
     _camera.Start();
 }
示例#6
0
        private void connectBtn_Click(object sender, EventArgs e)
        {
            _webCamera = new WebCamera();

            if (_webCamera != null)
            {
                _mediaConnector.Connect(_webCamera.VideoChannel, _imageProvider);
                _videoViewer.SetImageProvider(_imageProvider);
                _webCamera.Start();
                _videoViewer.Start();
            }
        }
示例#7
0
        public Form1()
        {
            InitializeComponent();

            // Create video viewer UI control
            _videoViewerWF1      = new VideoViewerWF();
            _videoViewerWF1.Name = "videoViewerWF1";
            _videoViewerWF1.Size = panel1.Size;
            panel1.Controls.Add(_videoViewerWF1);

            // Bind the camera image to the UI control
            _videoViewerWF1.SetImageProvider(_imageProvider);
        }
示例#8
0
 public bool Connect(string DVRIPAddress, ushort DVRPortNumber, string DVRUserName, string DVRPassword)
 {
     _videoViewerWF1      = new VideoViewerWF();
     _videoViewerWF1.Name = "OnvifPreview";
     _videoViewerWF1.Size = VideoPanel.Size;
     VideoPanel.Controls.Add(_videoViewerWF1);
     _videoViewerWF1.SetImageProvider(_imageProvider);
     _camera = IPCameraFactory.GetCamera(string.Format("{0}:{1}", DVRIPAddress, DVRPortNumber.ToString()), DVRUserName, DVRPassword);
     _connector.Connect(_camera.VideoChannel, _imageProvider);
     _camera.Start();
     _videoViewerWF1.Start();
     return(true);
 }
        public void ShowFormCall()
        {
            Form form = new Form();

            form.Text            = "cuộc gọi video";
            form.Size            = new Size(800, 500);
            form.BackColor       = Color.White;
            form.FormBorderStyle = FormBorderStyle.FixedSingle;
            form.FormClosing    += Form_FormClosing;

            Button closeCamera = new Button();

            closeCamera.Location = new Point(655, 200);
            closeCamera.Size     = new Size(125, 25);
            closeCamera.Text     = "Tắt camera";
            closeCamera.Click   += CloseCamera_Click;

            Button hangUp = new Button();

            hangUp.Location = new Point(655, 235);
            hangUp.Size     = new Size(125, 25);
            hangUp.Text     = "Tắt máy";
            hangUp.Click   += HangUp_Click;

            _lbTime          = new Label();
            _lbTime.Location = new Point(710, 325);
            _lbTime.Text     = "Đang gọi ... ";

            VideoViewerWF remoteViewer = new VideoViewerWF();

            remoteViewer.Location = new Point(0, 0);
            remoteViewer.Size     = new Size(650, 500);
            remoteViewer.SetImageProvider(remoteProvider);
            remoteViewer.Start();

            VideoViewerWF localViewer = new VideoViewerWF();

            localViewer.Location = new Point(655, 350);
            localViewer.Size     = new Size(150, 150);
            localViewer.SetImageProvider(Instance.LocalProvider[Instance.LocalProvider.Count - 1]);
            localViewer.Start();

            form.Controls.Add(_lbTime);
            form.Controls.Add(hangUp);
            form.Controls.Add(closeCamera);
            form.Controls.Add(remoteViewer);
            form.Controls.Add(localViewer);
            form.ShowDialog();

            IsShowFormCall = true;
        }
示例#10
0
        private void InitViewer()
        {
            _remoteViewer          = new VideoViewerWF();;
            _remoteViewer.Location = new Point(0, 0);
            _remoteViewer.Size     = _flpRemoteVideo.Size;
            _remoteViewer.SetImageProvider(_remoteProvider);

            _localViewer          = new VideoViewerWF();
            _localViewer.Location = new Point(0, 0);
            _localViewer.Size     = _panelLocalVideo.Size;
            _localViewer.SetImageProvider(_localProvider);

            _panelLocalVideo.Controls.Add(_localViewer);
            _flpRemoteVideo.Controls.Add(_remoteViewer);

            _remoteViewer.Start();
            _localViewer.Start();
        }
        public void ShowUI()
        {
            Form form = new Form();

            form.Size            = new Size(1080, 490);
            form.FormBorderStyle = FormBorderStyle.FixedSingle;
            form.Text            = "Video trực tiếp";

            VideoViewerWF videoViewer = new VideoViewerWF();

            videoViewer.Location = new Point(0, 0);
            videoViewer.Size     = new Size(800, 450);
            videoViewer.SetImageProvider(provider);
            videoViewer.Start();
            form.Controls.Add(videoViewer);

            CommentBoxControl commentControls = new CommentBoxControl();

            commentControls.Location = new Point(810, 0);
            form.Controls.Add(commentControls);

            form.ShowDialog();
        }
        public CameraConfigurationItem(string cameraId, VideoViewerWF videoViewer)
        {
            this.videoViewer = videoViewer;
            this.id = cameraId;
              provider = new DrawingImageProvider();
              connector = new MediaConnector();
              detector = new MotionDetector();
              videoResizer = new VideoResizer();
            detector.PixelIntensitySensitivy = Settings.PixelIntensitySensitivity; //0-255
            detector.PixelAmountSensitivy = Settings.PixelAmountSensitivity; //0-10

            videoViewer.SetImageProvider(provider);
        }
示例#13
0
        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;
            }
        }