I.T. Discussion Community!
-Collapse +Expand
Delphi
Search Delphi Group:

Advanced
-Collapse +Expand Delphi To/From
To/FromCODEGuides
-Collapse +Expand Delphi Store
PRESTWOODSTORE

Prestwood eMagazine

June Edition
Subscribe now! It's Free!
Enter your email:

   ► MB LobbyPascal and Delphi Coding BoardDelphi Object PASCAL Topic   Print This     

waiting for video to complete

waiting for video to complete in Delphi Object PASCAL topic (part of our Pascal and Delphi Coding group).

Quick Search: waiting   complete   waiting video   waiting video complete  
Matt Verratti
 (Inactive)
Libertyville, IL
In my program, when the form first loads, I have a procedure that plays a video file. I want to wait until the file is done playing, then bring up another form. Currently my onActivate procedure looks like this:

begin
mediaplayer1.play;
********************************
form1.visible := False;
form2.visible := True;
end;

The line of (*) is where I think I need to put some kind of a wait command. I have explored the delphi help topics on "mediaplayer.wait", and the "waitfor" command with no luck.

Any ideas? Thanks in advance!
 Posted 18 years ago (Thread Starter)
Comment Quote
About Matt Verratti -Collapse +Expand
Visit Profile
Inactive member.
Member does not subscribe to this thread.
Email Not Verified!
Once email is verified, we will review and approve the account.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html, social networking links, message board signature, company profile, etc.

Post ID #7501, 7 replies
Thread Started 9/11/2002 11:44:00 AM
View Counter=2602
Last Reply Posted 9/13/2002 4:00:00 PM)
Location=Libertyville, IL  
Joined=18 years ago   MB Posts=12  
Angel
 (Inactive)
England
I would assume the error occurs because while the form is still in the activation process you are trying to set it to visible := False when it still has control focused on it (i.e the mediaplayer).

Try removing the form1.visible := false and in form2's onactivate, setting form1.visible := false;
 Posted 18 years ago
Comment Quote
About Angel -Collapse +Expand
Visit Profile
Inactive member.
Member does not subscribe to this thread.
Email Not Verified!
Once email is verified, we will review and approve the account.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html, social networking links, message board signature, company profile, etc.

Post ID #7509 (Level 1.1)  Reply to 7501
Thread Started 9/12/2002 3:30:00 AM
View Counter=2
Location=England  
Joined=19 years ago   MB Posts=199  
Angel
 (Inactive)
England
Ok, brainstorming now for ideas. What about using a timer. Disable it in the design and set it to wait about a ciuple of seconds. Then when you activate your first form and the video is to start playing, enable the timer. It will then start and wait two seconds. In the timers on timer event, disable the timer so that it doesnt try to run the procedure agina in another couple of seconds and then add your code. This will give your forms time to initialise.

Another idea, instead of using two forms, why not use two panels on one form which are both aligned to alClient so that they fill the entire screen. You can then design two different forms on the same form. Just right click on the panels and use send to back to filck between the two in the design stage.

If these ideas arent practical then just post again. Im sure theres an easy way of doing this.
 Posted 18 years ago
Comment Quote
About Angel -Collapse +Expand
Visit Profile
Inactive member.
Member does not subscribe to this thread.
Email Not Verified!
Once email is verified, we will review and approve the account.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html, social networking links, message board signature, company profile, etc.

Post ID #7536 (Level 1.2)  Reply to 7501
Reply Posted 9/13/2002 2:36:00 AM
Location=England  
Joined=19 years ago   MB Posts=199  
Matt Verratti
 (Inactive)
Libertyville, IL
Ok I have been studying the mediaplayer "wait" command.... I have my onActivate procedure set up like this:

player1.wait := True;
player1.play;
player1.close;
Form1.visible := False;
Form2.visible := True;

When I run this, I get an error message after the video is done playing. The error message is:

Project1.exe raised exception class EInvalidOperation with message 'Cannot change Visible in OnShow or OnHide.' Process stopped.

So that leads me to believe that the "player1.wait" command is working right... Does Delphi not allow me to change the visibility of forms in an onActivate command? How do I get around this to change the form visibility after the video is done playing?
 Posted 18 years ago (Thread Starter)
Comment Quote
About Matt Verratti -Collapse +Expand
Visit Profile
Inactive member.
Member does not subscribe to this thread.
Email Not Verified!
Once email is verified, we will review and approve the account.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html, social networking links, message board signature, company profile, etc.

Post ID #7505 (Level 1.3)  Reply to 7501
Reply Posted 9/11/2002 12:17:00 PM
Location=Libertyville, IL  
Joined=18 years ago   MB Posts=12  
Matt Verratti
 (Inactive)
