How to show/hide the in-built on-screen UI controls?
I embedded Mpv.NET into a Windows Form. It works, but it has no UI controls for the video (seekbar, stop/play). Mpv has a basic in-built GUI (white one). How to show/hide it? This library has almost no documentation for the methods.
Hello @HubKing
I've been investigating this but sadly to no avail... yet! My findings so far:
- OSC is enabled by setting these properties: osc=yes, osd-level=1 (this will be done internally once this issues is fixed)
- An mpv instance which is not embedded (by not specifying a handle in the MpvPlayer constructor) shows the OSC.
- An mpv instance which is embedded will not show the OSC. I believe this may be because the embedded player is not receiving mouse events. (possibly being caught by WPF/WinForms)
This behaviour is consistent across WPF and WinForms. I will continue to investigate.
Hello @HubKing, I now understand why the OSC does not work correctly. The mpv player is not receiving mouse events that would trigger the OSC (and allow us to interact with it), this was done purposefully by mpv to allow applications which embed mpv to implement their own event handlers.
That said, it is possible to forward the events onto mpv from your application. I would refer you to this code written for Mpv.NET (media player), they came across the same problem: https://github.com/stax76/mpv.net/blob/7e8a654ada9c351063cddd3228e04d7fbd2f56db/mpv.net/WinForms/MainForm.cs#L410 From this you can see they overrode the WndProc method and forwarded the appropriate messages to mpv.
There is also this discussion on the mpv repository: https://github.com/mpv-player/mpv/issues/4795
I will investigate how this could be done from a library which does not receives Windows messages.
I am sorry for the late reply. Thank you for your investigation on this issue, Hudec. I could just copy & paste the code you have linked.
Hello @HubKing, I think that would be your best bet in the short-term. I don't know when I will find the time to try and implement this natively within the library. I'll keep this ticket open and update it when I make any progress.