[TIMOB-20093] Android Audio Player - playing in the background
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | n/a |
Status | Open |
Resolution | Unresolved |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Android |
Labels | n/a |
Reporter | Shawn Lan |
Assignee | Unknown |
Created | 2015-08-26T23:51:47.000+0000 |
Updated | 2017-09-21T21:17:13.000+0000 |
Description
If allowBackground set to true, the audio player should be started as a foreground service. See [here](http://developer.android.com/guide/topics/media/mediaplayer.html#mpandservices)
The benefits are:
1. The audio player keeps playing even after the app exits.
2. The system won't accidentally purge the audio player out of memory.
Please implement the audio player based on the entire section "Using a Service with MediaPlayer" from the docs above. It suggests not only foreground service, but also several tips for a good background audio player. Thanks.
Hello, Tested this issue.Android Audio Player is playing as expected in background. *Test Environments:* Appc CLI Version :5.0.1 Titanium SDK Version5.0.0.GA Device:Nexus 7,5.1.1 Appc Studio: Appcelerator Studio, build: 4.3.0.201509151348 Alloy: 1.7.6 Mac OS X,Version = 10.10.1. *Test Steps*: * Create a classic project * Paste sample code to resource directory * Run project * Press *home* in device and check Android Audio Player playing or not in the background. *Test code:* *app.js*
*Test Result:* Audio Player is working as expected in the background. *Ti logs:*
Thanks
Yes the audio player can play in the background, but it's not as a "foreground service." Please see the Android documentation included in the description. This is not a fix request. This is an improvement request.
Using a Service with the AudioPlayer is very useful to avoid stop the background audio playback when the Activity gets killed by Android. Please consider support that functionality on the AudioPlayer, I'm using SDK 6.2.2 on my app and every time the Activity of my app is killed the audio playback stops. Thank you!