When I play an .m4a sound file with music playing from the iTunes library the music stops and then the sound plays. How can I get the sound to play over the music?
NSString *path = [NSString stringWithFormat:@"%@/sound.m4a", [[NSBundle mainBundle] resourcePath]];
NSURL *soundUrl = [NSURL fileURLWithPath:path];
NSError *error;
_avp = [[AVAudioPlayer alloc] initWithContentsOfURL:soundUrl error:&error];
_avp.volume =1.0;
[_avp prepareToPlay];
[_avp play];
Aucun commentaire:
Enregistrer un commentaire