Example #1
0
        //Vlc.DotNet.Forms.VlcControl vlc
        void   t()
        {
            Vlc.DotNet.Forms.VlcControl vlc = new Vlc.DotNet.Forms.VlcControl();
            ((System.ComponentModel.ISupportInitialize)(vlc)).BeginInit();
            //this.SuspendLayout();

            this.Controls.Add(vlc);

            vlc.VlcLibDirectoryNeeded += vlc_VlcLibDirectoryNeeded;
            ((System.ComponentModel.ISupportInitialize)(vlc)).EndInit();
            //this.ResumeLayout(false);

            //Vlc.DotNet.Forms.VlcControl vlc = new Vlc.DotNet.Forms.VlcControl();



            //wz w1 = GetWZ(sm, i, wei, hei, 0, y0);
            vlc.Location = new System.Drawing.Point(0, 0);
            vlc.Size     = new System.Drawing.Size(this.Width, this.Height);
            //vlc.Source = jt1.url;
            // vlc.Video.AspectRatio = vlc.Width.ToString() + ":" + vlc.Height.ToString();

            //、、//、 vlc.Play(new Uri("rtsp://169.85.100.36/axis-media/media.amp?camera=1"));
            //this.Controls.Add(vlc);

            vlc.Play(new Uri("rtsp://169.85.100.36/axis-media/media.amp?camera=1"));
        }
Example #2
0
        /*
         * public void syncVideos()
         * {
         *  if(this.Video.RelatedVideo != null)
         *  {
         *      if(!this.Video.RelatedVideo.Loading)
         *      {
         *          //this.Video.RelatedVideo.Loading = true;
         *          //Sincronizo el tiempo del video 2
         *          var tl = new Thread(new ThreadStart(delegate {
         *              Thread.Sleep(1000);
         *              this.Video.RelatedVideo.Control.Time = this.Video.Control.Time;
         *              //Thread.Sleep(500);
         *              //this.Video.RelatedVideo.Loading = false;
         *          }));
         *          tl.Start();
         *      }
         *  }
         *
         * }*/

        public void UserControlLoaded(object sender, RoutedEventArgs e)
        {
            var arch = (IntPtr.Size == 4) ? "x86" : "x64";
            //Inicializo el reproductor 1
            var videoVlc = new Vlc.DotNet.Forms.VlcControl();

            videoVlc.BeginInit();
            videoVlc.VlcLibDirectory = new DirectoryInfo(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $@"libvlc\win-{arch}"));

            if ((string)this.Tag != "LicensePlate")
            {
                videoVlc.VlcMediaplayerOptions = new[] { "--input-fast-seek" };
            }
            videoVlc.EndInit();
            this.videoVlc.Child = videoVlc;

            Console.WriteLine("VLC Version:" + videoVlc.ProductVersion);
            //Inicializo el reproductor 2

            /*
             * var videoVlc2 = new Vlc.DotNet.Forms.VlcControl();
             * videoVlc2.BeginInit();
             * videoVlc2.VlcLibDirectory = new DirectoryInfo(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $@"libvlc\win-{arch}"));
             * //videoVlc2.VlcMediaplayerOptions = new[] { "--input-fast-seek" };
             * videoVlc2.EndInit();
             * this.videoVlc2.Child = videoVlc2;*/


            this.Focus();
            this.KeyDown += onKeyDown;
            this.KeyUp   += onKeyUp;
        }
Example #3
0
        void InitPlayer()
        {
            this.vlcControl = new Vlc.DotNet.Forms.VlcControl();
            ((System.ComponentModel.ISupportInitialize)(this.vlcControl)).BeginInit();
            this.SuspendLayout();
            //
            // vlcControl
            //
            this.vlcControl.BackColor              = System.Drawing.Color.Black;
            this.vlcControl.Dock                   = System.Windows.Forms.DockStyle.Bottom;
            this.vlcControl.Location               = new System.Drawing.Point(0, 0);
            this.vlcControl.Name                   = "vlcControl";
            this.vlcControl.Size                   = PlayerPnl.Size;
            PlayerPnl.SizeChanged                 += (s, e) => { this.vlcControl.Size = PlayerPnl.Size; };
            this.vlcControl.Spu                    = -1;
            this.vlcControl.TabIndex               = 0;
            this.vlcControl.Text                   = "vlcControl1";
            this.vlcControl.VlcLibDirectory        = null;
            this.vlcControl.VlcMediaplayerOptions  = null;
            this.vlcControl.VlcLibDirectoryNeeded += new System.EventHandler <Vlc.DotNet.Forms.VlcLibDirectoryNeededEventArgs>(this.vlcControl_VlcLibDirectoryNeeded);
            this.vlcControl.LengthChanged         += OnVlcMediaLengthChanged;
            this.vlcControl.PositionChanged       += OnVlcPositionChanged;
            this.vlcControl.Click                 += BtnPlay_Click;
            this.AutoScaleDimensions               = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;

            ((System.ComponentModel.ISupportInitialize)(this.vlcControl)).EndInit();
            this.ResumeLayout(false);
        }
