简体   繁体   中英

Delphi MediaPlayer adjust size

I have a simple form that loads and plays a video using the media player, and media player control components. Is there a way to resize the video played, using a scrollbar or something similar in RAD Studio XE6.

Resizing is usually done by resizing the form hosting the viewport, not with scrollbars. Try putting the media player in a sizable form or panel with anchors on all four sides so it expands and contracts as you adjust the corners of the form.

You can implement sort of ZoomIn or ZoomOut functionalitay by adjusting the DisplayRect property:

http://docwiki.embarcadero.com/Libraries/XE6/en/Vcl.MPlayer.TMediaPlayer.DisplayRect

First you would probably want to set DisplayRect to the size of the control/component which you have selected as rendering target using Display property:

http://docwiki.embarcadero.com/Libraries/XE6/en/Vcl.MPlayer.TMediaPlayer.Display

In order to avoid uneven wideo streching I recomend you add necessary code to be able to calculate proper DisplayRect dimensions while maintaing aspect ratio.

If you want you can make DisplayRect even larger than your rendering conroll. By doing this you realy achieve that ZoomIn effect.

Do note that this only strectches the video content so you may expirience loss of quality, becouse TMediaPlayer doesen't use any special filters for doing so as many comercial Media Players do.

EDIT: I don't have expirience about using of TMediaPlayer on FireMonkey platform but after looking at documentation it seems that things have been changed quite a bit.

For instance on FMX there is special component called TMediaPlayerControll which is required for rendering video on.

http://docwiki.embarcadero.com/Libraries/XE7/en/FMX.Media.TMediaPlayerControl

But looking at documentation I can't find any special properties or methods to controll the video size. So I gues that implementing of ZoomIn or ZoomOut functionality would be using the same approach as it can be used with normal FireMonkex components.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM