Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(android): Adding playAudioWhenScreenIsLocked for Android (CB-12146) #137

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

romedius
Copy link
Contributor

When loosing focus of the app in android (onPause()) the audio playback is paused when playAudioWhenScreenIsLocked is set to false.

Platforms affected

Android

What does this PR do?

Adds the playAudioWhenScreenIsLocked flag to the Android version. This makes it possible to selectively keep audios playing, when onPause is called.

What testing has been done on this change?

Manual testing on Android N

Checklist

  • Reported an issue in the JIRA database
  • Commit message follows the format: "CB-3232: (android) Fix bug with resolving file paths", where CB-xxxx is the JIRA ID & "android" is the platform affected.
  • Added automated test coverage as appropriate for this change.

When loosing focus of the app in android (onPause()) the audio playback is paused if playAudioWhenScreenIsLocked is set to false.
@romedius
Copy link
Contributor Author

Old PR: #121

One question:
I couldn't test the
onMessage(String id, Object data) {
method and its affects. when is this triggered?

@cordova-qa
Copy link

Cordova CI Build has one or more failures.

Commit - Link
Dashboard - Link

Builder Name Console Output Test Report Device Logs
Windows 10 Store Link Link Link
iOS 9.3 Link Link Link
iOS 10.0 Link Link Link
Android 4.4 Link Link Link
Android 5.1 Link Link Link

@filmaj
Copy link
Contributor

filmaj commented Apr 26, 2017

Let there be tests

@cordova-qa
Copy link

Cordova CI Build has one or more failures.

Commit - Link
Dashboard - Link

81 tests run, 15 skipped, 0 failed.

@filmaj
Copy link
Contributor

filmaj commented Apr 26, 2017

Hmm, looks like all three CI runs against Android (4.4, 5.1, and 6.0) failed. Output for these three test runs:

All three fail because of a missing import, PermissionHelper, which you removed in your PR:

Error: /private/var/folders/nd/5vd2nqsn3tlc6kljds0c95200000gp/T/tmp-8821EyOxfsP58Sxv/platforms/android/gradlew: Command failed with exit code 1 Error output:
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
/private/var/folders/nd/5vd2nqsn3tlc6kljds0c95200000gp/T/tmp-8821EyOxfsP58Sxv/platforms/android/src/org/apache/cordova/media/AudioHandler.java:83: error: cannot find symbol
        PermissionHelper.requestPermission(this, requestCode, permissions[WRITE_EXTERNAL_STORAGE]);
        ^
  symbol:   variable PermissionHelper
  location: class AudioHandler

We cannot accept this PR if it causes Cordova apps that add the plugin to not be able to compile.

@romedius
Copy link
Contributor Author

romedius commented Jun 6, 2017

Let there be tests

@romedius
Copy link
Contributor Author

romedius commented Jun 6, 2017

(hopefully this triggers the CI)

@cordova-qa
Copy link

Cordova CI Build has completed successfully.

Commit - Link
Dashboard - Link

162 tests run, 24 skipped, 0 failed.

@filmaj
Copy link
Contributor

filmaj commented Jun 6, 2017

Sweet, I'm down with merging this in. Small nit: if you could rebase w/ latest master and combine the commits into one that'd be fantastic!

@infil00p any concerns from you on this one?

Worth noting that the media plugin will likely be sunset down the road, in favour of the Media Capture plugin (which is more aligned with the latest W3C specs). For more info, see CB-12714.

BuddyLReno pushed a commit to BuddyLReno/cordova-plugin-media that referenced this pull request Aug 28, 2017
BuddyLReno pushed a commit to BuddyLReno/cordova-plugin-media that referenced this pull request Nov 10, 2017
@janpio janpio changed the title CB-12146 (android) Adding playAudioWhenScreenIsLocked for Android feat(android): Adding playAudioWhenScreenIsLocked for Android (CB-12146) Jul 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants