Media.playsound error

when media.playsound is called in the app, then it take some time to load the file due to which app pause for a millisecond. what could be the solution for this problem?

Due to this i tried to use audio.play in my app, but that cause lag in the app to play the particular sound.

So, tell me the best solution to overcome with this problem?

Hi @puneetpositive,

For best results, you need to pre-load audio files in almost every instance, i.e. during some point in the app/game where the flow will not be so noticeably impacted.

For the “media” library methods, this would be done using “newEventSound()”:

http://docs.coronalabs.com/api/library/media/newEventSound.html

For the “audio” library methods, this would be done using “loadSound()”:

http://docs.coronalabs.com/api/library/audio/loadSound.html

Brent

Hi @puneetpositive,

For best results, you need to pre-load audio files in almost every instance, i.e. during some point in the app/game where the flow will not be so noticeably impacted.

For the “media” library methods, this would be done using “newEventSound()”:

http://docs.coronalabs.com/api/library/media/newEventSound.html

For the “audio” library methods, this would be done using “loadSound()”:

http://docs.coronalabs.com/api/library/audio/loadSound.html

Brent