Solved

Creating A Transparent Control To Overlay Windows Media Player

Posted on 2004-03-22
7
3,784 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Events in static methods 3 50
Different Delete Messages 7 37
How to iterate over object and get property name and value 4 26
Definitions and default visual studio colors 5 58
Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

910 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now