We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now


media player in delphi

data-nova asked
Medium Priority
Last Modified: 2012-08-14
I want to play some .wmv files in my program using the mediaplayer component.
now as you know mediaplayer displays the video in the component linked in the DISPLAY property.
in my program i have linked it to a panel.
the problem is that the video's original  dimension are 800 x 600 while my panel is half that size.
this causes the video to be displayed only half. is there any way to resize\zoom the video so that it fits on the panel ?
Watch Question

Some videos dont play in that, I have been looking at the activex control for WMP but that has really limited information avaiable.  I'm having a tough time finding info on that as I think thats actually the better component.  I wonder if D2006 has improved their media player so that all files will play on it (on D5 there are alot of videos that have problems).
ZhaawZSoftware Developer
I believe you have to set MediaPlayer1.DisplayRect
MediaPlayer1.DisplayRect := Panel1.ClientRect;

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
ZhaawZSoftware Developer

There's a problem with DisplayRect - if you make it 1000x100, it will show 1000x100 :) even if real video size is 800x600 (so it should show 133x100 instead of 1000x100), so some calculations will be needed to stretch it proportionally. Say if you need some help with this



 Hi Zhaawz ,

  thanks a lot :)
ZhaawZSoftware Developer

Glad to help ;]


but it cuts the movie , is there anyway to zoom it ?
ZhaawZSoftware Developer

Does it cut? It should stretch (zoom) a movie to specified rectangle (at least it did so when I tried it).

Zhaawz is right. Just place that line after Open and before play:

  MediaPlayer1.DisplayRect := Panel1.ClientRect;

Regards, Geo



 oh now it works :)  Geo was right the code has to be between Open and PLay.

 thanks a lot Zhaawz and Geo
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.