Example #4
0
 public void MyTestInitialize()
 {
     vlcControl = new Vlc.DotNet.Forms.VlcControl();
     vlcControl.BeginInit();
     vlcControl.VlcLibDirectory = new DirectoryInfo(@"C:\Users\Gabriel\Downloads\vlc-3.0.6");;
     vlcControl.EndInit();
     video = new Video();
 }
        public MainWindow()
        {
            InitializeComponent();

            player = new Vlc.DotNet.Forms.VlcControl();

            winformsHost.Child = player;
            player.Visible = true;
        }
        public MainWindow()
        {
            InitializeComponent();

            player = new Vlc.DotNet.Forms.VlcControl();

            winformsHost.Child = player;
            player.Visible     = true;
        }
Example #7
0
        // this.vlcPlayer.VlcLibDirectoryNeeded+=vlcPlayer_VlcLibDirectoryNeeded;

        //Image<Bgr, Byte> m_frame;
        //string vlcLibPath = Path.Combine(new FileInfo(Assembly.GetEntryAssembly().Location).DirectoryName,"libvlc", IntPtr.Size == 4 ? "win-x86" : "win-x64");
        public RecordingForm(NewSessionForm newSessionForm)
        {
            InitializeComponent();
            //this.vlcControl.VlcLibDirectory = new DirectoryInfo(vlcLibPath);
            /////////////////
            _newSessionForm = newSessionForm;

            this.StartPosition = FormStartPosition.CenterScreen;


            _bReplaying = false;

            btnStartRec.Enabled = true;
            btnStopRec.Enabled  = false;
            var path = new System.Drawing.Drawing2D.GraphicsPath();

            path.AddEllipse(0, 0, label43.Width, label43.Height);
            label43.Region  = new Region(path);
            label43.Visible = false;

            CommonParam.LoadConfig();


            vlcRecorder = new Vlc.DotNet.Forms.VlcControl();

            ((System.ComponentModel.ISupportInitialize)(this.vlcRecorder)).BeginInit();
            this.vlcRecorder.Name     = "vlcRecorder";
            this.vlcRecorder.Size     = new System.Drawing.Size(813, 618);
            this.vlcRecorder.Spu      = -1;
            this.vlcRecorder.TabIndex = 0;
            this.vlcRecorder.Text     = "vlcRecorder1";
            var currentAssembly  = Assembly.GetEntryAssembly();
            var currentDirectory = new FileInfo(currentAssembly.Location).DirectoryName;

            vlcRecorder.VlcLibDirectory = new DirectoryInfo(Path.Combine(currentDirectory, "libvlc", IntPtr.Size == 4 ? "win-x86" : "win-x64"));
            ((System.ComponentModel.ISupportInitialize)(this.vlcRecorder)).EndInit();
            //itnit vlc player
            vlcPlayer.SetMedia(CommonParam.mConfig.videoUrl);

            vlcPlayer.VlcMediaplayerOptions = new[]
            {
                "--network-caching=1000",
                "--live-caching=300",
                "--no-rtsp-tcp",
                "--video-filter=transform"
            };

            //label42.Parent = vlcPlayer;
            label42.BackColor = Color.Transparent;
            vlcPlayer.Play();

            setViewSessionInfo(_bReplaying);
        }
Example #8
0
        public FrmMain()
        {
            InitializeComponent();

            // build the VLC control
            vlcVideoPlayer = new Vlc.DotNet.Forms.VlcControl();
            vlcVideoPlayer.BeginInit();
            vlcVideoPlayer.PositionChanged += VlcVideoPlayer_PositionChanged;
            vlcVideoPlayer.VlcLibDirectory = new DirectoryInfo(Path.Combine(Directory.GetCurrentDirectory(), "vlc"));
            vlcVideoPlayer.Dock = DockStyle.Fill;
            vlcVideoPlayer.EndInit();
            pnlVideoPlayer.Controls.Add(vlcVideoPlayer);
        }
Example #9
0
        public VLCVideoPlayBack(string _FilePath)
        {
            InitializeComponent();
            player = new Vlc.DotNet.Forms.VlcControl();
            this.Controls.Add(player);
            player.Dock = DockStyle.Fill;
            Uri filepath = new Uri(_FilePath);

            p = new string[2] {
                "avi", "wav"
            };
            player.SetMedia(filepath, p);
            player.Show();
        }
