Skip to content

Mouse events are not working after MediaPlayer.Play() was called on WinForms

Summary

Mouse events are not working after _mp.Play(new Media(_libVLC, "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4", FromType.FromLocation)); was called.

If I comment _mp.Play(new Media(_libVLC, "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4", FromType.FromLocation)); at line 39, mouse events are working.

_mp.EnableMouseInput = false; didn't solve the issue.

Steps to reproduce:

  1. Created Windows Forms .Net Framework App in MS VS 2019 Community
  2. Manage Nuget Packages...
  3. Install VideoLAN.LibVLC.Windows 3.0.8.1
  4. Install LibVLCSharp.WinForms 3.4.3
  5. Place videoView at Form1
  6. Add a new Event Click on videoView1
using LibVLCSharp.Shared;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace test1
{
    public partial class Form1 : Form
    {

        public LibVLC _libVLC;
        public MediaPlayer _mp;

        public Form1()
        {
            if (!DesignMode)
            {
                Core.Initialize();
            }

            InitializeComponent();

            _libVLC = new LibVLC();
            _mp = new MediaPlayer(_libVLC);
            videoView1.MediaPlayer = _mp;
            Load += Form1_Load;

            
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            _mp.Play(new Media(_libVLC, "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4", FromType.FromLocation));
            _mp.EnableMouseInput = false;
        }

        private void videoView1_Click(object sender, EventArgs e)
        {
            Console.WriteLine();
        }
    }
}

[dsfsdfsfsdf.zip] - an example project.

(/uploads/6db47e88ba5a422ca7a6a8cff74e26b9/dsfsdfsfsdf.zip)

Edited by Martin Finkel
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information