Use rtspClient without receive media packages

Topics: Question
Nov 6, 2015 at 10:27 AM
Hi guys.

For a project, I need to implement an RtspClient, but only for the negotiation ( DESCRIBE, OPTIONS, PLAY ... etc ), the video will be showed using videolan ).

So, is is posible to do that with this library ?.

I´m able to create a client, connect it with my rtsp server, and begin to receive packets, but what I want to do is when I receive the PLAY response, begin to show video using videolan ( for example, opening the SDP received ).

Any idea about how to do that ?

Thanks a lot !!

Regards !!
Coordinator
Nov 6, 2015 at 12:00 PM
The most straight forward way is to use the rtsp server, then use vlc to consume from that server instance.

See the included examples for the rtsp server.

If you need anything else let me know.
Marked as answer by juliusfriedman on 11/6/2015 at 4:00 AM
Nov 9, 2015 at 11:04 PM
Maybe I am missing something obvious, but where can I find the included examples that you are referring to? Are the two files below where you are referring to?

UnitTests/Forms/RtspInspector.cs
UnitTests/Program.cs

I have similar needs as above (just need to initiate the video stream) and need to be able to check if it video is already streaming (I am assuming RtspClient.isPlaying will fit my needs).

Thanks!
Coordinator
Nov 10, 2015 at 12:48 PM
Your correct in the source files you referenced for the example.

The methods 'TestServer' and 'RtspClientTests' are the specific examples you are looking for.

'IsPlaying' will likely fit your needs, you can also check the 'Ready' property of the 'IMedia' which is used to create the source.

Keep an eye out for updates, I have been extremely busy the past few months and I am finally getting to the point where I can start working on this project again.

I would say sometime shortly after Thanksgiving if not before such time.
Marked as answer by juliusfriedman on 11/10/2015 at 4:48 AM
Nov 10, 2015 at 7:58 PM
Edited Nov 10, 2015 at 7:59 PM
Thanks! Those examples are exactly what I was needing.

'IsPlaying' reflects the state of the current session connection correct? I.E. There is no way to determine if the rtsp endpoint is currently serving to other locations/sessions? I am guessing that this is probably not possible given the rtsp spec, but figured that I would ask just in case.

Background: I am looking to use this tool to monitor the state of video stream to other applications. I am working with a wearable IP camera that operates over wifi that sometimes may loose connection due to range, walls, etc. Specifically, I am looking for some sort of state data (in regards to an operational video stream) so that I can know when to trigger a sequence of reconnect operations (some network related, some related to initiating a play on the rtsp endpoint again). The application actually consuming the stream doesn't have these sorts of hooks or state information exposed.

Please let me know if you need more clarification or if this falls outside of the realm of what you would prefer for these message boards. No worries.
Coordinator
Nov 10, 2015 at 8:25 PM
IsPlaying tells you that the client is receiving media, this will be true after play and until the end time specified in the session description. If the stream is continuous this will also be true.

You are basically correct, you can store the 'Session' header from your initial requests and attempt to set it manually upon re-connection if you are disconnected.

There is an event on the RtspClient for 'Connect' and 'Disconnect' if that's not what your looking for try checking out the [GetIsNetworkAvailable](https://msdn.microsoft.com/en-us/library/system.net.networkinformation.networkinterface.getisnetworkavailable(v=vs.110).aspx)

What it seems to me as far as the best way to achieve this though would be to have the camera begin to Announce and push the media to a RtspServer instance, then each time the client disconnected the stream would be unavailable for consumption, when the connection was available again it would reconnect and being pushing the media again, thus making the stream available.

I have plans to support this out of the box along with some additional record and playback support coming up.

Let me know if you need anything else.
Marked as answer by juliusfriedman on 11/10/2015 at 12:25 PM
Nov 11, 2015 at 3:51 PM
Hopefully this is my last question. Thanks again, you have been extremely helpful.

Is "push the media to a RtspServer instance" something that could already be accomplished with the current code base? That is, taking the video stream from a RtspClient and passing it to a separate RtspServer instance. Just trying to get an idea of what already exists so that I can determine a level of effort for myself. Not sure what portions or this already exist based on your previous comments. Is there any test in the codebase that you suggest that I be looking at related to this?

I am thinking that I could have an always running RtspServer instance which streams the video from another RtspClient (feed from ip camera) or streams what is essence just a static image when the ip camera feed is not available. In short, sort of a Relay endpoint that is always up, but shows the ip camera feed when available, and all the reconnection operations can be transparent to the endpoint application. This would mostly solve my final video stream endpoint reconnection problem. I've already solved the issue of determining network connectively availability (unrelated to the actual feed from the camera).
Coordinator
Nov 12, 2015 at 12:32 PM
Yes it is possible, you will need to handle the Announce method on the RtspServer, you will send the announce from the client over wifi to the server. When the server gets the request it will basically create a new RtspSource which can subsequently be played after the announce request succeeds.

When a disconnect occurs if the client doesn't reconnect then the source will expire and eventually when it can reconnect it will announce the stream again.

It's really not a lot of work to implement, you need a custom handler which can be registered on the RtspServer and you basically create a RtpSource or RtspSource in the handler and add that created source to the server with 'TryAddMedia'.

Let me know if you need anything else and definitely keep an eye out for project updates.
Marked as answer by juliusfriedman on 11/12/2015 at 4:32 AM