Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: on player end listener in IOS
Browse files Browse the repository at this point in the history
SolankiYogesh committed Nov 30, 2024
1 parent 935ba2b commit c41a77a
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions ios/RNSound.mm
Original file line number Diff line number Diff line change
@@ -75,6 +75,22 @@ - (RCTResponseSenderBlock)callbackForKey:(NSNumber *)key {
return [[self callbackPool] objectForKey:key];
}

- (void)audioPlayerDidFinishPlaying:(AVAudioPlayer *)player
successfully:(BOOL)flag {
@synchronized(self) {
NSNumber *key = [self keyForPlayer:player];
if (key == nil)
return;
[self setOnPlay:NO forPlayerKey:self._key];
RCTResponseSenderBlock callback = [self callbackForKey:key];
if (callback) {
callback(
[NSArray arrayWithObjects:[NSNumber numberWithBool:flag], nil]);
[[self callbackPool] removeObjectForKey:key];
}
}
}

#pragma mark - File and Directory Access

- (NSString *)getDirectory:(NSSearchPathDirectory)directory {

0 comments on commit c41a77a

Please sign in to comment.