0

I am trying to do rtsp streaming in Nav 2016 using control add in using VLC player for dotnet. The control gets added on Nav page but i am not able to stream video from IP camera. The same code works fine on windows application but it does not work in Nav. Here is my sample code. please help me if i am doing anything wrong here.

using System;
using System.Drawing;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Microsoft.Dynamics.Framework.UI.Extensibility;
using Microsoft.Dynamics.Framework.UI.Extensibility.WinForms;
using System.Text.RegularExpressions;
using System.IO.Ports;
using WebEye.Controls.WinForms.StreamPlayerControl;
using Vlc.DotNet.Forms;

namespace WeighControl
{
    [ControlAddInExport("CamControl")]
    public class CamControl : WinFormsControlAddInBase
    {
        private VlcControl streamCam1;        
        private delegate void myDelegate(string str);        

        [ApplicationVisible]
        public event MethodInvoker CamControlAddInReady;

        [ApplicationVisible]
        public void ShowCameraControl()
        {
            ShowCamera();
        }

        public CamControl()
        {
            
        }

        private void ShowCamera()
        {
            try
            {
                streamCam1.Play(new Uri("rtsp://admin:admin@192.168.0.171/"));
            }
            catch(Exception ex) 
            {
                
            }

        }

     

        protected override Control CreateControl()
        {
            streamCam1 = new VlcControl();
            this.streamCam1.AutoSize = true;
            this.streamCam1.BackColor = System.Drawing.Color.Black;
            this.streamCam1.Spu = -1;
            this.streamCam1.ForeColor = System.Drawing.Color.Black;
            this.streamCam1.Location = new System.Drawing.Point(1, 416);
            this.streamCam1.Margin = new System.Windows.Forms.Padding(2);
            this.streamCam1.Name = "streamCam1";
            string path = @"C:\Program Files\VideoLAN\VLC";
            System.IO.DirectoryInfo directoryInfo = new System.IO.DirectoryInfo(path);
            this.streamCam1.VlcLibDirectory = directoryInfo;
            this.streamCam1.VlcMediaplayerOptions = null;
            this.streamCam1.Size = new System.Drawing.Size(540, 226);
            this.streamCam1.TabIndex = 2198;

            streamCam1.HandleCreated += (sender, args) =>
            {
                if (CamControlAddInReady != null)
                {
                    CamControlAddInReady();
                }
            };
            return streamCam1;
        }
       
    }
}

  • If you seek help in nav it would be wise to paste your nav code as well. And describe your error in more words than “but it does not work”. – Mak Sim Nov 04 '22 at 12:43
  • There is no code in nav I just called showcameracontrol function in nav on a field where I want to use this control. It works for other controls but not for this one. – Inder Singh Nov 04 '22 at 21:22
  • That means you DO have code in nav. You have a page, since you have a field. You have variable (of DotNet type prob.), since you calling a function.Have you set `RunOnClient` property of variable to `Yes`? – Mak Sim Nov 06 '22 at 04:39

0 Answers0