Titanium.Media.Sound.stop() does not stop looping sounds.
Title says it all. When you create a sound and set the looping property to true the stop() method won't actually stop the sound. It continues to loop!
See example below:
// Create a looping sound and play it
var sound = Titanium.Media.createSound("app://test_sound.mp3");
sound.setLooping(true);
sound.play();
// After 5 seconds, stop the sound, except that it doesn't :(
window.setTimeout(function () {
sound.stop();
}, 5000);
2 Answers
-
sound.setLooping(false);
sound.stop();
will stop it.
-
can man control the loop for 5 times like example ?