Libertyville, IL
No luck, Angel. It seems as if I have to move both of my form#.visible statements out of the onActivate procedure. Now I just need to figure out what will trigger the form switch.... I have been looking into the help topics about setting a trigger on the completion of a specific thread, but I am still not getting it.

So when my onActivate procedure finishes running my little video, what can I use as a trigger outside of the onActivate procedure to switch the visibility on my forms?
 Posted 18 years ago (Thread Starter)
Comment Quote
About Matt Verratti -Collapse +Expand
Visit Profile
Inactive member.
Member does not subscribe to this thread.
Email Not Verified!
Once email is verified, we will review and approve the account.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html, social networking links, message board signature, company profile, etc.

Post ID #7523 (Level 1.4)  Reply to 7501
Reply Posted 9/12/2002 9:48:00 AM
Location=Libertyville, IL  
Joined=18 years ago   MB Posts=12  
Matt Verratti
 (Inactive)
Libertyville, IL
Thanks Angel and Scott. I think I am going to go with Scott's method.... I tried it out and it seems to work the way I want it to. I'm so glad there is a forum like this , otherwise I don't know where I would be! Thanks again!
 Posted 18 years ago (Thread Starter)
Comment Quote
About Matt Verratti -Collapse +Expand
Visit Profile
Inactive member.
Member does not subscribe to this thread.
Email Not Verified!
Once email is verified, we will review and approve the account.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html, social networking links, message board signature, company profile, etc.

Post ID #7543 (Level 1.5)  Reply to 7501
Reply Posted 9/13/2002 12:57:00 PM
Location=Libertyville, IL  
Joined=18 years ago   MB Posts=12  
Scott Wehrly
Prestwood IT
 (Inactive)
Las Vegas, NV USA
Okay, I had a brain drizzle here...



Since you are doing this when the form first loads, why not treat the video like a splash screen?



I struggled with the old "onActivate" behavior when I tried my first splash screen until I figured out that it could be done in the DPR code.



So, your video form would be loaded and run like this...

begin
Application.Initialize;
form1 := Tform1.Create(Application);
form1.mediaplayer1.Wait;
form1.Show;
form1.mediaplayer1.Play;
Application.CreateForm(Tform2, form2);
form1.mediaplayer1.Close;
form1.Free;
Application.Run;
end;


This is assuming that mediaplayer1 is on form1, and that form2 is your main user interface. Since you're executing this in the application's "main" routine, it occurs at initialization only, and your form2 won't be displayed until the call to Application.Run.
 Posted 18 years ago
Comment Quote
About Scott Wehrly -Collapse +Expand
Visit Profile
Inactive member.
Member does not subscribe to this thread.
Old Account!
If this is your account, sign in to activate web presence data (sign in quarterly to keep active). Alternatively, you can subscribe to our monthly eMag with a valid email address.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html, social networking links, message board signature, company profile, etc.

Post ID #7538 (Level 1.6)  Reply to 7501
Reply Posted 9/13/2002 7:24:00 AM
Location=Las Vegas, NV USA 
Joined=18 years ago   MB Posts=442   KB Posts=19  
Most Recent Post
Scott Wehrly
Prestwood IT
 (Inactive)
Las Vegas, NV USA
Our pleasure, Matt!

----------------------------------
put a nickel in your pickle and a dime in your lime.
 Posted 18 years ago
Comment Quote
About Scott Wehrly -Collapse +Expand
Visit Profile
Inactive member.
Member does not subscribe to this thread.
Old Account!
If this is your account, sign in to activate web presence data (sign in quarterly to keep active). Alternatively, you can subscribe to our monthly eMag with a valid email address.
Web Presence Hidden.
Once above is taken care of, full Profile content will display including back links, about me, my message, custom Profile html, social networking links, message board signature, company profile, etc.

Post ID #7547 (Level 1.7)  Reply to 7501
Reply Posted 9/13/2002 4:00:00 PM
Location=Las Vegas, NV USA 
Joined=18 years ago   MB Posts=442   KB Posts=19  

Revive Thread!

Add a comment to revive this old thread and make this archived thread more useful.

Write a Comment...
Full Editor
...
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.


Anonymous Post (text-only, no HTML):

Enter your name and security key.

Your Name:
Security key = P156A1
Enter key:
Icon: A Post    Thread    Idea    Important!    Cool    Sad    No    Yes    Includes a Link...   
Thread #7501 Counter
2602
Since 4/2/2008

Follow PrestwoodBoards on: 


©1995-2020 PrestwoodBoards  [Security & Privacy]
Professional IT Services: Coding | Websites | Computer Tech