You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by su...@apache.org on 2018/01/25 19:54:10 UTC
[cordova-plugin-media] 01/06: Fix for CB-11513
This is an automated email from the ASF dual-hosted git repository.
surajpindoria pushed a commit to branch 5.0.x
in repository https://gitbox.apache.org/repos/asf/cordova-plugin-media.git
commit c8925b832ef18561a49a40d115a22e14f7ad6e03
Author: Romedius Weiss <ro...@gmail.com>
AuthorDate: Fri Nov 4 14:17:04 2016 +0100
Fix for CB-11513
https://issues.apache.org/jira/browse/CB-11513
---
src/ios/CDVSound.m | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/src/ios/CDVSound.m b/src/ios/CDVSound.m
index e154287..474ed97 100644
--- a/src/ios/CDVSound.m
+++ b/src/ios/CDVSound.m
@@ -817,13 +817,31 @@
- (void)onMemoryWarning
{
- [[self soundCache] removeAllObjects];
- [self setSoundCache:nil];
+ /* https://issues.apache.org/jira/browse/CB-11513 */
+ NSMutableArray* keysToRemove = [[NSMutableArray alloc] init];
+
+ for(id key in [self soundCache]) {
+ CDVAudioFile* audioFile = [[self soundCache] objectForKey:key];
+ if (audioFile != nil) {
+ if (audioFile.player != nil && ![audioFile.player isPlaying]) {
+ [keysToRemove addObject:key];
+ }
+ if (audioFile.recorder != nil && ![audioFile.recorder isRecording]) {
+ [keysToRemove addObject:key];
+ }
+ }
+ }
+
+ [[self soundCache] removeObjectsForKeys:keysToRemove];
+
+ // [[self soundCache] removeAllObjects];
+ // [self setSoundCache:nil];
[self setAvSession:nil];
[super onMemoryWarning];
}
+
- (void)dealloc
{
[[self soundCache] removeAllObjects];
--
To stop receiving notification emails like this one, please contact
surajpindoria@apache.org.
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org