Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Multimedia (https://www.delphipraxis.net/16-multimedia/)
-   -   Delphi Forms (https://www.delphipraxis.net/182550-delphi-forms.html)

drama22 31. Okt 2014 09:09

Delphi Forms
 
hi , i have two forms first form have a button to call the second form like this

Delphi-Quellcode:
 secondform.FormStyle := fsStayOnTop;
 secondform.Show;
the second form have a embeddedwb with youtube player my problem is if i close the second form when youtube is playing it doesn't stop playing the youtube video until i close the whole application any solve for this ?

Der schöne Günther 31. Okt 2014 09:12

AW: Delphi Forms
 
Since you posted no details, we don't have the slightest clue how that "youtube player" works.

You will have to implement an event handler for
Delphi-Quellcode:
OnClose
on your second form and make sure the video is properly shut down.

drama22 31. Okt 2014 09:39

AW: Delphi Forms
 
Zitat:

Zitat von Der schöne Günther (Beitrag 1278151)
Since you posted no details, we don't have the slightest clue how that "youtube player" works.

You will have to implement an event handler for
Delphi-Quellcode:
OnClose
on your second form and make sure the video is properly shut down.

i tried to do somthing like that

Delphi-Quellcode:
procedure secondform.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  embeddedwb.AssignEmptyDocument;
  embeddedwb.Free;
end;

procedure secondform.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
  CanClose := True;
  Self.Hide;
end;
thats close the video and its sound but i cant open it again until i close the whole app and re open it

note i load youtube player inside tembeddedwb

Sherlock 31. Okt 2014 09:48

AW: Delphi Forms
 
Well, if you destroy the player, and reuse the form, without recreating it...how should the player do its work?

Either don't free the player and just try stopping the video or recreate the player when the form is shown agein.

Sherlock

drama22 31. Okt 2014 14:15

AW: Delphi Forms
 
Zitat:

Zitat von Sherlock (Beitrag 1278164)
Well, if you destroy the player, and reuse the form, without recreating it...how should the player do its work?

Either don't free the player and just try stopping the video or recreate the player when the form is shown agein.

Sherlock

is there example on how to stop the player on close ?

Sir Rufo 31. Okt 2014 14:16

AW: Delphi Forms
 
I would have expected that
Delphi-Quellcode:
embeddedwb.AssignEmptyDocument;
should do the job to stop.

drama22 31. Okt 2014 14:28

AW: Delphi Forms
 
Zitat:

Zitat von Sir Rufo (Beitrag 1278229)
I would have expected that
Delphi-Quellcode:
embeddedwb.AssignEmptyDocument;
should do the job to stop.

You saved Me Many Thanks for help i wouldn't note this without you thanks

Sir Rufo 31. Okt 2014 14:42

AW: Delphi Forms
 
Zitat:

Zitat von drama22 (Beitrag 1278234)
Zitat:

Zitat von Sir Rufo (Beitrag 1278229)
I would have expected that
Delphi-Quellcode:
embeddedwb.AssignEmptyDocument;
should do the job to stop.

yes but cant recreate it if i want to click the form again how do i recreate it after its assign to empty

Why "recreating"? :gruebel:

The problem before was
Delphi-Quellcode:
embeddedwb.Free;
, because it will free the
Delphi-Quellcode:
embeddedwb
instance. So get rid of that free and just
Delphi-Quellcode:
AssignEmptyDocument
.

Delphi-Quellcode:
procedure secondform.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  embeddedwb.AssignEmptyDocument;
  // I must not destroy my toys if I want to play again with
  // embeddedwb.Free;
end;

Dejan Vu 31. Okt 2014 15:28

AW: Delphi Forms
 
Why should we always use 'FreeAndNil' instead of 'Free'? :gruebel: ;-)


Alle Zeitangaben in WEZ +1. Es ist jetzt 07:43 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz