Grimmy
April 13, 2023, 12:00pm
1
Hi, I am trying to pause/resume and audio track but when I resume the audio track it resumes from the wrong position. It is as if the pause didn’t actually pause it, but just turned the volume down.
Any ideas?
Code:
this.entity.sound.pause("Slot 1");
and later I do…
this.entity.sound.resume("Slot 1");
Additionally, when I try to manually force the current audio time using something like:
this.entity.sound.currentTime = 30.0;
…does nothing.
Confirmed it is a bug: Unpausing a sound that is paused does not resume at the time it is paused · Issue #5240 · playcanvas/engine · GitHub
Grimmy:
Additionally, when I try to manually force the current audio time using something like:
this.entity.sound.currentTime = 30.0;
…does nothing.
The sound component doesn’t have a currentTime
property: https://developer.playcanvas.com/en/api/pc.SoundComponent.html
The Sound Slots do though: https://developer.playcanvas.com/en/api/pc.SoundSlot.html
1 Like
Grimmy
April 13, 2023, 2:22pm
3
Great. Good to know I wasnt going crazy.
Regarding the Soundslot.currentTime. How exactly do I set this? What is the correct syntax? It doesnt really say in the help document.
Something like:
this.entity.sound.slot("Slot 1").currentTime= 30.0;
?
LeXXik
April 13, 2023, 2:57pm
4
SoundSlot doesn’t have currentTime
property. Sound Instance does.
Oh, my bad. I got confused by startTime
on the sound slot
If you desperately need it now, I’ve created a patch that can be added to a project: https://playcanvas.com/project/1062026/overview/f-pause-sound
sound-resume-patch.js
. Make sure that Loading Type is After Engine
1 Like
This has been fixed in engine release 1.62.1 that is now in the Editor
1 Like