VKPlayerViewController

@objc
open class VKPlayerViewController : UIViewController
extension VKPlayerViewController: VKPlayerViewDelegate

Standard player view controller to which you play videos from V.

Public Properties

  • Indicates how video will occupy it’s place.

    Declaration

    Swift

    @objc
    dynamic open var aspectMode: VKAspectMode { get set }
  • Indicates the preferred video resolution to use for playback. If nothing is set player will choose resolution in accordance with current connection bandwidth.

    Declaration

    Swift

    dynamic open var preferredVideoResolution: VKVideoResolution? { get set }
  • Indicates whether player is muted

    Declaration

    Swift

    @objc
    dynamic open var muted: Bool { get set }
  • Indicates whether player should loop video

    Declaration

    Swift

    @objc
    dynamic open var loop: Bool { get set }
  • The delegate for which the player would call.

    Declaration

    Swift

    open weak var delegate: VKPlayerViewControllerDelegate?
  • Declaration

    Swift

    open override var prefersStatusBarHidden: Bool { get }
  • Enable the showing of controls. Default value is true to show controls.

    Declaration

    Swift

    @IBInspectable
    open var showControls: Bool { get set }
  • Enable the showing of spinner when video is buffering. Default value is true.

    Declaration

    Swift

    @IBInspectable
    open var showSpinner: Bool { get set }
  • Enable the showing of error messages when video playback is failed. Default value is true.

    Declaration

    Swift

    @IBInspectable
    open var showErrorMessages: Bool { get set }
  • Show buttons controls or progress. Default value is true.

    Declaration

    Swift

    @IBInspectable
    open var showButtonsControls: Bool { get set }
  • Indicates the current playlist of the player. This property is read only and can be observed via KVO.

    Declaration

    Swift

    @objc
    dynamic open var playlist: VKPlaylist? { get }
  • Indicates the current video index in the playlist. This property is read only and can be observed via KVO.

    Declaration

    Swift

    @objc
    dynamic open var playlistIndex: Int { get }
  • Indicates the current video of the player. This property is read only and can be observed via KVO.

    Declaration

    Swift

    @objc
    fileprivate(set) dynamic open var video: VKVideo? { get set }
  • Indicates the current state of the player. This property is read only and can be observed via KVO.

    Declaration

    Swift

    @objc
    fileprivate(set) dynamic open var playState: VKPlayState { get }
  • Indicates the current time position of the player. This property is read only and can be observed via KVO.

    Declaration

    Swift

    @objc
    fileprivate(set) dynamic open var currentTime: TimeInterval { get }
  • The duration of the current playing item. If there’s no item to be played the value is 0.

    Declaration

    Swift

    @objc
    fileprivate(set) dynamic open var duration: TimeInterval { get }
  • Indicates whether the current video is ready to play

    Declaration

    Swift

    @objc
    open var isReadyToPlay: Bool { get }

Public Methods

  • Declaration

    Swift

    open override func prepare(for segue: UIStoryboardSegue, sender: Any?)
  • Declaration

    Swift

    override open func viewDidLoad()
  • Declaration

    Swift

    override open func didReceiveMemoryWarning()
  • Reset player to initial state

    Declaration

    Swift

    public func reset()
  • Sets the player to a particular video object without playing it just yet. It will begin to preload the video.

    Declaration

    Swift

    public func set(video: VKVideo, _ transition: VKPlayerTransition? = nil)

    Parameters

    video

    The video object to set to.

  • Sets the player to a particular playlist object without playing it just yet. It will begin to preload the video.

    Declaration

    Swift

    public func set(playlist: VKPlaylist, atIndex index: Int = 0, _ transition: VKPlayerTransition? = nil)

    Parameters

    playlist

    The playlist object to set to.

    atIndex

    The index in the playlist to set to. This is optional, but by default it will start at index 0.

  • Sets the player to video at index in current playlist object without playing it just yet. It will begin to preload the video.

    Declaration

    Swift

    public func set(playlistIndex index: Int, _ transition: VKPlayerTransition? = nil)

    Parameters

    playlistIndex

    The index in the current playlist to set to.

  • Play the video object.

    Declaration

    Swift

    public func play(video: VKVideo, _ transition: VKPlayerTransition? = nil)

    Parameters

    video

    The video object to be played.

  • Play the video playlist object.

    Declaration

    Swift

    public func play(playlist: VKPlaylist, atIndex index: Int = 0, _ transition: VKPlayerTransition? = nil)

    Parameters

    playlist

    The playlist object that you want to play.

    atIndex

    The index position that you would want to play withing the playlist.

  • If a playlist was loaded, then play video at a given index. If index is an invalid index it will do nothing.

    Declaration

    Swift

    public func play(playlistIndex index: Int, _ transition: VKPlayerTransition? = nil)

    Parameters

    index

    The index item

  • Play the current item.

    Declaration

    Swift

    public func play()
  • Pause the current item.

    Declaration

    Swift

    public func pause()
  • Move the current play position to a different time position

    Declaration

    Swift

    public func seek(to time: TimeInterval)

    Parameters

    to

    The time position to move to.

  • Add gesture recognizer to the player view controller.

    Declaration

    Swift

    public func addGestureRecognizer(gestureRecognizer: UIGestureRecognizer)

    Parameters

    gestureRecognizer

    The gesture recognizer to add

  • Declaration

    Swift

    public func playbackQueueUpdated(videos: [VKVideo])
  • Declaration

    Swift

    public func vkPlayerViewPlaybackStateDidChange(_ player: VKPlayerView)
  • Declaration

    Swift

    public func vkPlayerViewReadyToPlay(_ player: VKPlayerView)
  • Declaration

    Swift

    public func vkPlayerViewDidPlayToEnd(_ player: VKPlayerView)
  • Declaration

    Swift

    public func vkPlayerViewCurrentTimeChanged(_ player: VKPlayerView)
  • Declaration

    Swift

    public func vkPlayerViewFailedToPlay(_ player: VKPlayerView, error: VKError)
  • Declaration

    Swift

    public func vkPlayerViewBuffering(_ player: VKPlayerView, buffering: Bool)