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?
– Michael Siegwarth
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.
– Tuyoshi Vinicius