Activex Axvlcplugin2 no event works

Asked

Viewed 161 times

1

I possess in my form a VLC Player. In it, I need to get basic information like video duration and current position. but no event works.

Am I doing something wrong? Follow code:

public Form1()
{
    InitializeComponent();

    vlc.play += vlc_play;

    OpenFileDialog ofd = new OpenFileDialog();
    ofd.Filter = "AVI (*.avi)|*.avi|MP4|*.mp4"; //Definindo o filtro (extensões dos vídeos pelos quais o OpenFileDialog buscará).
    if (ofd.ShowDialog() == DialogResult.OK) //Teste para verificar se o arquivo foi selecionado.
    {
        //MessageBox.Show(ofd.FileName);
        vlc.playlist.items.clear();
        vlc.playlist.add(new Uri(ofd.FileName).AbsoluteUri); //Adicionando vídeo à playlist.
        vlc.playlist.play();
    }


}

void vlc_play(object sender, EventArgs e)
{
    MessageBox.Show(Convert.ToString(vlc.input.Position));
}

my solution, unfortunately, is to use a timer to get the information.

  • I didn’t understand what you meant in the timer part. You can only get the video information some time after play?

  • The Play event or Mediaplayerplaying doesn’t work, in fact no event works, I don’t know what I’m doing wrong. i am using the Timer object with interval of 1 second to get the current position because the Mediaplayerpositionchanged event does not work.

1 answer

1

The most interesting in this case would be to use the Mediaplayerpositionchanged event itself to get the current position.

In this case, simply assign the Event Handler

vlc.MediaPlayerPositionChanged += vlc_play;

And change the parameter of the same, since the class Eventargs does not appear in the definition of the delegate to which he refers:

void vlc_play(object sender, AxAXVLC.DVLCEvents_MediaPlayerPositionChangedEvent e)
{
    MessageBox.Show(Convert.ToString(axVLCPlugin21.input.Position));
}
  • I’ve tried that but it just doesn’t work, no event works.

  • Strange, here it is working normally... You didn’t change vlc.input.Position for e.Position? Because in this case it will always indicate 0.

  • Not actually it is not even entering the event method, maybe it is the version of activex I am using the latest version and you?

  • I’m using 1.1.9 of VLC. So that’s about it, try switching to an earlier version of Activex.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.