-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Opacity of player and Video with Alpha #332
Comments
Hi @Sash0check, currently flyleaf does not support transparency. |
I have started experimenting with this, since I want to make the entire video semi transparent with something else sitting behind it, and that isn't possible currently either. It involves tinkering with things deep down in the rendering level though, including (probably) setting up a BlendState on the DirectX device context. |
I think I've done it in the past, by settings the color.a to transparent in the pixel shader https://github.com/SuRGeoNix/Flyleaf/blob/master/FlyleafLib/MediaFramework/MediaRenderer/ShaderCompiler.cs#L367 |
In terms of making the video play with an overall opacity of <100% this turned out to be quite simple in the end, and did not involve changing the pixel shader or renderer code. All it needed was two things inside FlyleafHost:
The app level window that holds the FlyleafHost also needs to have Transparency enabled and Opacity=0 to get a fully translucent effect to desktop level. Turning this from a PoC to a feature should make it possible to achieve fade-up/fade-down and cross-fade effects between overlapping players. I don't know yet if the same thing will work with the WinFormsHost, that may still be subject to the classic WPF/WinForms airspace issue. One thing it doesn't quite do is allow for the non-active portion of the player window to be totally transparent, as in when the video aspect doesn't fit the window shape. (Even though you can specify an alpha in the Player.Config.Video.BackgroundColour the renderer does not currently honour this, it just comes out solid but is subject to the alpha of the Surface behind it in the same way that the video itself is handled). As for videos that themselves contain an alpha channel, this doesn't currently work either for the same reason - may just need a bit more work on the pixel shader to handle the alpha plane. |
@SuRGeoNix this commit[1b3f7a9] work with [Config.Video.BackgroundColor],but hope to set Transparent and mix with the host window background.i try to do everything(baidu、bing 、stackoverflow……),but come to nothing. |
oh,i got a way! #492 |
Hello! I can't cahnge opacity of player element in WPF. It works on child elements but video not. And second question: my transparent video in dxv format showing with black background can i fix this? Thanks
The text was updated successfully, but these errors were encountered: