Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[OALSimpleAudio bgPlaying] not working #70

Open
jaderfeijo opened this issue Aug 14, 2014 · 0 comments
Open

[OALSimpleAudio bgPlaying] not working #70

jaderfeijo opened this issue Aug 14, 2014 · 0 comments

Comments

@jaderfeijo
Copy link

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
@jaderfeijo jaderfeijo changed the title [OALSimpleAudio bgPlaying] returns FALSE when there is actually some background music playing [OALSimpleAudio bgPlaying] not working Aug 14, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant