Search code examples
android-mediaplayerappceleratorandroid-6.0-marshmallowappcelerator-titanium

Ti.Media.createSound not working in Android 6.0 when streaming file from server


I am using appcelerator sdk 5.1.2 and trying to build for Android 6.0. Ti.Media.createSound not able to stream mp3 file hosted on server. I am trying to play an mp3 file which is hosted on server but nothing happens i.e file not play. Here is my simple code.

var sound = Ti.Media.createSound({
   url : 'url to mp3 file on server',
   allowBackground : true
});
sound.play();

Nothing showed up in console. Same code working absolutely fine when build for Android 5.1.0 but not works for Android 6.0. Anyone knows what the problem is.


Solution

  • There is some problem in streaming of mp3 or audio files in titanium for marshmallow. I faced the same problem. You can either try to provide storage permission for your app or try to compile with the 5.4.0 SDK as they are saying that it is fixed in this SDK

    TIMOB-20140 TIMOB-20234

    Hope this will help you.