Hi All,
I have been looking for ages now and cannot find a solution, anyone with an idea or a method would be doing me a massive favour.
I need to play a short audio mp3 file no longer than 30 seconds, what i need is to be able to mute/quieten any other audio/music while this is playing.
this needs to work in both Android and IOS i have tried
var file = Titanium.Filesystem.getFile(Titanium.Filesystem.resourcesDirectory, 'etc/' + filename); var sound = Titanium.Media.createSound({ url : file.nativePath }); sound.play();and
var file = Titanium.Filesystem.getFile(Titanium.Filesystem.resourcesDirectory, 'etc/' + filename); var audioPlayer = Ti.Media.createAudioPlayer({ url : file, allowBackground : true, autoplay:true }); audioPlayer.start(); audioPlayer.addEventListener('change', function(e) { Ti.API.info('State: ' + e.description + ' (' + e.state + ')'); if(e.state == audioPlayer.STATE_STOPPED) { audioPlayer.release(); } });But no of them do what i require, the first one plays the audio with the music in the background and the other sample dose not play anything at all.
Thanks for your help. Regards Luke