VKPlayerCache

public class VKPlayerCache
  • Declaration

    Swift

    public static let shared: VKPlayerCache
  • Amount of bytes the cache uses on device, default value is 100 MB

    Declaration

    Swift

    public var cacheSize: Int { get set }
  • Amount of seconds to preload during video preparation, default and minimal value is 2 seconds

    Declaration

    Swift

    public var videoPreloadingThreshold: TimeInterval { get set }
  • Declaration

    Swift

    @objc
    open func didReceiveMemoryWarning()

Public

  • Preloads few seconds of the video

    Declaration

    Swift

    public func preload(video: VKVideo, completion: @escaping (Bool, VKError?) -> Void) -> VKCancellable?

    Parameters

    video

    Video to preload

    Return Value

    VKCancellable object that can be used to cancel preloading

  • Checks whether the video is preloaded

    Declaration

    Swift

    public func isPreloaded(video: VKVideo) -> Bool

    Parameters

    video

    Video to check

    Return Value

    Boolean indicating whether the video is preloaded

  • Clears cache for all videos

    Declaration

    Swift

    public func clearCache()
  • Clears cache for the video

    Declaration

    Swift

    public func clearCacheFor(video: VKVideo)

    Parameters

    video

    Video to clear cache for