"Connection/Disconnect Event" ????

About encoding, codec settings, muxers and filter usage
noknok
Blank Cone
Blank Cone
Posts: 30
Joined: 08 Sep 2009 23:06

"Connection/Disconnect Event" ????

Postby noknok » 14 Sep 2009 18:52

I am utilzing VLC to stream multiple formats. What I am looking for somehow, is any notification for when a client connects and disconnects from a stream.

Currently I am using VideoLan.Interop as a base for the code, but open to suggestions.

Thanks
Shawn

K Prasad Rao
New Cone
New Cone
Posts: 2
Joined: 15 Sep 2009 13:13

Re: "Connection/Disconnect Event" ????

Postby K Prasad Rao » 15 Sep 2009 13:41

I have used videolan.interop for playing and recording live streams from IP Cameras and i was able to get the callbacks for network disconnect.
There is a sample attached VlcMediaPlayer.Sample with the same project which details it. Nevertheless, below is the code

Vlc = new VideoLanClient();
VlcPlayer = Vlc.NewMediaPlayer(VideoPanel.Handle);
VlcPlayer.StateChanged += new EventHandler<StateChangedEventArgs>(VlcPlayer_StateChanged);

private void VlcPlayer_StateChanged(object sender, StateChangedEventArgs e)
{
if (InvokeRequired)
this.BeginInvoke(new EventHandler<StateChangedEventArgs>(VlcPlayer_StateChanged), sender, e);
else
{
switch (e.NewState)
{
case VlcState.Ended:
break;
case VlcState.Error:
break;
case VlcState.Buffering:
break;
case VlcState.Opening:
break;
case VlcState.Paused:
break;
case VlcState.Playing:
break;
case VlcState.Stopped:
break;
}
}
}


When the rtsp stream is playing and network get disconnected then 'Ended' event is raised.

This works very fine but there are few issues:-
1. If we try to play a stream of a disconnected camera then event 'Error' gets raised but after aroung 45-50 seconds. I'm not able to find a way to set a timeout for that.
2. In case of http streams(mjpg) from some cameras (eg Zavio) no event is raised in case of network disconnect.

So probably you can test whether it can suit your requirements.

And any help regarding the issues would be appreciated.

Regards,
K. Prasad Rao

noknok
Blank Cone
Blank Cone
Posts: 30
Joined: 08 Sep 2009 23:06

Re: "Connection/Disconnect Event" ????

Postby noknok » 15 Sep 2009 14:37

Actually the eventing to which you denote in your post are the events from the "player".

Meaning the events are signaled as media is played/stopped/etc. It does not correllate to the connections which may occur on the stream.

For example, we start up say 10 various streams. We do at the time of starting them up receive the Opening, Playing events.

Then lets say we connect 5 clients to a specific stream, we receive NO notifications of those connections from clients, or disconnetcs from the clients.

Is their a log of sorts to which VLC writes too which we can monitor in a separate thread that may give us some notifications of this type of behavoir? Being we are use the .NET Videolan.Interop with 1.0.1 release, Im not sure if their is a command line switch to tell VLC process when starting to write to a specific log file, or pipe or something.

Thanks for any help
Shawn


Return to “VLC stream-output (sout)”

Who is online

Users browsing this forum: No registered users and 9 guests