Fix AudioStreamPlayer2D/3D's get_playback_position returning 0 right after calling seek

This commit is contained in:
Micky 2024-11-27 16:02:46 +01:00
parent bbc54692c0
commit 99cbcd250a
2 changed files with 6 additions and 0 deletions

View File

@ -253,6 +253,9 @@ bool AudioStreamPlayer2D::is_playing() const {
}
float AudioStreamPlayer2D::get_playback_position() {
if (setplay.get() >= 0) {
return setplay.get(); // play() has been called this frame, but no playback exists just yet.
}
return internal->get_playback_position();
}

View File

@ -582,6 +582,9 @@ bool AudioStreamPlayer3D::is_playing() const {
}
float AudioStreamPlayer3D::get_playback_position() {
if (setplay.get() >= 0) {
return setplay.get(); // play() has been called this frame, but no playback exists just yet.
}
return internal->get_playback_position();
}