Media Element on a Transparent Window...
-
Hello, I have a media element playing a video. When I try to make the window transparent (by setting the AllowsTransparency property of the System.Windows.Window class to 'true') the application begins to run very slowly and the media element no longer plays the video correctly (the media element looks like a flickery green rectangle). I imagine what I want to do is possible, but I'm going about it the wrong way. For reasons that are unimportant to this post, I want the media element to look like it is free-floating and moving about the screen (when in actuality it would be moving about a transparent containing window). How do I create a completely transparent window that contains a media element (where the media element is playing a video)? Again, I want it to look to the user as though the video is not in a window, but right on the desktop. Thanks! Ian
-
Hello, I have a media element playing a video. When I try to make the window transparent (by setting the AllowsTransparency property of the System.Windows.Window class to 'true') the application begins to run very slowly and the media element no longer plays the video correctly (the media element looks like a flickery green rectangle). I imagine what I want to do is possible, but I'm going about it the wrong way. For reasons that are unimportant to this post, I want the media element to look like it is free-floating and moving about the screen (when in actuality it would be moving about a transparent containing window). How do I create a completely transparent window that contains a media element (where the media element is playing a video)? Again, I want it to look to the user as though the video is not in a window, but right on the desktop. Thanks! Ian
Make the Window transparent. Paint the background black. Set the opacity to 0. Run and tell me what happens.
Cheers, Karl
» CodeProject 2008 MVP » Microsoft MVP - Client App Dev My Blog | Mole's Home Page | MVP ProfileJust a grain of sand on the worlds beaches.
-
Make the Window transparent. Paint the background black. Set the opacity to 0. Run and tell me what happens.
Cheers, Karl
» CodeProject 2008 MVP » Microsoft MVP - Client App Dev My Blog | Mole's Home Page | MVP ProfileJust a grain of sand on the worlds beaches.
Thanks for the reply. I don't know what you mean by: Make the Window Transparent Paint the background black. If I set the background as black, how can I make the window transparent? (BTW, when I set the opacity of the window to 0, the media element is no longer visible.)
-
Thanks for the reply. I don't know what you mean by: Make the Window Transparent Paint the background black. If I set the background as black, how can I make the window transparent? (BTW, when I set the opacity of the window to 0, the media element is no longer visible.)
Post your XAML and I'll edit it for you.
Cheers, Karl
» CodeProject 2008 MVP » Microsoft MVP - Client App Dev My Blog | Mole's Home Page | MVP ProfileJust a grain of sand on the worlds beaches.
-
Post your XAML and I'll edit it for you.
Cheers, Karl
» CodeProject 2008 MVP » Microsoft MVP - Client App Dev My Blog | Mole's Home Page | MVP ProfileJust a grain of sand on the worlds beaches.
Title="Window1" Height="768" Width="1024" Background="Transparent" AllowsTransparency="False" WindowStyle="None" ResizeMode="NoResize" Opacity="1" Visibility="Collapsed"> <Grid Background="Transparent"> <MediaElement Canvas.Left="96" Canvas.Top="38" Height="262" Name="mediaElement1" Source="C:\Windows\Web\Windows DreamScene\vid8899.mpg" Width="560" /> </Grid> </Window>
-
Title="Window1" Height="768" Width="1024" Background="Transparent" AllowsTransparency="False" WindowStyle="None" ResizeMode="NoResize" Opacity="1" Visibility="Collapsed"> <Grid Background="Transparent"> <MediaElement Canvas.Left="96" Canvas.Top="38" Height="262" Name="mediaElement1" Source="C:\Windows\Web\Windows DreamScene\vid8899.mpg" Width="560" /> </Grid> </Window>
I just did this program and it works perfect.
<Window x:Class="Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="769" Width="1024"
Background="Transparent" AllowsTransparency="True"
WindowStyle="None" ResizeMode="NoResize"><Grid Background="Transparent">
<MediaElement Source="MetadataFormGeneration.wmv" Height="1024" Width="768" />
</Grid></Window>
Cheers, Karl
» CodeProject 2008 MVP » Microsoft MVP - Client App Dev My Blog | Mole's Home Page | MVP ProfileJust a grain of sand on the worlds beaches.
-
I just did this program and it works perfect.
<Window x:Class="Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="769" Width="1024"
Background="Transparent" AllowsTransparency="True"
WindowStyle="None" ResizeMode="NoResize"><Grid Background="Transparent">
<MediaElement Source="MetadataFormGeneration.wmv" Height="1024" Width="768" />
</Grid></Window>
Cheers, Karl
» CodeProject 2008 MVP » Microsoft MVP - Client App Dev My Blog | Mole's Home Page | MVP ProfileJust a grain of sand on the worlds beaches.
I think the difference is that your media element is larger than your window. I was trying to have a smaller video move around inside a larger, invisible window. (BTW, thanks for your efforts with this problem.) Ian
-
I think the difference is that your media element is larger than your window. I was trying to have a smaller video move around inside a larger, invisible window. (BTW, thanks for your efforts with this problem.) Ian
I just made the video 1/2 the size of the window without any problem. What type of computer do you have. I have heard that some people have issues with older systems.
Cheers, Karl
» CodeProject 2008 MVP » Microsoft MVP - Client App Dev My Blog | Mole's Home Page | MVP ProfileJust a grain of sand on the worlds beaches.
-
I just made the video 1/2 the size of the window without any problem. What type of computer do you have. I have heard that some people have issues with older systems.
Cheers, Karl
» CodeProject 2008 MVP » Microsoft MVP - Client App Dev My Blog | Mole's Home Page | MVP ProfileJust a grain of sand on the worlds beaches.
Brand new Dell Precision m6300 laptop. Maybe I'm just trying to do something that my system can't handle. But if this system can't handle it, I don't want to do it anyway. Thanks for your help. Ian
-
Brand new Dell Precision m6300 laptop. Maybe I'm just trying to do something that my system can't handle. But if this system can't handle it, I don't want to do it anyway. Thanks for your help. Ian
Did you try my exact code on your system (need to change the video source)? Did you get the same issue? What is your systems Windows Experience Index? What is your Graphics score? What is your Gaming graphics score?
Cheers, Karl
» CodeProject 2008 MVP » Microsoft MVP - Client App Dev My Blog | Mole's Home Page | MVP ProfileJust a grain of sand on the worlds beaches.