I have a device that streams a RTSP video, I need to show it using the VLC (LibVLCSharp) media player.
LibVLC libVLC = new LibVLC();
MediaPlayer mediaPlayer = new MediaPlayer(libVLC);
Media media = new Media(m_libVLC, "rtsp://192.168.0.10/vid1.sdp", FromType.FromLocation);
mediaPlayer.Play(media);
I have two problems:
- Sometimes the media player starts playing when the device hasn't stared streaming yet.
- The device stops streaming and resumes after several minutes. In both cases, the video isn't displayed.
Are there any VLC configurations for "auto - play" stream whenever it is ready? Can I know whenever the stream is ready?
I would really appreciate any suggestions.
You might use a .net library like RtspClientSharp to make request to the device and see if it replies.
If you don't want to bother with an additional library, you might as well open a TCP socket on the rtsp port and see if the connection succeeds.