Skip to content

Commit af4cd6a

Browse files
committed
B Fixed "http" with credentials not being passed down to the transport
1 parent 682e202 commit af4cd6a

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

src/SharpRTSPClient/RTSPClient.cs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ public RTSPClient(ILoggerFactory loggerFactory)
147147
/// <param name="password">Password.</param>
148148
/// <param name="mediaRequest">Media request type <see cref="MediaRequest>."/></param>
149149
/// <param name="playbackSession">Playback session.</param>
150-
public void Connect(string url, RTPTransport rtpTransport, string username = null, string password = null, MediaRequest mediaRequest = MediaRequest.VIDEO_AND_AUDIO, bool playbackSession = false)
150+
public void Connect(string url, RTPTransport rtpTransport, string username = null, string password = null, MediaRequest mediaRequest = MediaRequest.VIDEO_AND_AUDIO, bool playbackSession = false, System.Net.Security.RemoteCertificateValidationCallback userCertificateSelectionCallback = null)
151151
{
152152
_logger.LogDebug("Connecting to {url} ", url);
153153
_uri = new Uri(url);
@@ -182,7 +182,21 @@ public void Connect(string url, RTPTransport rtpTransport, string username = nul
182182
_rtspSocketStatus = RtspStatus.Connecting;
183183
try
184184
{
185-
_rtspSocket = Rtsp.RtspUtils.CreateRtspTransportFromUrl(_uri);
185+
switch (_uri.Scheme)
186+
{
187+
case "http":
188+
{
189+
// to pass the credentials down we cannot use RtspUtils.CreateRtspTransportFromUrl
190+
_rtspSocket = new RtspHttpTransport(_uri, _credentials);
191+
}
192+
break;
193+
194+
default:
195+
{
196+
_rtspSocket = Rtsp.RtspUtils.CreateRtspTransportFromUrl(_uri, userCertificateSelectionCallback);
197+
}
198+
break;
199+
}
186200
}
187201
catch
188202
{

0 commit comments

Comments
 (0)