[OALSimpleAudio bgPlaying] not working
Opened this issue · 0 comments
jaderfeijo commented
Calling [[OALSimpleAudio sharedInstance] bgPlaying]
returns FALSE
even when there is background music playing.
I wrote a category to OALSimpleAudio
to only trigger the play action when the speficied background music file is not already playing but since bgPlaying
returns FALSE
even when the background music is actually playing, the code below simply does not work.
@implementation OALSimpleAudio (Additions)
- (void)playBgIfNotAlreadyPlaying:(NSString *)fileName loop:(BOOL)loop {
if (![self isPlayingBgNamed:fileName]) {
[self stopBg];
[self playBg:fileName loop:loop];
}
}
- (BOOL)isPlayingBgNamed:(NSString *)fileName {
if ([self bgPlaying]) {
if ([[[[self backgroundTrackURL] absoluteString] lastPathComponent] isEqualToString:fileName]) {
return YES;
} else {
return NO;
}
} else {
return NO;
}
}
@end