I have a hls url which plays in my avplayer, but I'm unable to use the [playerItem stepByCount:] method. When I call it, it doesn't do anything.
Also if I call [playerItem canStepBackward]), it always returns false. Is there some other way I have to step forward and backward when I'm playing an hls stream?
My setup is:
AVURLAsset *asset = [AVURLAsset URLAssetWithURL:_URL options:nil];
self.playerItem = [AVPlayerItem playerItemWithAsset:asset];
[self.player replaceCurrentItemWithPlayerItem:self.playerItem];
// later on...
AVPlayerItem *playerItem = self.player.currentItem;
if ([playerItem canStepBackward]) {
if ([self isPlaying]) {
[self.player pause];
}
[playerItem stepByCount:-1];
}
This all works perfectly when I use mp4s, but with hls canStepBackward always returns false, and if I ignore it and just call [playerItem stepByCount:-1]; anyway, it does nothing.
If your player's item doesn't support stepping backward/forward you can simply use
seekmethod ofAVPlayerfor this purpose e.g.: