Unable to play audio file from file system in android

You must Login before you can answer or comment on any questions.

I have to save blob response from a web service to titanium's file system and then play. So that I can use this feature even if I do not have internet connection in my device. This is working fine in iPhone but it's not working in android simulator as well as android device.

This is how I am creating sound. var sound = Titanium.Media.createSound();

then saving it in file system as var file = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory, id + '.mp3');

This is how I am saving the response from web service, and setting it as the URL property of sound.

file.write(this.responseData); var media = file.nativePath;
sound.url = media; sound.play();

1 Answer

please don't store file in application data directory .just use externalstoragedirectory

Your Answer

Think you can help? Login to answer this question!