[
https://issues.apache.org/jira/browse/CB-12877?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16193768#comment-16193768
]
Guilherme Dellagustin commented on CB-12877:
After some research it became clear to me that this behavior happens because
Android will close the app when memory is low.
I think the only way to avoid it would be to encapsulate the audio player(s)
into a service.
This has its own problems though, as you would not be able to react to events
in your JS code when the app is closed but the service remains (i.e.: persist
data using js code when audio ended).
Aside from that, you would not have any means to control the audio when app is
gone, at least not with the existing plugins (in my case I use
cordova-plugin-music-controls, and the audio control goest through the JS code).
In other words, the only way I see that a cordova app could be a realiable
audio player in Android at the moment, is to a android specific customized
plugin that would delegate audio playing, control and eventual persistency to
native code.
> (Android) Audio stops playing randomly on background
>
>
> Key: CB-12877
> URL: https://issues.apache.org/jira/browse/CB-12877
> Project: Apache Cordova
> Issue Type: Bug
> Components: cordova-plugin-media
>Affects Versions: 6.5.0
> Environment: android 6.0, tested on Motorola Moto X 2d gen
> http://www.gsmarena.com/motorola_moto_x_(2nd_gen)-6649.php
>Reporter: Guilherme Dellagustin
>Priority: Minor
>
> When audio is playing on background, it does not prevent the application from
> eventually being closed by the OS.
> When this happens, I do not get any pop up like "unfortunally ... stoped
> responding".
> I have some native apps that play audio on the background, where I never
> observed this behavior.
> I have in the config file, and
> the following plugins
>
>
>
>
>
>
>
>
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
-
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org