Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

moonman239

Cancelled
Original poster
Mar 27, 2009
1,541
32
I'm trying to create a button that has my queue player replay the last item in the queue after that item is played. I tried this:
Code:
- (IBAction)replay:(UIButton *)sender {

    [self.queuePlayerseekToTime:kCMTimeZero];

    [self.queuePlayer play];

}
Unfortunately, the queue player has a habit of removing each item played, and I don't exactly blame it. I have something that comes after this item, so any solution I use needs to take that into account. I'm thinking I could retain the item somewhere else and re-insert it in the "replay" action.

Edit: So, my solution worked, though I do also call seekToTime method.

Edit #2: For future Googlers:

The button's view controller is registered to receive every AVPlayerItemDidPlayToEndTimeNotification. It is upon notification that the last item has been replayed that I create a strong reference to the item.
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.