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.

asked Nov 20, 2016 at 14:03
4
  • Overlaying video may well take an extra window. Commented Nov 20, 2016 at 17:16
  • @TaW any workaround to overlay text on video? Commented Nov 21, 2016 at 2:37
  • There are many ways of using a VLC control in a C# project. What are you using? Commented Nov 21, 2016 at 13:42
  • @JosepB, like i mentioned in Question. i'm using VlcDotNet Commented Nov 23, 2016 at 6:29

4 Answers 4

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
answered Nov 23, 2016 at 7:56
Sign up to request clarification or add additional context in comments.

Comments

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...

answered Nov 13, 2019 at 15:50

Comments

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);

answered Mar 18, 2020 at 17:09

1 Comment

can you also list color example ?
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

answered Mar 28, 2023 at 17:08

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.