LibVLCSharp.WPF VideoView data binding property MediaPlayer to viewmodel

This forum is about all development around libVLC.
leonY
New Cone
New Cone
Posts: 5
Joined: 17 Oct 2018 04:25

LibVLCSharp.WPF VideoView data binding property MediaPlayer to viewmodel

Postby leonY » 29 Aug 2019 10:59

Hi there

I have a LibVLCSharp.WPF.VideoView control on my WPF view page like

Code: Select all

<UserControl> <Grid> <LibVLCSharp.WPF.VideoView /> </Grid> </UserControl>
Is there a way to data bind the MediaPlayer property of the VideoView control to my page's ViewModel?

In fact, I only want to access the MediaPlayer.Hwnd property and would like to explore a way of getting it done in page's ViewModel, instead of in page's code-behind file.

mfkl
Developer
Developer
Posts: 739
Joined: 13 Jun 2017 10:41

Re: LibVLCSharp.WPF VideoView data binding property MediaPlayer to viewmodel

Postby mfkl » 29 Aug 2019 15:47

Is there a way to data bind the MediaPlayer property of the VideoView control to my page's ViewModel?
Using regular WPF databinding. I encourage you to read about it.

Code: Select all

<vlc:VideoView MediaPlayer="{Binding MediaPlayer}"/>
I only want to access the MediaPlayer.Hwnd property
When you set the mediaplayer on the videoview, the mediaplayer gets its hwnd set to that view's handle. You already have that information as far as I understand, and don't need to access the mediaplayer for this.
https://mfkl.github.io


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 31 guests