File tree Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -833,13 +833,31 @@ -(void)itemStalledPlaying:(NSNotification *) notification {
833
833
834
834
- (void )onMemoryWarning
835
835
{
836
- [[self soundCache ] removeAllObjects ];
837
- [self setSoundCache: nil ];
836
+ /* https://issues.apache.org/jira/browse/CB-11513 */
837
+ NSMutableArray * keysToRemove = [[NSMutableArray alloc ] init ];
838
+
839
+ for (id key in [self soundCache ]) {
840
+ CDVAudioFile* audioFile = [[self soundCache ] objectForKey: key];
841
+ if (audioFile != nil ) {
842
+ if (audioFile.player != nil && ![audioFile.player isPlaying ]) {
843
+ [keysToRemove addObject: key];
844
+ }
845
+ if (audioFile.recorder != nil && ![audioFile.recorder isRecording ]) {
846
+ [keysToRemove addObject: key];
847
+ }
848
+ }
849
+ }
850
+
851
+ [[self soundCache ] removeObjectsForKeys: keysToRemove];
852
+
853
+ // [[self soundCache] removeAllObjects];
854
+ // [self setSoundCache:nil];
838
855
[self setAvSession: nil ];
839
856
840
857
[super onMemoryWarning ];
841
858
}
842
859
860
+
843
861
- (void )dealloc
844
862
{
845
863
[[self soundCache ] removeAllObjects ];
You can’t perform that action at this time.
0 commit comments