Start a new topic
Solved

Sound never stops

i have this in CreateOverlay Function

this.walkSound = new AR.Sound("assets/dinosaur-two-footseps.mp3",

   {

    onError: function(){alert("error loading sound");}

   });


I start the sound after a model loads and run the sound and a model animation

this.walkAnimation.start(-1);


in the onFinish event of the model animation I have this. 

this.walkSound.stop();


The sound never stops. 

I have verified that the code reaches all lines above and they execute. The SDK won't stop the sound


Help


Hi, Thanks for your help. It turns out I was referencing the object incorrectly. You logging suggestions were really helpful. Thanks so much


Wilson

Hi Wilson,


I tried to use sound.stop() in onFinish of the PropertyAnimation and it worked without any issues.

Do you get any javaScript errors in the console? (on Android you get JS errors in logcat, on iOS you can remote debug with safari)

If you do not get any errors please send me an AR-world containing the minimum code/assets to reproduce your issue.


Best Regards,

Alex

Sorry I made a mistake in the code I sent. I am starting a property animation with the method start(). The onFinished event of the property animation is called because I use it to stop a model animation. Thats where I also call the stop  method of the AR.Sound object. But the sound continues. If I start the sound with a -1 is never stops. If I start the sound with a 5, it plays 5 times, even though the onFinished event fires. I have tried this numerous ways and the sound never responds to the stop method

I am not using the onFinish event. I am using the stop() method on the AR.Sound object. The sound does not stop whether I sue start(-1) or start (4)

Hi Wilson,


if you use start(-1) it will cause infinite looping of the animation. This means that onFinish of the animation will never be triggered which will then not stop the sound. 


Best Regards,

Alex

Login or Signup to post a comment