+1 vote

Well I need to get the length of audio resource (.ogg), I've searched the doc but well.. no luck.. class AudioStreamOGGVorbis, AudioStream dont have length variable. So, how do you get the length of Audio Resource in Godot 3?

in Engine by (81 points)
edited by

2 Answers

+1 vote

If you have set the AudioStream resource to a StreamPlayer (which I assume you will be doing if it's being used as music), then you can use StreamPlayer.get_length() to get the length of the audio in seconds.

by (512 points)

StreamPlayer? You mean the one with Godot 2.X? Sorry, In this question I use Godot 3 (Let me edit the question). Have you tried Godot 3 yet? If you have, please tell me how to get the Audio Length.

And I checked the Godot 3 doc, the AudioStreamPlayer class in Godot3 dont have get_length method.

+1 vote
by (109 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.