Reputation: 3097
In IOS, I implemented volume control for my app on lock screen. Same thing is needed in android also. I done it in IOS by setting the plist
<key>UIBackgroundModes</key>
<array>
<string>audio</string>
</array>
In controller
var player = Titanium.Media.createAudioPlayer({
url : "/alerts/door-bell.mp3",
allowBackground : true,
audioSessionMode : Ti.Media.AUDIO_SESSION_MODE_PLAYBACK
});
function start(e) {
player.play();
}
But for Android I can’t find any hint. For IOS I refereed the KitchenSink
app but in android that example was excluded. Means is that not possible?. But when I played default music player, upon locking the screen, music control was showing on notification bar menu. So I am assuming this is possible for my app also. If so how can I do this in Titanium or in Android it self.
Upvotes: 1
Views: 607
Reputation: 3866
For Android you need:
Also see the example on the above page, which has:
var audioPlayer = Ti.Media.createAudioPlayer({
url: 'www.example.com/podcast.mp3',
allowBackground: true
});
Upvotes: 0