Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Creating A Transparent Control To Overlay Windows Media Player

Posted on 2004-03-22
7
Medium Priority
?
4,219 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses
Course of the Month12 days, 15 hours left to enroll

971 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