CapeCodGunny
12-23-2012, 12:40 PM
I'm using Basic Video with Delphi 2010. In simple terms I've got one TVLDSVideoPlayer, one TVLImageDisplay and three Buttons. Each button triggers the display of a windows media file.
I'm having a hard time finding the correct sequence of Methods and Property calls to keep the application from freezing up. This seems to only happen when the buttons are clicked in rapid succession one after the other.
I purposely have done this to simulate an end user trying to break the application.
What steps and in what order do I need to perform as to prevent the application from locking up?
Any help with be greatly appreciated.
Here is the code for each of the three movie buttons:
----------------------------------------------------
procedure TfmMainScreen.MovieButton1Click(Sender: TObject);
begin
VLDSVideoPlayer1.Pause;
VLDSVideoPlayer1.Stop;
VLDSVideoPlayer1.Close;
Application.ProcessMessages;
VLImageDisplay1.Clear;
VLDSVideoPlayer1.FileName := 'Movie01.wmv';
VLImageDisplay1.Visible := True;
TrackBar1.Enabled := True;
PauseButton.Enabled := True;
StopButton.Enabled := True;
// Make sure the component is not paused.
TrackBar1.WindowProc := SliderWndProc;
VLDSVideoPlayer1.Open;
VLDSVideoPlayer1.Paused := False;
VLDSVideoPlayer1.Start();
end;
procedure TfmMainScreen.MovieButton2Click(Sender: TObject);
begin
VLDSVideoPlayer1.Pause;
VLDSVideoPlayer1.Stop;
VLDSVideoPlayer1.Close;
Application.ProcessMessages;
VLImageDisplay1.Clear;
VLDSVideoPlayer1.FileName := 'Movie02.wmv';
VLImageDisplay1.Visible := True;
TrackBar1.Enabled := True;
PauseButton.Enabled := True;
StopButton.Enabled := True;
// Make sure the component is not paused.
TrackBar1.WindowProc := SliderWndProc;
VLDSVideoPlayer1.Open;
VLDSVideoPlayer1.Paused := False;
VLDSVideoPlayer1.Start();
end;
procedure TfmMainScreen.MovieButton3Click(Sender: TObject);
begin
VLDSVideoPlayer1.Pause;
VLDSVideoPlayer1.Stop;
VLDSVideoPlayer1.Close;
Application.ProcessMessages;
VLImageDisplay1.Clear;
VLDSVideoPlayer1.FileName := 'Movie03.wmv';
VLImageDisplay1.Visible := True;
TrackBar1.Enabled := True;
PauseButton.Enabled := True;
StopButton.Enabled := True;
// Make sure the component is not paused.
TrackBar1.WindowProc := SliderWndProc;
VLDSVideoPlayer1.Open;
VLDSVideoPlayer1.Paused := False;
VLDSVideoPlayer1.Start();
end;
I'm having a hard time finding the correct sequence of Methods and Property calls to keep the application from freezing up. This seems to only happen when the buttons are clicked in rapid succession one after the other.
I purposely have done this to simulate an end user trying to break the application.
What steps and in what order do I need to perform as to prevent the application from locking up?
Any help with be greatly appreciated.
Here is the code for each of the three movie buttons:
----------------------------------------------------
procedure TfmMainScreen.MovieButton1Click(Sender: TObject);
begin
VLDSVideoPlayer1.Pause;
VLDSVideoPlayer1.Stop;
VLDSVideoPlayer1.Close;
Application.ProcessMessages;
VLImageDisplay1.Clear;
VLDSVideoPlayer1.FileName := 'Movie01.wmv';
VLImageDisplay1.Visible := True;
TrackBar1.Enabled := True;
PauseButton.Enabled := True;
StopButton.Enabled := True;
// Make sure the component is not paused.
TrackBar1.WindowProc := SliderWndProc;
VLDSVideoPlayer1.Open;
VLDSVideoPlayer1.Paused := False;
VLDSVideoPlayer1.Start();
end;
procedure TfmMainScreen.MovieButton2Click(Sender: TObject);
begin
VLDSVideoPlayer1.Pause;
VLDSVideoPlayer1.Stop;
VLDSVideoPlayer1.Close;
Application.ProcessMessages;
VLImageDisplay1.Clear;
VLDSVideoPlayer1.FileName := 'Movie02.wmv';
VLImageDisplay1.Visible := True;
TrackBar1.Enabled := True;
PauseButton.Enabled := True;
StopButton.Enabled := True;
// Make sure the component is not paused.
TrackBar1.WindowProc := SliderWndProc;
VLDSVideoPlayer1.Open;
VLDSVideoPlayer1.Paused := False;
VLDSVideoPlayer1.Start();
end;
procedure TfmMainScreen.MovieButton3Click(Sender: TObject);
begin
VLDSVideoPlayer1.Pause;
VLDSVideoPlayer1.Stop;
VLDSVideoPlayer1.Close;
Application.ProcessMessages;
VLImageDisplay1.Clear;
VLDSVideoPlayer1.FileName := 'Movie03.wmv';
VLImageDisplay1.Visible := True;
TrackBar1.Enabled := True;
PauseButton.Enabled := True;
StopButton.Enabled := True;
// Make sure the component is not paused.
TrackBar1.WindowProc := SliderWndProc;
VLDSVideoPlayer1.Open;
VLDSVideoPlayer1.Paused := False;
VLDSVideoPlayer1.Start();
end;