Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

createSound stopping code execution

I have a problem with the creation of a Sound. If I turn on the preload option the UI is blocked and the code after Titanium.Media.createSound is not executed until the file is preloaded.

Do I do something wrong or is this a Bug? I don't have this problem if I'm downloading a file. Only when I stream it.


sound = Titanium.Media.createSound({
        url:url,,
        preload:true,
        looping:false
    });


   alert('Test');

    sound.addEventListener('error', function(){
        createError('Server not available');
    });

    sound.play();

Here the alert is called when the file is ready to play. What I want is, that the alert is called immediately after createSound is called.

— asked May 17th 2010 by Robert Ölei
  • createsound
0 Comments

1 Answer

  • add a complete event to the sound, and inside put the alert.

    
        sound.addEventListener('complete', function(){
             alert('Test');
        });
    
    — answered May 20th 2010 by Dan Tamas
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.