[ 
https://issues.apache.org/jira/browse/CB-12714?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16097424#comment-16097424
 ] 

Filip Maj edited comment on CB-12714 at 7/22/17 9:58 PM:
---------------------------------------------------------

I did a bit of testing with the demo code you shared, [~shazron], to see about 
background audio support on Android.

First, the AmplitudeJS demo site works fine and plays in the background just 
great on Chrome for Android 59 on a Google Pixel running Android 7.1.0 and 
7.1.2 (tested on both).

I also then tweaked the demo code and put it into a cordova-compatible form. 
It's available on my repo here: https://github.com/filmaj/cordova-amplitudejs

This cordova app form of the amplitudejs demo works great on the browser 
platform (as expected) as well background audio worked great on Android 7.1.0 
and 7.1.2 (Google Pixel once more) using cordova-android 6.2.2 - opened the app 
up, hit the play button, then hit the home button, and things continued to play 
as expected.

I think that makes this pretty promising!

To [[email protected]]'s point, worth noting that if you run this in 
Chrome for Android and run in the background, you _will_ get a "sticky" 
notification in the notification bar showing you that something is playing (and 
giving you the control to pause what's currently playing). _However_, in the 
cordova-android-wrapped version of the app, this notification was not there. 
FYI.

I will do a bit more testing on emulators with earlier versions of Android to 
see where support for built-in JS {{Audio}} object (which is what AmplitudeJS 
uses) starts to fall apart.

EDIT: did a bit of testing on this across different Android versions (updated 
the README in [my test app repo|https://github.com/filmaj/cordova-amplitudejs] 
with details). Seems like playing audio via the <audio> tag / Audio API works 
fine in both Browser and cordova app shell on Android all the way down to 
Android 5. At Android 4.4, inside the cordova app, I see this error:

{noformat}
E/        ( 1143): Failed to open file 
'/android_asset/www/FirstSnow-Emancipator.mp3'. (No such file or directory)
{noformat}

The file is most definitely there.


was (Author: filmaj):
I did a bit of testing with the demo code you shared, [~shazron], to see about 
background audio support on Android.

First, the AmplitudeJS demo site works fine and plays in the background just 
great on Chrome for Android 59 on a Google Pixel running Android 7.1.0 and 
7.1.2 (tested on both).

I also then tweaked the demo code and put it into a cordova-compatible form. 
It's available on my repo here: https://github.com/filmaj/cordova-amplitudejs

This cordova app form of the amplitudejs demo works great on the browser 
platform (as expected) as well background audio worked great on Android 7.1.0 
and 7.1.2 (Google Pixel once more) using cordova-android 6.2.2 - opened the app 
up, hit the play button, then hit the home button, and things continued to play 
as expected.

I think that makes this pretty promising!

To [[email protected]]'s point, worth noting that if you run this in 
Chrome for Android and run in the background, you _will_ get a "sticky" 
notification in the notification bar showing you that something is playing (and 
giving you the control to pause what's currently playing). _However_, in the 
cordova-android-wrapped version of the app, this notification was not there. 
FYI.

I will do a bit more testing on emulators with earlier versions of Android to 
see where support for built-in JS {{Audio}} object (which is what AmplitudeJS 
uses) starts to fall apart.

> Media - SUNSET
> --------------
>
>                 Key: CB-12714
>                 URL: https://issues.apache.org/jira/browse/CB-12714
>             Project: Apache Cordova
>          Issue Type: Sub-task
>          Components: cordova-plugin-media
>            Reporter: Shazron Abdullah
>
> See parent issue.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to