-
-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
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
Missing a way to set the start time of sound components #5364
Comments
It would be nice for the built-in sound component to expose a For example: const soundComponent = this.el.components['sound'];
const audio = soundComponent.pool.children[0]; // THREE.Audio
audio.setLoopStart(/* start time in seconds */);
audio.setLoopEnd(audio.buffer.duration) It can be a bit tricky when to execute this, as it needs to take place after the sound component has initialized (and the sound loaded, for the duration), but before playing the audio (otherwise the |
Indeed, that's usefull info. Thank you |
… before the sound was loaded will be called when loaded and not ignored anymore.
Wrote a fix and commited it. If it is accepted here should be the solution to my issue : |
…) and loopEnd()
…the sound if a loop start was specified without an end
…ed + mustPlay (#5365) * #5364 Bugfix : The processSound callback given to playSound() before the sound was loaded will be called when loaded and not ignored anymore. * #5364 : Sound : Added API for reaching THREE.Audio.loopStart() and loopEnd() * #5364 : Sound : Automatically set the loop end to the end of the sound if a loop start was specified without an end * #5364 : Sound : Code review changes applied.
Fixed by #5365 |
Hi, well first thing, it's not a bug but a missing feature.
I wish to have a way to play a sound entirely at first loop and then rewind at some specific start loop value different than zero.
So far i had the following code :
this.el.removeAttribute('sound')
this.el.setAttribute('sound', 'src', 'assets/some.mp3');
this.el.components.sound.playSound()
this.el.addEventListener('sound-ended', () => {
// Missing here a way to set the next playSound start value
this.el.components.sound.playSound()
});
And that is sad because i could totally do it with a regular audio html element that lacks positionnal audio and pool.
Currently my best shot is to split my file into two mp3: one for the intro and another for the looping part.
The text was updated successfully, but these errors were encountered: