Link to home
Start Free TrialLog in
Avatar of rendlert07
rendlert07

asked on

Creating A Transparent Control To Overlay Windows Media Player

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.


Avatar of AdrianJMartin
AdrianJMartin

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
SAMI file used by closed WM closed caption is a sort of HTML which include the use of Images as well
Avatar of rendlert07

ASKER

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

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.



ASKER CERTIFIED SOLUTION
Avatar of AdrianJMartin
AdrianJMartin

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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