var mp3_array = new Array('music1.mp3', 'music2.mp3', 'music3.mp3', 'music4.mp3', 'music5.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();
Ti.API.info(index);
}
btn.addEventListener('click', function(e) {
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!');
}
});
playSound(current_index);
});
이런식으로 사운드 파일을 여러개 배열에 집어넣고,
재생을 시키는데,
재생을 하면 한개의 파일(music1.mp3)이 여러번 재생이 됩니다.
5개의 파일을 재생을 한거번에 시키고 싶은데
도움 부탁드립니다.
버젼은 3.2버젼 입니다.