Wait till video is finished?

Find quick help here to get you started with Hollywood
Post Reply
Jan
Posts: 26
Joined: Sun Sep 17, 2017 10:28 am
Location: Slovakia
Contact:

Wait till video is finished?

Post by Jan »

Another newbie question, please.

I've downloaded AVCodec video so I can use PlayVideo() in my script. However if it's the last command, the script finishes and video closes after 1-2 seconds. How can I tell Hollywood to wait till the video is finished? I don't want to use WaitLeftMouse command.

One more thing, please. How can I compile a complete standalone executable so it includes the codec and the video too?

Thank you in advance.
Jan
Posts: 26
Joined: Sun Sep 17, 2017 10:28 am
Location: Slovakia
Contact:

Re: Wait till video is finished?

Post by Jan »

I think I figured it out. It works but can anyone confirm it's the right method?

playing = IsVideoPlaying(1)

While playing = True
playing = IsVideoPlaying(1)
Wend

End
Bugala
Posts: 1178
Joined: Sun Feb 14, 2010 7:11 pm

Re: Wait till video is finished?

Post by Bugala »

Havent played with videos, but at least your idea seems right.

Regarding adding plugins to exe, you just need to link them to your exe.

Dont recall it from memory, but i think it is putting at beginning of your code something like this:

Code: Select all

@INCLUDE "pluginname.plg"
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Wait till video is finished?

Post by airsoftsoftwair »

@Bugala:
@INCLUDE is used for scripts, not for plugins.

@Jan:
You can do it like this:

Code: Select all

@REQUIRE "avcodec", {Link = True}
@VIDEO 1, "test.mpg"

PlayVideo(1)
playing = IsVideoPlaying(1)

While playing = True
    playing = IsVideoPlaying(1)
    VWait
Wend
Note that I have added a VWait() here. Otherwise your loop will be polling the video state as many times as the CPU allows, which is very bad. There should be some throttle to prevent wasting CPU cycles. VWait() is a convenient solution, you could of course also use a timer.
Jan
Posts: 26
Joined: Sun Sep 17, 2017 10:28 am
Location: Slovakia
Contact:

Re: Wait till video is finished?

Post by Jan »

Thank you for your replies and advices. I did not think about the CPU cycles. Great forum!
Post Reply