This command stops iPod music, while it shouldn't.
Ti.Media.audioSessionCategory = Ti.Media.AUDIO_SESSION_CATEGORY_AMBIENT;
Someone found a workaround for this, see [this link](
https://community.appcelerator.com/topic/2819/ios-app-stops-device-audio-at-startup-music-app-pandora-etc/2)
Summarized:
>>I ended up solving this problem by editing TiApp.m on the SDK and adding the following code to didFinishLaunchingWithOptions:
NSError *setCategoryError = nil;
BOOL audioOk = [[AVAudioSession sharedInstance]
setCategory: AVAudioSessionCategoryAmbient
error: &setCategoryError];
Hello [~nsndvd], Could you please share a runnable test case with steps to reproduce and environment so that we can figure out this issue. Thanks.
Nope, because, unless there is a way to use the ipod player in the simulator, this can only be reproduced on real devices, and you would need provisioning profiles and stuff. So you can try this way: On any project you have ready to be deployed on an iOS device, in alloy.js add the line: Ti.Media.audioSessionCategory = Ti.Media.AUDIO_SESSION_CATEGORY_AMBIENT; Deploy, then launch music, and start the app (start, not resume). Music will stop.
[~nsndvd] please provide a test case, we can test on our devices
Please find at this [link](https://dl.dropboxusercontent.com/u/63904025/daddyhunt/test_case_audio_session_category_ambient.zip) a titanium alloy project that i just generated with studio. I only added the following line in alloy.js. Ti.Media.audioSessionCategory = Ti.Media.AUDIO_SESSION_CATEGORY_AMBIENT;" I'm also attaching the alloy.js file. You have to add an app id in tiapp.xml, I'm not giving you mine because you need a matching provisioning profile. I tested this on an iphone4 with iOS 7. Music from iPod is stopped when the app is started (not resumed). Thanks
PR Here: https://github.com/appcelerator/titanium_mobile/pull/7270 Approved and merged.
Verified as fixed, Tested demo code both with speaker / headphone output. App no longer pauses background music when launched. Tested on: iPhone 6s Plus Device (9.2) & iPhone 6 Plus Device (8.4) Mac OSX El Capitan 10.11 (15A284) Ti SDK: 5.2.0.v20160114021251 Appc NPM: 4.2.3-1 App CLI: 5.2.0-231 Xcode 7.2 Node v4.2.3 *Closing Ticket.*