Skip to content

Commit

Permalink
Hopefully fix crashes from rapidly skipping files
Browse files Browse the repository at this point in the history
Do this by serializing the background thread actions against
the AudioPlayer object, so we don't start playback multiple
times at once.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
  • Loading branch information
kode54 committed Oct 2, 2023
1 parent cda6ce6 commit ca1f938
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Audio/AudioPlayer.m
Expand Up @@ -57,7 +57,9 @@ - (void)play:(NSURL *)url withUserInfo:(id)userInfo withRGInfo:(NSDictionary *)r
}

- (void)playBG:(NSURL *)url withUserInfo:(id)userInfo withRGInfo:(NSDictionary *)rgi startPaused:(NSNumber *)paused andSeekTo:(NSNumber *)time {
[self play:url withUserInfo:userInfo withRGInfo:rgi startPaused:[paused boolValue] andSeekTo:[time doubleValue]];
@synchronized (self) {
[self play:url withUserInfo:userInfo withRGInfo:rgi startPaused:[paused boolValue] andSeekTo:[time doubleValue]];
}
}

- (void)play:(NSURL *)url withUserInfo:(id)userInfo withRGInfo:(NSDictionary *)rgi startPaused:(BOOL)paused andSeekTo:(double)time {
Expand Down

0 comments on commit ca1f938

Please sign in to comment.