Audio.Length

Get help using Construct 2

Post » Mon Jul 02, 2012 9:51 pm

Hi there, is there any expression that determines the length in seconds of a sound file?
I was going to use On Sound Ends events, but Ive became aware that in some systems the sounds dont play, thus the events will not play too.
B
38
S
8
G
3
Posts: 439
Reputation: 6,876

Post » Tue Jul 03, 2012 9:46 pm

I belive there is none.
You can use ffmpeg javascript port yet i cant help you with it.
B
18
S
3
G
4
Posts: 46
Reputation: 3,873

Post » Wed Jul 04, 2012 5:06 pm

Thank you for your answer @Goury
@Ashley - Could you implement audio.length as a system expression in the future?
For example, instead of using
On sound ends -> do something
which is dependent on the sound actually playing to do the actions, there could be
Event -> Play Sound
        Wait Sound.lenght seconds
        Do something


B
38
S
8
G
3
Posts: 439
Reputation: 6,876

Post » Wed Jul 04, 2012 6:49 pm

The problem with things like this is that there is a good chance browsers won't support this.
B
92
S
31
G
24
Posts: 3,191
Reputation: 32,669

Post » Wed Jul 04, 2012 10:22 pm

it can be workaround just for C2 gui which be replaced by actual constants on export
B
18
S
3
G
4
Posts: 46
Reputation: 3,873

Post » Thu Nov 15, 2012 6:55 am

Yes this would be a very Handy Expression...What are our chances?
When in doubt..or you are lost in a Zombie apocalypse or someone is giving you a hard time..Remember one thing..... Read the Construct 2 Manual..it will save your life.:)
B
34
S
13
G
8
Posts: 317
Reputation: 7,668

Post » Thu Nov 15, 2012 5:33 pm

It's not supported on all platforms, so even if it was added you couldn't really rely on it. I've got some upgrades to the Audio object planned and I'll see if I can add it then.
Scirra Founder
B
383
S
225
G
86
Posts: 24,121
Reputation: 190,565


Return to How do I....?

Who is online

Users browsing this forum: 13spongg13, DolyGamesCosmos, Hiddendanger, Kenthria and 9 guests