DelphiFAQ Home Search:

Resizing and changing borderstyle of TMediaPlayer while a movie is playing

 

commentsThis article has not been rated yet. After reading, feel free to leave comments and rate it.

Question:

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?

Answer:

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
Form1.MediaPlayer1.Pause;

// 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;
Form1.MediaPlayer1.Resume;

Comments:

2006-11-24, 08:47:33
hunter from China  
so good

 

 

NEW: Optional: Register   Login
Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option, or post under a registered account.
 

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity.
The owner of this web site reserves the right to delete such material.

photo Add a picture: