Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
 public Form1()
 {
     InitializeComponent();
     _imageProvider = new DrawingImageProvider();
     _connector     = new MediaConnector();
     _videoViewerWf = new VideoViewerWF();
     SetVideoViewer();
 }
Ejemplo n.º 3
0
        private void VideoViewerWF_Click(object sender, EventArgs e)
        {
            VideoViewerWF vv = sender as VideoViewerWF;
            String        StrNum;

            StrNum = vv.Name.Substring(13, vv.Name.Length - 13);

            CurrentCamera = Int32.Parse(StrNum) - 1;
            Ctlchecked[CurrentCamera].Checked = true;
        }
Ejemplo n.º 4
0
        public ONVIFClient()
        {
            _imageProvider = new DrawingImageProvider();
            _connector     = new MediaConnector();
            _videoViewerWf = new VideoViewerWF();

            //_camera = new Ozeki.Media.IPCamera.IIPCameraClient("192.168.112.109:8080", "user", "qwe123");
            //_connector.Connect(_camera.VideoChannel, _imageProvider);
            //_camera.Start();
        }
Ejemplo n.º 5
0
        public Form1()
        {
            InitializeComponent();

            _videoViewer = new VideoViewerWF();

            _imageProvider  = new DrawingImageProvider();
            _mediaConnector = new MediaConnector();

            SetVideoViewer();
            this.Controls.Add(_videoViewer);
        }
Ejemplo n.º 6
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);
        }
Ejemplo n.º 7
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;
        }
Ejemplo n.º 9
0
        /// </summary>

        public UserControl_Flight()
        {
            InitializeComponent();
            getAvailablePorts();

            // Create video viewer UI control
            _imageProvider   = new DrawingImageProvider();
            _connector       = new MediaConnector();
            _snapshotHandler = new SnapshotHandler();
            _videoViewerWF1  = new VideoViewerWF();
            setVideoViewer();

            buttonDisconnect.Enabled = false;
            _points = new List <PointLatLng>();
        }
Ejemplo n.º 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 Form1()
        {
            InitializeComponent();
            showPowerStatus();
            getAvailablePorts();
            buttonDisconnect.Enabled = false;

            // Create Video Viewer UI Controller
            _imageProvider   = new DrawingImageProvider();
            _connector       = new MediaConnector();
            _snapshotHandler = new SnapshotHandler();
            _videoViewerWF1  = new VideoViewerWF();
            setVideoViewer();

            _points = new List <PointLatLng>();
            _jalur  = new List <PointLatLng>();

            timer1.Start();
        }
Ejemplo n.º 12
0
        //--------------------------------------------------------------------------------
        /// <summary>
        /// This method serves as a common constructor initialization location,
        /// and serves mainly to set the desired size of the container panel in
        /// the wizard form (see WizardFormBase for more info).  I didn't want
        /// to do this here but it was the only way I could get the form to
        /// resize itself appropriately - it needed to size itself according
        /// to the size of the largest wizard page.
        /// </summary>
        public void InitPage()
        {
            InitializeComponent();
            _mediaConnector       = new MediaConnector();
            _imageProvider        = new DrawingImageProvider();
            _snapshotHandler      = new SnapshotHandler();
            _videoViewer          = new VideoViewerWF();
            timAnimation          = new System.Windows.Forms.Timer();
            timAnimation.Interval = 200;
            timAnimation.Tick    += new System.EventHandler(this.timAnimation_Tick);
            //==================

            _webCamera = WebCamera.GetDefaultDevice();
            SetVideoViewer();
            base.Size = this.Size;
            this.ParentWizardForm.DiscoverPagePanelSize(this.Size);
            this.panelVideo.Controls.Add(_videoViewer);
            clsGlobalVariables.SnapshotFilesDirectory = @"C:\iPrint\iPrintCamera\";
        }
        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();
        }
Ejemplo n.º 14
0
 public Camera()
 {
     _Imageprovider  = new DrawingImageProvider();
     _mediaConnector = new MediaConnector();
     _videoViewer    = new VideoViewerWF();
 }
        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);
        }
Ejemplo n.º 16
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;
            }
        }