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

ASF GitHub Bot commented on CB-11513:
-------------------------------------

GitHub user romedius opened a pull request:

    https://github.com/apache/cordova-plugin-media/pull/120

    CB-11513: (ios) Fixed: iOS memory warning stops sound, but does not send 
status to JS-client

    ### Platforms affected
    iOs
    
    ### What does this PR do?
    If iOS issues a memory warning while playing a sound, all sounds are 
terminated. However the ios/CDVSound.m plugin does not update the state of its 
JS-clients, so the last state the Client knows is Media.MEDIA_RUNNING, which is 
untrue after a memory warning. This results in incorrect clientside status.
    
    Problem: A user's software component may send pause() instead of play() 
(toggle button) effectively rendering the sound unplayable without recovery. 
This happened in our case.
    
    Fix: Do not discard currently playing sounds. The first memory warning 
arrives exactly when the App enters the yellow area and consumes 500MB however 
it may consume 750MB and more according to Xcode so terminating sounds on 
"memory warning" is incorrect behavior.
    
    ### What testing has been done on this change?
    Tested on iOs simulator.
    How to reproduce  the Issue: Add 1 or 2 large animated GIFs with 200+ 
frames to the UIWebView, this will consume 500MB quickly while playing the 
GIFs, or simulate the memory warning using the iOS Simulator while playing a 
sound.
    
    ### Checklist
    - [x] [Reported an issue](http://cordova.apache.org/contribute/issues.html) 
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.
    - [x] Added automated test coverage as appropriate for this change.
    
    https://issues.apache.org/jira/browse/CB-11513

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/romedius/cordova-plugin-media patch-1

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cordova-plugin-media/pull/120.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #120
    
----
commit ad25d1059c44ce2229c40dabf6b7136f89356952
Author: Romedius Weiss <romedius.we...@gmail.com>
Date:   2016-11-04T13:17:04Z

    Fix for CB-11513
    
    https://issues.apache.org/jira/browse/CB-11513

----


> iOS memory warning stops sound, but does not send status to JS-client
> ---------------------------------------------------------------------
>
>                 Key: CB-11513
>                 URL: https://issues.apache.org/jira/browse/CB-11513
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: Plugin Media
>    Affects Versions: 3.6.3, 4.1.3, 6.1.0
>         Environment: iOS 9.3 iPhone 6
>            Reporter: Thomas K.
>
> If iOS issues a memory warning while playing a sound, all sounds are 
> terminated. However the ios/CDVSound.m plugin does not update the state of 
> its JS-clients, so the last state the Client knows is Media.MEDIA_RUNNING, 
> which is untrue after a memory warning. This results in incorrect clientside 
> status.
> Problem: A user's software component may send pause() instead of play() 
> (toggle button) effectively rendering the sound unplayable without recovery. 
> This happened in our case.
> Fix: Do not discard currently playing sounds. The first memory warning 
> arrives exactly when the App enters the yellow area and consumes 500MB 
> however it may consume 750MB and more according to Xcode so terminating 
> sounds on "memory warning" is incorrect behavior.
> https://github.com/apache/cordova-plugin-media/blob/master/src/ios/CDVSound.m#L814
> How to reproduce: Add 1 or 2 large animated GIFs with 200+ frames to the 
> UIWebView, this will consume 500MB quickly while playing the GIFs, or 
> simulate the memory warning using the iOS Simulator while playing a sound.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org

Reply via email to