how to detect connection lost in vlcj

1.2k views Asked by At

I am playing network streams in my VLCJ application. Sometimes network connections are lost and I want to know this moments in my VLCJ application. I tried Error event but it is not fired. It is only fired when there is no network connection and I try to play a stream. When network is gone, last frame of video is freezed and nothing else is happened. How can I detect that video playing is stopped due to network connection lost?

2

There are 2 answers

2
caprica On BEST ANSWER

There is no LibVLC API to detect that condition, and so there is no way to do it with vlcj either.

You could conceivably capture the native log and parse it looking for those errors, but that's a really poor approach frankly.

0
Michal Dobrodenka On

You should check Media state. Either in separate thread in loop with delay or - ( I use libVLCSharp in c# ) - there should be something like an event in Media that State had been changed. In c# it is Media.EventManager.StateChanged event.