Board index » delphi » MediaPlayer: video flash

MediaPlayer: video flash

This is a slightly updated post from that left on
comp.lang.pascal.borland last week.

I am having a slight flashing problem when working with the MediaPlayer
control.  I have a form Form1 with an image Image1 on top of it.  When
I open a avi file to display it to Form1, I get a slight flash and it
is not a palette problem.

Here is the opening code:

    with MediaPlayer1 do
      begin
        Filename := <avi file>;
        Display := Form1;
        Open;
        DisplayRect:= Rect(10, 10, 0, 0);
      end;

I tried using an invisible panel as the Display destination and that
resolved that flash, but there were 2 problems with that solution:

1. When I make the panel visible (before or after the play comamnd) I
   get the panel flashing without the video picture before the video
   plays.
2. When I make the panel invisible, the video disappears before the panel
   once again letting the true color of the panel come through.

This solution does give you the option of showing only specific
portions of the video by resizing the panel and setting the left and
top properties to negative values, but that panel flash is pretty
sloppy!

Any help would be appreciated.

-J
deva...@infocosm.ac.com

 

Re:MediaPlayer: video flash


In article <3v10vg$...@grant.cstar.andersen.com>, "John W. DeValk" <deva...@infocosm.ac.com> says:

John,

You may not need both a Rect and a panel/image. One or the other should do it.

Quote
>I tried using an invisible panel as the Display destination and that
>resolved that flash, but there were 2 problems with that solution:

>1. When I make the panel visible (before or after the play comamnd) I
>   get the panel flashing without the video picture before the video
>   plays.
>2. When I make the panel invisible, the video disappears before the panel
>   once again letting the true color of the panel come through.

>This solution does give you the option of showing only specific
>portions of the video by resizing the panel and setting the left and
>top properties to negative values, but that panel flash is pretty
>sloppy!

I know, I've had the same problem. The trouble is that Delphi (or Windows ?)
builds up the screen from the form all the way to the top-most control.
Therefore your panel gets painted before the video on it.

The only real solution I can think of is clever use of colours. eg. start
your AVI with a black frame and show it on a black background inside a black
panel. I realise this may not be convenient.

Regards,

Gary.

Re:MediaPlayer: video flash


Look into the 'validaterect' and 'validatergn' Windows API
commands.  If you use them at the right times you can fix this
flash/flicker problem.  I have run .avi files where Display
was set to the main form instead of a separate window and
'validaterect' fixed all of my blackbox/flicker problems.

R.Hogen

Other Threads