VideoView Background is very unstable from LibVLCSharp.WPF
You can see this video, The VideoView control's background is unstable. When I click the button more than 20 times to open the VLC control, the background of the control sometimes doesn't render black, but some other color.
I just opened the VLC control and I didn't play any video. So the problem is not due to playing the video.
I didn't set any background color for the VLC control, so its background color should always be black by default.
Full Test C# code .NET 6.0 With Visual studio 2022 (With LibVLCSharp.WPF 3.6.6)
MainWindow.xaml
<Window x:Class="VLCTransparentWindowTest.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:VLCTransparentWindowTest"
mc:Ignorable="d" WindowStartupLocation="CenterScreen"
Title="MainWindow" Height="450" Width="800">
<Grid>
<Button Content="Button" Margin="318,166,350,206" Click="Button_Click"/>
</Grid>
</Window>
MainWindow.xaml.cs
using System.Windows;
namespace VLCTransparentWindowTest
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void Button_Click(object sender, RoutedEventArgs e)
{
var window = new TestWindow();
window.ShowDialog();
}
}
}
TestWindow.xaml
<Window x:Class="VLCTransparentWindowTest.TestWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:VLC="clr-namespace:LibVLCSharp.WPF;assembly=LibVLCSharp.WPF"
mc:Ignorable="d" WindowStartupLocation="CenterScreen"
Title="TestWindow" Height="400" Width="600" Background="Black">
<Grid>
<VLC:VideoView x:Name="player" x:FieldModifier="private">
</VLC:VideoView>
</Grid>
</Window>
TestWindow.xaml.cs
using System.Windows;
namespace VLCTransparentWindowTest
{
public partial class TestWindow : Window
{
public TestWindow()
{
InitializeComponent();
}
}
}