Solved

Creating A Transparent Control To Overlay Windows Media Player

Posted on 2004-03-22
7
3,890 Views
Last Modified: 2012-06-27
I am in the process of trying to overlay a control (any that will support transparency i would think should work) over the top of the Windows Media Player 9 ActiveX
control (currently contained in a Windows Form). What I cant seem to be able to do is to be able to get any type of control to show transparently over the top of the MediaPlayer control.

++ Basically what I want is the type of effect you see on tv every day where text is dispayed transparently over the video content that you are watching. Preferably I would like to see a method that would also enable to me to display images transparently over Media Player. One possible way may be overrideing the onPaint() method of a label and displaying a gdi+ pregenerated bitmap containing the text.


Please note also that this is a C# project so I would highly prefer answers in C# although I would also be willing to accept answers in VB.Net if you are not familiar with c# syntax. This is also a Windows Form project so please no Web Form related answers (ie web page embedding).

Heres what i have already tried (all involve hosting the ActiveX control in a windows form)

1)
MediaPlayer.windowlessVideo = true; //also tried false
MediaPlayer.Controls.Add(myLabel); //where mylabel is a label with backcolor set to System.Color.FromArgb(125,Color.white)
myLabel.bringtofront();

this doesnt give the desired effect and i cant see the video playing underneath myLabel as i would expect from setting the backcolor to a transparent color

2)
I then tried just adding myLabel to the same container form of the MediaPlayer control

this gives the same undesired effect.

3)
I then tried having 2 separate forms. One to house the media player control. and another to open on top of that form with its opacity set < 1 so that I would be
able to see MediaPlayer underneath.

This also didnt give the desired effect. While the forms opacity was visually affected, it only affected the border of the windows form and you still couldnt see the Video underneath the form.


0
Comment
Question by:rendlert07
  • 4
  • 3
7 Comments
 
LVL 5

Expert Comment

by:AdrianJMartin
ID: 10656391
WM uses optimized framebuffer writting techniques to display the video as best a possible for its host computer, sometime the video card does all the work and overlays the video onto the windows screen buffer.

This would make it very difficult to over lay the text the way you want to.

But WM does support video captioning, after adding your wm9 control to your form notice there are fice icons on the top of the Properties window, the right most one is advanced it lauches a dialog where you can set the closed caption settings file.

for the format of the file look here

http://msdn.microsoft.com/library/en-us/dnacc/html/atg_samiarticle.asp?frame=true
0
 
LVL 5

Expert Comment

by:AdrianJMartin
ID: 10656413
SAMI file used by closed WM closed caption is a sort of HTML which include the use of Images as well
0
 
LVL 2

Author Comment

by:rendlert07
ID: 10661002
im going to make an assumption here that if i did specifiy an image in a .sami file then that image may be overlayed onto the video that is playing but it wouldnt offer any sort of transparency so that the user would be able to see the video underneath, correct?
0
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
LVL 5

Expert Comment

by:AdrianJMartin
ID: 10665790
actually the text is not overlayed on the video but displayed in a block below the video, sorry.

They way that wm draws the video will allways get in your way. I suppose you could use regions and floatting window above the video....


You could compose the video with the captions in place, Windows Movie Maker lets you do this, have two videos one with and one without and move between the two as needed.

http://www.microsoft.com/windowsxp/moviemaker/downloads/moviemaker2.asp


Wait for LongHorn :-)
http://msdn.microsoft.com/msdntv/episode.aspx?xml=episodes/en/20031028LHORNDB/manifest.xml

0
 
LVL 2

Author Comment

by:rendlert07
ID: 10675048
I really appreciate your help thus far but...and maybe i wasnt clear enough when i first asked the question

the reason i was interested in a solution involving overlaying a control (such as a label that supports transparency) is so that I can provide dynamic content over the video. Just overlaying the control is the easy part, but getting that control to actually display correctly when partially transparent is where ive been running into difficulties.

[quote]They way that wm draws the video will allways get in your way. I suppose you could use regions and floatting window above the video....[/quote]

[quote]I  having 2 separate forms. One to house the media player control. and another to open on top of that form with its opacity set < 1 so that I would be
able to see MediaPlayer underneath. [/quote]

I tried the floating window and that didnt work. Changing regions has no application in this scenario as all it would enable me to do is make part of the form completely invisible. And since im looking for the transparent look...well you get the drift.



0
 
LVL 5

Accepted Solution

by:
AdrianJMartin earned 500 total points
ID: 10675535
Ok Ok.

This does work sort of but it will hightlight what I've been saying:-

Set up your form 1 with the player on it have it playing movie.
Open another form 2 with its opacity set to 50% have form 1 open form 2.

as the video plays right click it select options, click advanced button and turn use "use overlays" off. OK

bring you form2 to the front and hover it over the player,, TA DA!!!!

but on my system it sometimes flickers, I suspect that this it the form2 trying desparatly to handle the onPaint event, so some otimisations will be required here.




0
 
LVL 2

Author Comment

by:rendlert07
ID: 10684022
unfortunately as you said it does cause flickering and while it does indeed work, with a simple form with a few controls on it i had major flicker problems.

given the fact that my setup is

ati radeon 9800pro
amd athlon 2800+ cpu

i dont think that any amount of coding you could do would be able to fix the flickering.

However given that your solution sort of gave me what i wanted im gonna give you the points. Im going to start up a new related question for 500 more points
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question