Search code examples
iosbuttonavplayeravqueueplayer

AVPlayerViewController next/prev buttons don't work?


My code:

AVQueuePlayer *player = ...;
AVPlayerViewController *controller = [[AVPlayerViewController alloc] init];
    [vc presentViewController:controller animated:YES completion:nil];
    controller.player = player;
    controller.allowsPictureInPicturePlayback = NO;
    [player play];

AVQueuePlayer is like AVPlayer but supports multiple items.

The problem is AVPlayerViewController has "go next/prev" buttons and they don't work.


Solution

  • Not all media is capable of fast forwarding / skipping or rewinding. The AVPlayer does not allow you to override that functionality.

    In order to check if the media is capable of fast forward or rewind, see the values of canPlayFastForward and canPlayFastReverse in AVPlayerItem.

    If you really want to override the Next/Prev buttons, I think your only shot is to make a custom AVPlayerViewController.