Mobile Titanium 3.1.2 Android SDK 2.3.3 Device Samsung Galaxy Player Mac OS X
I have a instance of titanium sound that plays back find in ios, but in titanium only one or two different times appear with sound.time... which make the slider move erratically or not at all.... Here is my code:
var sound; playPause.addEventListener('click', function(e) { if(sound && sound.playing) { sound.pause(); playPause.backgroundImage = "/images/buttons/button_playPause_up.png"; } //else if(sound.paused){ //sound.resume(); //} else{ sound = Titanium.Media.createSound({url:"http://108.166.87.132/newapi/" + row.audio}); sound.play(); playPause.backgroundImage = "/images/buttons/button_playPause_down.png"; if(OS_IOS){ slider.max = sound.duration*1000; } if(OS_ANDROID){ //slider.setMax(sound.getDuration()); slider.max = sound.duration; Ti.API.info('slider max: ' + slider.max); Ti.API.info('sound duration: ' + sound.getDuration()); } sound.addEventListener('complete', function(){ playPause.backgroundImage = "/images/buttons/button_playPause_up.png"; slider.value = 0; }); var i = setInterval(function(){ if (sound.isPlaying()){ Ti.API.info('time ' + sound.time); slider.value = sound.time; Ti.API.info('slider.value: ' + slider.value); } },500); } });In ios, each interval shows a new sound.time value. In android, the first several intervals are 0, and then the next several are the same value, and then it usually stops before the max. The slider.max and sound.duration values do match. What am I missing??