0

I'm creating a live audio streaming app using titanium studio (version 3.1.1). I need to enable background audio playback for iphone. Currently background audio works in android emulator but not in iphone sinulator (when I click the home button, audio fades away and stop). I created the audioplayer and set the audioSessionMode.

Ti.App.player = Ti.Media.createAudioPlayer({
  url :'http://broadcast.infomaniak.net/radionova-high.mp3',
  allowBackground :true
});
Titanium.Media.audioSessionMode = Ti.Media.AUDIO_SESSION_MODE_PLAYBACK;

When I add and save the following lines to Info.plist file and run the project, the file reloads and remove these lines. How do I correctly edit this file? or is there another way to get background audio in iphone?

<key>UIBackgroundModes</key>
    <array>
<string>audio</string>
    </array>

1 Answers1

0

you basically add the section to your tiapp.xml.

here is a good blog post on the topic.

http://bencoding.com/2012/07/15/using-titanium-ios-specific-configurations/

Aaron Saunders
  • 33,180
  • 5
  • 60
  • 80
  • Thank you, the blog was helpful. I managed to add the code lines to the info.plist file. But still the background audio does not work on iphone sinulator. – user2346002 Jul 31 '13 at 19:57
  • http://stackoverflow.com/questions/12796157/audio-playing-in-background-not-working-in-ios-simulator – Wahhab_mirza Jul 31 '13 at 23:09
  • Background audio is not supported in iOS Simulator afaik.You should try it in device Thanks – Wahhab_mirza Jul 31 '13 at 23:09