Closed CloverFeywilde closed 7 years ago
You can use var time = sounds['src'].soundNode.context.currentTime
to get elapsed time after sounds['src']
was created. To calculate current playing time you can store the currentTime
once sound is played, and time - stored
is what you want.
I just realized that sound.js has already record o.startTime = actx.currentTime;
when calling play
function, so you can simply use sounds['src'].soundNode.context.currentTime - sounds['src'].startTime
instead :)
Thanks so much! This worked like a charm.
I'm making a psudo rhythm game using Pixi.JS right now, and needed a lightweight sound solution! This looks perfect, but is there any way, while a song is playing, for me to get the current time returned to me? That way I can sync game events to specific points in the song.