cordova-plugin-media icon indicating copy to clipboard operation
cordova-plugin-media copied to clipboard

fix(ios): New method allowing to disable automated memory release on memoryWarning (CB-11409)

Open tbrebant opened this issue 9 years ago • 8 comments
trafficstars

Platforms affected

iOS

What does this PR do?

It is adding a method allowing the user to disable (and re-enable) the automated resource releasing when a memory warning is received on iOS. Why? Because user may want to handle memory warnings by himself (such as releasing other less important resource first).

This method is static, on the class:

Media.shouldReleaseOnMemoryWarning(false);
// Here comes custom code to handle memoryWarnings

What testing has been done on this change?

  • Played multiple (non streaming) audio files after having disabled the auto-release and while having some heavy memory process running, until a memoryWarning is received: audio continue to play.
  • Played multiple (non streaming) audio files with the auto-release enabled and while having some heavy memory process running, until a memoryWarning is received: audio stops.

Ran the integrated tests. Before doing any change (version 2.3.1-dev) the result was:

cordova-media-plugin 2 3 1-dev

After the change the result is exactly the same:

img_0194

All tests was made with an iPad2 on iOS8.4.

Checklist

  • [x] ICLA has been signed and submitted to [email protected].
  • [x] Reported an issue in the JIRA database
  • [x] 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.

About the last point: tests will come as soon as possible, meanwhile please have a look at the code and review it! Thank you.

tbrebant avatar Jun 17 '16 09:06 tbrebant

Cordova CI Build has one or more failures.

Commit - Link Dashboard - Link

Builder Name Console Output Test Report Device Logs
Windows 8.1 Store Link Link Link
Windows 10 Store Link Link Link
Windows 8.1 Phone Link Link Link
iOS Link Link Link
Android Link Link Link

cordova-qa avatar Jun 17 '16 09:06 cordova-qa

What about this? Would it be possible to have a comment or an opinion?

tbrebant avatar Aug 25 '16 01:08 tbrebant

Hi,

Just dropping by to say that the current behaviour (stopping the music as soon as a memory warning is received) poses an issue for us as well. Having the music stop is the very last thing we want to do.

elgerlambert avatar Sep 20 '16 12:09 elgerlambert

Please check if PullRequest #120 will resolve your issue. I think, the user should not be involved in this issue, especially as it only affects iOS. Releasing playing/recording media is unnecessary in the first place.

katzlbt avatar Nov 05 '16 10:11 katzlbt

Hey @tbrebant, seems there is a merge conflict now. Could you please take care of this? Thanks.

janpio avatar Sep 16 '18 17:09 janpio

The issue addressed in this PR was fixed by: https://github.com/apache/cordova-plugin-media/pull/120 This PR can be dropped.

katzlbt avatar Jul 04 '19 08:07 katzlbt

Thanks for the feedback @katzlbt.

If I understand #120 correctly, that PR changed the way the memory pressure warning is handled to only drop non playing sounds. This PR would have added an option to disable the dropping completely - correct? There is no possible other need for the functionality contained in this PR?

(Sorry if my question are a bit basic here, I am not super accustomed to this plugin and iOS dev in general)

janpio avatar Jul 04 '19 08:07 janpio

Yes your assessment is correct, and there is no other functionality contained in the PR. The problem addressed by this PR is already fixed.

katzlbt avatar Jul 04 '19 12:07 katzlbt