Hi
I am using Ti.Media.sound to run different sounds in background and they are working and playing one
by one.Now i want to make change of enabling the forward and backward button in native player which
runs in background could i achieve something of this sort.Here is my code so far
var mp3_array = []; mp3_array.push('sound1.mp3'); mp3_array.push('sound2.mp3'); mp3_array.push('sound3.mp3'); mp3_array.push('sound4.mp3'); mp3_array.push('sound5.mp3'); Titanium.Media.audioSessionMode = Titanium.Media.AUDIO_SESSION_MODE_AMBIENT; var sound = Titanium.Media.createSound(); var current_index 0; function playSound(index){ sound.url = mp3_array[index]; sound.play(); } sound.addEventListener('complete',function(){ // increment the array index current_index++; if(current_index < mp3_array.length){ // play the next mp3 in the array playSound(current_index); } else { Ti.API.info('all sounds complete!'); } }); // play the first mp3 in the array @ index 0 playSound(current_index);
Thanks