'Libvlcsharp: detect issues with live stream

I am trying to build a recorder using LibVlcSharp based on this sample. I managed to get the example working. However, let's say I am recording a live stream and I want to be able to detect if an error happens.

My first thought was using Media.State to detect errors. However, I found that Media.State is always "Playing" even after I turned off the WiFi. I guess my question is: Does LibVlcSharp fire any event if an error happens during playing/recording.

Thanks,



Solution 1:[1]

Listen to this event : EncounteredError

mediaPlayer.EncounteredError += (s, e) {...};

VLC might take a while to detect that the stream is broken, depending on the input module used.

Solution 2:[2]

Just set up a timer and check regularly

m_videoView.MediaPlayer.IsPlaying

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 cube45
Solution 2 Enmujnem