CSharpRTMP.Core.Protocols.Rtsp.RtspProtocol.EnableKeepAlive C# (CSharp) Method

EnableKeepAlive() public method

public EnableKeepAlive ( uint period, string keepAliveURI ) : bool
period uint
keepAliveURI string
return bool
        public bool EnableKeepAlive(uint period, string keepAliveURI)
        {
            var timer = new RtspKeepAliveTimer(Id);
            _keepAliveTimerId = timer.Id;
            _keepAliveURI = keepAliveURI.Trim();
            if (_keepAliveURI == string.Empty) _keepAliveURI = "*";
            return timer.EnqueueForTimeEvent(period);
        }

Usage Example

 private bool HandleRTSPResponse200Play(RtspProtocol rtspProtocol, Variant requestHeaders, ref string requestContent, Variant responseHeaders, ref string responseContent)
 {
     //1. Get the inbound connectivity
     if (rtspProtocol.InboundConnectivity == null)
     {
         FATAL("Unable to get inbound connectivity");
         return false;
     }
     //2. Create the stream
     if (!rtspProtocol.InboundConnectivity.Initialize())
     {
         FATAL("Unable to initialize inbound connectivity");
         return false;
     }
     //3. Enable keep alive
     return rtspProtocol.EnableKeepAlive(10, rtspProtocol.CustomParameters["uri","fullUri"]);
 }