ActiveX VLC Player events not working

I have included ActiveX VLC pligin in a WPF application . And the VLC plugin is working fine.

AxVLCPlugin vlc = new AxVLCPlugin(); vlc.MediaPlayerEncounteredError += vlc_MediaPlayerEncounteredError; vlc.MediaPlayerOpening += vlc_MediaPlayerOpening; vlc.MediaPlayerBuffering += vlc_MediaPlayerBuffering; vlc.MediaPlayerEndReached += vlc_MediaPlayerEndReached; // // Other code // like windowsFormsHost1.Child = vlc; and etc vlc.addTarget(videoURL, null, AXVLC.VLCPlaylistMode.VLCPlayListReplace, 1); vlc.play(); 

But like all VLC events do not work at all.

I mean these events:

 vlc.MediaPlayerEncounteredError += vlc_MediaPlayerEncounteredError; vlc.MediaPlayerOpening += vlc_MediaPlayerOpening; vlc.MediaPlayerBuffering += vlc_MediaPlayerBuffering; vlc.MediaPlayerEndReached += vlc_MediaPlayerEndReached; void vlc_MediaPlayerEndReached(object sender, EventArgs e) { Debug.WriteLine("[P] - StreamingVideo - END REACHED + " + DateTime.Now); } void vlc_MediaPlayerBuffering(object sender, DVLCEvents_MediaPlayerBufferingEvent e) { Debug.WriteLine("[P] - StreamingVideo - BUFFERING + " + DateTime.Now); } void vlc_MediaPlayerOpening(object sender, EventArgs e) { Debug.WriteLine("[P] - StreamingVideo - OPENING + " + DateTime.Now); } void vlc_MediaPlayerEncounteredError(object sender, EventArgs e) { Debug.WriteLine("[P] - StreamingVideo - ERROR + " + DateTime.Now); } 

They do not shoot. (Of course, I set breakpoints in these methods.)

I really need to catch streaming errors and reapply videoURL another time. So I'm experimenting with events to find out which ones I can use to achieve this.

Any clue why?

PS This link also doesn’t help capturing VLC player events

+8
c # wpf activex vlc
source share
3 answers

I do not think that you are doing something wrong. It seems; these events were not implemented (or not implemented) for any reason (even in the latest version of ActiveX). I read that these events are either too distorted or not triggered at all in some versions of browser plug-ins.

However, he still has 3 useful and working events that you can count on.
Event Burning: playEvent , pauseEvent and stopEvent
No Shooting Events: All events starting with MediaPlayer ...

In any case, the code below works with the events I mentioned:

  AxVLCPlugin vlc; public MainWindow() { InitializeComponent(); vlc = new AxVLCPlugin(); windowsFormsHost1.Child = vlc; vlc.pauseEvent += new EventHandler(vlc_pauseEvent); vlc.playEvent += new EventHandler(vlc_playEvent); vlc.stopEvent += new EventHandler(vlc_stopEvent); } void vlc_playEvent(object sender, EventArgs e) { Debug.WriteLine("playEvent fired!"); } void vlc_pauseEvent(object sender, EventArgs e) { Debug.WriteLine("pauseEvent fired!"); } void vlc_stopEvent(object sender, EventArgs e) { Debug.WriteLine("stopEvent fired!"); } private void button1_Click(object sender, RoutedEventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); ofd.ShowDialog(); if (ofd.FileName != "") { Debug.WriteLine(ofd.FileName); vlc.addTarget("file:///" + ofd.FileName, null, AXVLC.VLCPlaylistMode.VLCPlayListReplaceAndGo, 0); vlc.play(); } } 

However, these events do not inform you of any streaming errors. IMO, only you can do it; try-catch where you execute vlc.addTarget(...) and vlc.play() . Check if the URL is valid (also remember to include the "file:///" infront of the file path with the latest versions of the plugin). And reapply videoURL (as you like) only if the caught error is not related to a nonexistent file or an invalid path, etc.

OR , you can try other shells / user libraries:

+4
source share

There should not be something like this:

 vlc.MediaPlayerEncounteredError += new MediaPlayerEncounteredErrorEventHandler(vlc_MediaPlayerEncounteredError); 
0
source share

Right-click axVLCPlugin21_MediaPlayerend in axVLCPlugin21_MediaPlayerend Design "→" Properties "→" Event "(thunder icon) → select" axVLCPlugin21_MediaPlayerend in MediaPlayerEndReached .

See image for more details:

0
source share

All Articles