Example #10
0
        public Player() : base()
        {
            InitializeComponent();
            VLC = vlc.MediaPlayer;                                                                //просто удобнее обращаться
            VLC.VlcLibDirectory = new System.IO.DirectoryInfo(@"c:\Program Files\VideoLAN\VLC\"); //Путь может отличаться.
            VLC.EndInit();
            VLC.Play(new Uri(@"http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"));

            timer = new System.Windows.Threading.DispatcherTimer()
            {
                Interval = TimeSpan.FromSeconds(1)
            };
            timer.Tick += new EventHandler(timerTick);
            timer.Start();
        }
Example #11
0
        public void PlayMedia(string video_path)
        {
            string currentDirectory = Directory.GetCurrentDirectory();

            this.vlcControl      = new Vlc.DotNet.Forms.VlcControl();
            this.vlcControl.Dock = DockStyle.Fill;
            this.vlcControl.BeginInit();
            this.vlcControl.VlcLibDirectory       = new DirectoryInfo(@currentDirectory);
            this.vlcControl.VlcMediaplayerOptions = new string[] { "--directx-device={,display," + displayList[0].DeviceName + "} -vv" };
            // this.vlcControl.VlcMediaplayerOptions = new string[]{};
            this.vlcControl.EndInit();

            panel.Controls.Add(this.vlcControl);
            this.vlcControl.SetMedia(new Uri(video_path));
            this.vlcControl.Play();
            this.Show();
        }
Example #12
0
        public VlcControl()
        {
            MediaPlayer = new Vlc.DotNet.Forms.VlcControl();
            this.Child  = MediaPlayer;

            RegistCallback();



            RaisePropertyChanged("Rate");
            RaisePropertyChanged("Volume");

            /*
             * set a timer
             */
            timer          = new DispatcherTimer(DispatcherPriority.Render);
            timer.Interval = TimeSpan.FromMilliseconds(17);
            timer.Tick    += timer_Tick;
            old_time       = DateTime.UtcNow;
        }
Example #13
0
 void vlc_Resize(object sender, EventArgs e)
 {
     Vlc.DotNet.Forms.VlcControl vlc = (Vlc.DotNet.Forms.VlcControl)sender;
     //throw new NotImplementedException();
     vlc.Video.AspectRatio = vlc.Width.ToString() + ":" + vlc.Height.ToString();
 }
Example #14
0
        public void spxshi()
        {
            try
            {
                TC.yx = false;

                //清除现有镜头
                this.Cursor = Cursors.WaitCursor;
                foreach (mjpeg.cameraW c in arc)
                {
                    c.mjpegSource.Yx = false;
                    c.Stop();
                    c.Dispose();
                }
                foreach (Vlc.DotNet.Forms.VlcControl c in arr)
                {
                    c.Stop();
                    c.Dispose();
                }
                ar.Clear();
                arc.Clear();
                arr.Clear();
                GC.Collect();
                int sm = getsm(jtss.Count);
                TC.yx = true;
                //显示
                int wei = this.Width;
                int hei = this.Height - 60;
                int y0  = 30;
                int i   = 0;
                foreach (JT jt1 in jtss)
                {
                    if (i < sm)
                    {
                        bool rtsp = jt1.url.Trim().ToUpper().Substring(0, 4) == "RTSP";
                        if (rtsp)
                        {
                            Vlc.DotNet.Forms.VlcControl vlc = new Vlc.DotNet.Forms.VlcControl();
                            ((System.ComponentModel.ISupportInitialize)(vlc)).BeginInit();
                            this.SuspendLayout();

                            wz w1 = GetWZ(sm, i, wei, hei, 0, y0);
                            vlc.Location = new System.Drawing.Point(w1.x, w1.y);
                            vlc.Size     = new System.Drawing.Size(w1.w, w1.h);
                            this.Controls.Add(vlc);
                            try
                            {
                                vlc.VlcLibDirectoryNeeded += vlc_VlcLibDirectoryNeeded;
                                ((System.ComponentModel.ISupportInitialize)(vlc)).EndInit();
                                this.ResumeLayout(false);

                                vlc.Video.AspectRatio = vlc.Width.ToString() + ":" + vlc.Height.ToString();

                                vlc.Play(new Uri(jt1.url));
                            }
                            catch (Exception ex)
                            {
                                MessageBox.Show("联系计算机人员安装VLC控件:" + ex.ToString());
                            }
                            //vlc.Play(new Uri("rtsp://169.85.100.36/axis-media/media.amp?camera=1"));
                            ar.Add(vlc);
                            arr.Add(vlc);
                            vlc.Resize += vlc_Resize;
                        }
                        else
                        {
                            c = new cameraW();
                            wz w1 = GetWZ(sm, i, wei, hei, 0, y0);
                            c.Location = new System.Drawing.Point(w1.x, w1.y);
                            c.Size     = new System.Drawing.Size(w1.w, w1.h);
                            c.Source   = jt1.url;
                            this.Controls.Add(c);
                            ar.Add(c);
                            arc.Add(c);
                            c.Start();
                        }
                        i = i + 1;
                    }
                }
            }
            catch (Exception ex)
            { MessageBox.Show(ex.Message); }
            finally
            { this.Cursor = Cursors.Default; }
        }