Titanium.Media.AudioPlayer "No audio data found."
Hi,
I am trying to make a very simple test app that plays a sound very quickly and I am getting a strange error. For some reason it says "No audio data found." when the sound is triggered. Here are my settings:
var tone = Titanium.Media.createAudioPlayer({
audioSessionMode:Titanium.Media.AUDIO_SESSION_MODE_PLAYBACK,
preload:true,
url:'beep-1.wav'
});
function runSound(){
bars.backgroundImage = '';
bars.backgroundColor = '#000';
tone.start();
setTimeout(function(){
bars.backgroundImage = 'test.jpg';
tone.stop();
}, 33.33);
}
The docs don't really give many examples and have been diffucult to use. If anyone knows what I'm doing wrong that would be excellent. I also tried use the more basic .Sound optoin, but the audio didn't play fast enough. I only need it for 33.33 milliseconds…which is really, really fast.
1 Answer
-
Try using the sound object instead of the audioPlayer object. it might suit your needs better.
The audioPlayer is better suited to streaming remote audio urls, rather than short local sounds.
http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.Media.Sound-object
hth,
kosso