3

This kind of question is asked many times.
but for some reason its not working as expected!
i'm using vlc in a Panel(Control) then placed a label on top of vlc control. i want label's background to be transparent. i used below code

  label1.Parent = vlcControl1;
  label1.backColor = Color.Transparent;

The issue here is that label displays until vlc is not playing any media.
as soon as i play a media file, label gets hidden.
i also tried

  label1.bringToFront();
  label1.Visible=true;

if i stop vlc from playing a video file vlcControl1.Stop(); label will then be visible.

Community
  • 1
  • 1
Prakash M
  • 659
  • 1
  • 12
  • 36

4 Answers4

3

The Windows Forms version has the airspace issue, and I don't know available workarounds for solving it.

For the WPF version, this is a known problem of the last version of VlcDotNet: Wpf VlcControl seems to ignore ZIndex and VlcControl is always on the top of my window It happens since the WPF VLC control is a HwndHost displaying the Windows Forms control.

The known alternatives should be, using WPF and:

  1. Use the old version of VlcDotNet (version 1.2.0.0 hasn't the airspace issue)
  2. Use an alternative control with a pure WPF implementation, for example Meta.Vlc
  3. Implement a workaround for the airspace issue, for example AirspacePopup
Community
  • 1
  • 1
Josep B.
  • 587
  • 1
  • 6
  • 16
2

Here is the current state of the art, in 2019:

As of Vlc.DotNet 3.0, the WPF control doesn't have the airspace issue. However, rendering is done on the CPU, which kills perf (aka, you shouldn't be using it) ( https://github.com/ZeBobo5/Vlc.DotNet/issues/296 )

With LibVLCSharp, another approach was taken, that implements an airspace hack.

Sadly, it's all tradeoffs...

cube45
  • 3,429
  • 2
  • 24
  • 35
2

I had this problem to set subtitle handly and I change my strategy to don't use any label from my own or anything else. actually Libvlc C# (libvlcSharp) has an option to do this with Marquee. this is my code:

_mediaPlayer.SetMarqueeInt(VideoMarqueeOption.Enable, 1); //enable marquee option
_mediaPlayer.SetMarqueeInt(VideoMarqueeOption.Size, 32); //set the font size 
_mediaPlayer.SetMarqueeInt(VideoMarqueeOption.Position, 8); //set the position of text
_mediaPlayer.SetMarqueeString(VideoMarqueeOption.Text, "my text"); //to set subtitle or any other text

position have options like this and also you can set position by _mp.SetMarqueeInt(VideoMarqueeOption.X, 50); and _mp.SetMarqueeString(VideoMarqueeOption.Y, 50);

Mohammad
  • 537
  • 9
  • 6
0

or use vlc on another form.. behind. then open form2, with controls on it. Place the controls on the second form, with 'transparent backgrounds' they will float on the video. Sometimes need to fix anti-alias