Ejemplo n.º 1
0
        private void Devices_AfterSelect(object sender, TreeViewEventArgs e)
        {
            var device = (SatIpDevice)_client.FindByUDN(e.Node.Name);

            if (device != null)
            {
                Logger.Info("Selected Sat>Ip Server is {0}", device.FriendlyName);


                if ((_rtspDevice != null) && (!_rtspDevice.FriendlyName.Equals(device.FriendlyName)))
                {
                    _rtspDevice.Dispose();
                    _rtspDevice  = new RtspDevice(device.FriendlyName, device.BaseUrl.Host, device.UniqueDeviceName);
                    _isstreaming = false;
                }
                else
                {
                    _rtspDevice = new RtspDevice(device.FriendlyName, device.BaseUrl.Host, device.UniqueDeviceName);
                }
                var service = (M3uService)PlayList.SelectedItem;
                Logger.Info("Selected Service is {0}", service.Name);
                if (!_isstreaming)
                {
                    _rtspDevice.RtspSession.Setup(service.ToString(), TransmissionMode.Unicast);
                    _rtspDevice.RtspSession.RecieptionInfoChanged += new RecieptionInfoChangedEventHandler(RtspSession_RecieptionInfoChanged);
                    _rtspDevice.RtspSession.Play(String.Empty);
                    _isstreaming = true;
                    axWindowsMediaPlayer1.URL = string.Format("rtp://{0}:{1}", _rtspDevice.RtspSession.Destination,
                                                              _rtspDevice.RtspSession.RtpPort);
                    Text = string.Format("rtp://{0}:{1}", _rtspDevice.RtspSession.Destination,
                                         _rtspDevice.RtspSession.RtpPort);
                }
            }
        }
Ejemplo n.º 2
0
        private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            var finder = new UPnPDeviceFinderClass();
            var device = finder.FindByUDN(e.Node.Name);

            if (device != null)
            {
                Logger.Info("Selected Sat>Ip Server is {0}", device.FriendlyName);
                _keepaLiveTimer = new Timer {
                    Enabled = true
                };
                _keepaLiveTimer.Tick += _keepaLiveTimer_Tick;

                if ((_rtspDevice != null) && (!_rtspDevice.FriendlyName.Equals(device.FriendlyName)))
                {
                    //_keepaLiveTimer.Stop();
                    _rtspDevice.Dispose();
                    _rtspDevice = new RtspDevice(device);
                    _keepaLiveTimer.Interval = _rtspDevice.RtspSession.RtspSessionTimeToLive;
                    _keepaLiveTimer.Start();
                    _isstreaming = false;
                }
                else
                {
                    //_keepaLiveTimer.Stop();
                    _rtspDevice = new RtspDevice(device);
                    _keepaLiveTimer.Interval = _rtspDevice.RtspSession.RtspSessionTimeToLive;
                    _keepaLiveTimer.Start();
                }
                var service = (Service)PlayList.SelectedItem;
                Logger.Info("Selected Service is {0}", service.Name);
                if (!_isstreaming)
                {
                    _rtspDevice.RtspSession.Setup(service.ToString(), TransmissionMode.Unicast);
                    _rtspDevice.RtspSession.Play(String.Empty);
                    _isstreaming = true;
                    axWindowsMediaPlayer1.URL = string.Format("rtp://{0}:{1}", _rtspDevice.RtspSession.Destination,
                                                              _rtspDevice.RtspSession.RtpPort);
                    Text = string.Format("rtp://{0}:{1}", _rtspDevice.RtspSession.Destination,
                                         _rtspDevice.RtspSession.RtpPort);
                }
            }
        }