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:
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.
Code:
- (IBAction)replay:(UIButton *)sender {
[self.queuePlayerseekToTime:kCMTimeZero];
[self.queuePlayer play];
}
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: