question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add support for NativeControlHost inside a UserControl

See original GitHub issue

Is your feature request related to a problem? Please describe.

https://stackoverflow.com/questions/68292849/avaloniaui-cannot-embed-videoview-control-libvlcsharp-in-a-usercontrol

It seems the native window handle is not surfaced when the NativeControlHost is positioned inside a UserControl.

Describe the solution you’d like

Essentially a more advanced version of https://github.com/AvaloniaUI/Avalonia/blob/master/samples/interop/NativeEmbedSample/EmbedSample.cs

Being able to do so would improve the NativeControlHost support and help building native-based reusable components.

Describe alternatives you’ve considered

Other than that, the view is working fine on its own https://code.videolan.org/videolan/LibVLCSharp/-/blob/3.x/src/LibVLCSharp.Avalonia/VideoView.cs

Additional context

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
radiolondracommented, Sep 19, 2022

All the links updated (latest libs and samples versions)

Avalonia Unofficial LibVLCSharp Links

VLC video player inside an Avalonia Window/UserControl embedding single static customizable control (e.g.player buttons) LibVLCSharp.Avalonia.Unofficial

VLC video player inside an Avalonia Window/UserControl embedding multiple draggable customizable controls (e.g.player buttons, images,…) LibVLCSharp.Avalonia.Unofficial.UCanvas

LibVLCSharp.Avalonia.Unofficial Samples LibVLCSharp.Avalonia.Unofficial.Samples

LibVLCSharp.Avalonia.Unofficial.UCanvas sample LibVLCSharp.Avalonia.Unofficial.UCanvas.Samples

YAMP 2 - Open source video player sample using LibVLCSharp.Avalonia.Unofficial library Github sources Watch YAMP2 in action

3reactions
radiolondracommented, Apr 5, 2022

New test on Raspberry Pi (DietPi with MATE or Xfce)

It works fine!

Transparency and Opacity are fully honored.

In my opinion, the problem is not Avalonia vs Raspberry, the problem is what is installed or not in Raspberry.

With DietPi OS and MATE (or Xfce) as X, the sample works perfectly. And playback is smooth without jerks, interruptions or whatever.

As root, I installed libx11-dev, libvlc-dev and vlc, copied the published sample (built in Windows 10 with dotnet publish -c release -f net5.0 -r linux-arm), chmod 777 the whole folder content and ran the sample. It has to be ran as root or with sudo.

rpi rpi_000

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - AvaloniaUI: Cannot embed VideoView control ...
So that, on Github I created 2 repositories to share and show how to: Embed LibVLCSharp Avalonia VLC VideoView in Avalonia Window (AvaVLCWindow) ......
Read more >
Embedding Native (Windows and Linux) Views/Controls ...
This article describes embedding native Windows and Linux control into an Avalonia application.
Read more >
UserControls
Right click the folder in Solution Explorer that you'd like to add the control to · Select the Add -> New Item menu...
Read more >
UserControl.Content Property (System.Windows.Controls)
This following example creates a UserControl called NameReporter that asks for a name of a person, and reports it back to the user....
Read more >
Create a New View
In the Solution Explorer locate and right-click the Views folder. · Click Add and then New Item · Click Avalonia under C# Items...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found