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: 438
Reputation: 6,869

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: 438
Reputation: 6,869

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
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

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
30
S
11
G
8
Posts: 313
Reputation: 7,360

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
359
S
214
G
72
Posts: 22,952
Reputation: 178,580


Return to How do I....?

Who is online

Users browsing this forum: DiabloOvermind, emoticon, MrWhizm, Skebab and 16 guests