-1

Getting this warning:

'seek(to:)' was deprecated in iOS 11.0: Use -seekToTime:completionHandler:, passing nil for the completionHandler if you don't require notification of completion

written in this particular line of block of code:

    @objc func playerItemDidReachEnd(notification: Notification) {
        let p: AVPlayerItem = notification.object as! AVPlayerItem
        p.seek(to: .zero)
    }

Any help with this will be much appreciated

  • This may help: https://stackoverflow.com/questions/22666190/using-seconds-in-avplayer-seektotime – koen May 11 '20 at 17:15

1 Answers1

1

In the documentation you can see that seek(to:) has been deprecated. You need to use seek(to: , completionHandler:). If you don't want to use a completion handler, you just pass a nil:

seek(to: .zero, completionHandler: nil)

https://developer.apple.com/documentation/avfoundation/avplayeritem

Marcel
  • 6,393
  • 1
  • 30
  • 44