We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
import openfl.events.Event; import openfl.display.Sprite; class Main extends Sprite { public function new() { super(); var sound = openfl.Assets.getMusic("assets/mode.ogg"); trace(sound.length); var channel = sound.play(); addEventListener(Event.ENTER_FRAME, function(_) trace(channel.position)); } }
Sound used for testing: mode.ogg OpenFL 4.2.0, Lime 3.2.1
On Neko, sound.length traces 8698 like expected. However, the sound position is in seconds instead of milliseconds:
sound.length
Main.hx:11: 0 Main.hx:11: 0.02 Main.hx:11: 0.02 Main.hx:11: 0.02 Main.hx:11: 0.04 Main.hx:11: 0.06 Main.hx:11: 0.081 Main.hx:11: 0.101 Main.hx:11: 0.121 Main.hx:11: 0.121 [...]
The correct unit (ms) is reported on Flash, HTML5 and OpenFL legacy.
Now, this would be easy to work around in Flixel (just multiply by 1000 if !openfl_legacy) if it wasn't for the following issue:
if !openfl_legacy
If you set a startTime in sound.play() (for instance sound.play(500);), channel.position gets stuck at that:
startTime
sound.play()
sound.play(500);
channel.position
Main.hx:11: 500 Main.hx:11: 500 Main.hx:11: 500 Main.hx:11: 500 Main.hx:11: 500 Main.hx:11: 500 Main.hx:11: 500 Main.hx:11: 500 Main.hx:11: 500 Main.hx:11: 500 Main.hx:11: 500 Main.hx:11: 500 Main.hx:11: 500 Main.hx:11: 500
So it sometimes reports seconds, sometimes milliseconds.
The text was updated successfully, but these errors were encountered:
a35cd54
Thanks for the quick fix, appears to work as expected now! :)
Sorry, something went wrong.
No branches or pull requests
Sound used for testing: mode.ogg
OpenFL 4.2.0, Lime 3.2.1
On Neko,
sound.length
traces 8698 like expected. However, the sound position is in seconds instead of milliseconds:The correct unit (ms) is reported on Flash, HTML5 and OpenFL legacy.
Now, this would be easy to work around in Flixel (just multiply by 1000
if !openfl_legacy
) if it wasn't for the following issue:If you set a
startTime
insound.play()
(for instancesound.play(500);
),channel.position
gets stuck at that:So it sometimes reports seconds, sometimes milliseconds.
The text was updated successfully, but these errors were encountered: