Skip to content

Instantly share code, notes, and snippets.

@sneakyness
Created November 29, 2012 08:45
Show Gist options
  • Save sneakyness/4167639 to your computer and use it in GitHub Desktop.
Save sneakyness/4167639 to your computer and use it in GitHub Desktop.
-(void) playMusic
{
NSString *musicPath1 = [[NSBundle mainBundle] pathForResource:@"POL-stable-boy-short" ofType:@"wav"];
NSString* musicPath2 = [[NSBundle mainBundle] pathForResource:@"POL-two-fat-gangsters-short" ofType:@"wav"];
AVPlayerItem *firstMusicItem = [AVPlayerItem playerItemWithURL:[NSURL fileURLWithPath:musicPath1]];
AVPlayerItem *secondMusicItem = [AVPlayerItem playerItemWithURL:[NSURL fileURLWithPath:musicPath2]];
self.backgroundMusicPlayer = [AVQueuePlayer queuePlayerWithItems:[NSArray arrayWithObjects:firstMusicItem, secondMusicItem, nil]];
for (;;)
{
[self.backgroundMusicPlayer play];
}
//__neeku__ plays the track nonstop in an infinite loop.
//backgroundMusic1.numberOfLoops = -1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment