I'm using VideoLan.Interop, a .Net libvlc 0.9.x wrapper compiled on Visual Studio 2005 (VLC 1.0.5)
Now I'm working on an application with VB.net and VideoLan.Interop.dll
Everything works fine: I can open an rtsp stream ("rtsp://196.0.0.19:8082/test2.sdp") which carries an audio stream and a video stream.
I'm able to manage some events (view source code below) of VLCPlayer.
Now I'd like to manage events only for audio stream or only for video stream.
E.G: if video stream stops --> fire event "video stopped", or if audio stream stops --> fire event "audio stopped"
Is it possible to fire such events?
This is my VB.net source code:
Code: Select all
Private Vlc As VideoLan.VideoLanClient
Private VlcPlayer As VideoLan.VlcMediaPlayer
Private VlcPlayerAudio As VideoLan.VlcMediaPlayer
Public Sub New()
InitializeComponent()
Vlc = New VideoLanClient()
VlcPlayer = Vlc.NewMediaPlayer(VideoPanel.Handle)
' in my form I have also an AudioPanel
'//VlcPlayer.TimeChanged += new EventHandler<TimeChangedEventArgs>(VlcPlayer_TimeChanged);
AddHandler VlcPlayer.PositionChanged, AddressOf VlcPlayer_PositionChanged
AddHandler VlcPlayer.StateChanged, AddressOf VlcPlayer_StateChanged
End Sub
Private Sub Play()
Dim desc As VlcMedia = Vlc.NewMedia("rtsp://196.0.0.19:8082/test2.sdp")
VlcPlayer.Load(desc)
desc.Dispose()
VlcPlayer.Play()
End Sub
Private Sub VlcPlayer_StateChanged(ByVal sender As Object, ByVal e As StateChangedEventArgs)
If InvokeRequired Then
Me.BeginInvoke(New EventHandler(Of StateChangedEventArgs)(AddressOf VlcPlayer_StateChanged), sender, e)
Else
Select Case e.NewState
Case VlcState.Ended
'The file ended play the next one
MsgBox("ENDED", MsgBoxStyle.Exclamation)
Case VlcState.Error
'Handle playing error
MsgBox("ERROR", MsgBoxStyle.Exclamation)
Case VlcState.Buffering
'Notify system is buffering
MsgBox("BUFFERING", MsgBoxStyle.Exclamation)
Case VlcState.Stopped
MsgBox("STOPPED", MsgBoxStyle.Exclamation)
Case VlcState.Playing
'''MsgBox("PLAYING", MsgBoxStyle.Exclamation)
End Select
End If
End Sub