Can't use updateOption() inside an actionManger

Hello,

I’d like to play a sound in a loop, then stop the loop with an OnIntersectionTrigger.
It works if I do “music.updateOption({ loop : false });” outside the action manager but it doesn’t work inside.

Here is a playground of my problem : https://www.babylonjs-playground.com/#19IQKJ#3

Thanks a lot for your help,

In fact it does not work even if you do it outside the action manager. In your PG, it works only because the sound is not started yet when you call updateOptions().

Here’s a PR that will correct the problem when merged:

Oh! this is weird :slight_smile:

Sorry, didn’t see your PR. I can close mine, but we should address the other parameters that can be updated (like offset and length)

1 Like

Nice!

No, I closed mine as yours is better.

Thank you so much both of you for fixed it, it’ll help me a lot for the interactive music video i’m trying to make.
I see that the PR is now merged. Do I have to wait for the script https://preview.babylonjs.com/babylon.js to update or do I to make something else ?

It does work for me: make sure the cache of your browser is cleaned.

The sound still play in a loop in the playground and in my project, I cleaned the cache and tried on Firefox and Chrome. I’d like that it’s finish its current play then stop. Sorry, I think I’m still missing something !..

Ah, indeed, I was sure it stopped when I tested earlier…

So the playground may not be updated yet, try later / tomorrow.

Everything works perfect now ! Thanks again.

1 Like