INNER CODE UNIT · Swift
seek
rxlabz/audioplayer · audioplayer/ios/Classes/SwiftAudioplayerPlugin.swift:156
func seek(time: CMTime) {
playerItem?.seek(to: time)
}
open override func observeValue(
forKeyPath keyPath: String?, of object: Any?,
change: [NSKeyValueChangeKey: Any]?, context: UnsafeMutableRawPointer?
) {
if keyPath == #keyPath(player.currentItem.status) {
if player!.currentItem!.status == AVPlayerItem.Status.readyToPlay {
onStart()
} else if player!.currentItem!.status == AVPlayerItem.Status.failed {
_channel.invokeMethod("audio.onError", arguments: [player!.currentItem!.error?.localizedDescription])
}
} else {
// Any unrecognized context must belong to super
super.observeValue(forKeyPath: keyPath, of: object, change: change, context: context)
}