DelphiFAQ Home Search:
General :: Programming :: Delphi
General Delphi related information.


This list is sorted by recent document popularity (not total page views).
New documents will first appear at the bottom.
Recommended links on this topic:
Featured Article

Resizing and changing borderstyle of TMediaPlayer while a movie is playing


Resizing the video display using the diaplayrec property of the mediaplayer is no problem, but if I try to change the borderstyle of the display form the movie stops playing.

I am trying it with the following code snippet (assume the current borderstyle is bsSizeable):

Any suggestions?


When the switching the border on or off, the window is recreated so it has a new handle. I have solved the problem in the past by stopping the player before changing the border and restarting it after changing it.

Form1.MediaPlayer1.Notify := False;  
 // I use the OnNotify event to change
 // the video playing when the current one ends
 // Comment out the next line and the movie keeps playing after the resize
 Form2.BorderStyle := bsNone;
 Form2.ClientHeight := 240;
 Form2.ClientWidth := 320;
 Form1.MediaPlayer1.DisplayRect := Form2.ClientRect;
 Form1.MediaPlayer1.Notify := False;

Generated 12:01:58 on Oct 13, 2019