Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I loop the queue of sounds in AVQueuePlayer?

I know multiple questions concerning the same issue exist, but after following this one's suggestions, I run into a couple of problems.

I have everything set up but I get to mach errors everytime I use kMTTimeZero.

soundQueue = [AVQueuePlayer queuePlayerWithItems:soundEmotions];

    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(playerItemDidReachEnd:)
                                                 name:AVPlayerItemDidPlayToEndTimeNotification
                                               object:[soundEmotions lastObject]];

Here's what I've done .

- (void)playerItemDidReachEnd:(NSNotification *)notification {
    // Do stuff here
    NSLog(@"End has been reached.");

    // Set it back to the beginning
    [soundQueue seekToTime:kCMTimeZero];

    //Replay
    [soundQueue play];

}

ERROR: Undefined symbols for architecture armv7: "_kCMTimeZero", referenced from: -[ViewController playerItemDidReachEnd:] in ViewController.o ld: symbol(s) not found for architecture armv7 clang: error: linker command failed with exit code 1 (use -v to see invocation)

like image 891
KingPolygon Avatar asked Mar 11 '13 19:03

KingPolygon


1 Answers

kCMTimeZero is a symbol in the CoreMedia.framework, therefore you have to add this framework to the "Link Binary With Libraries" section in the "Build Phases" of your target.

like image 130
Martin R Avatar answered Oct 25 '22 17:10

Martin R