URLVideoPlayerView
The URLVideoPlayerView downloads and displays videos from URLs all while caching them from reuse
The simplest of the URLVideoPlayerView
initializers
accepts a delegate
(More on this later),
and the sourceURLString
.
Simply pass in the URL of the video, and it will be fetched and displayed.
let urlString = "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerBlazes.mp4"
let playerView = URLVideoPlayerView(delegate: nil, sourceURLString: urlString)
playerView.play()
Other Initializers
While this simple example shows to load a video from external location, it does not demonstrate how this video has been cached and will be reused.
Take a look at the displaying in cells section
URLVideoPlayerViewDelegate
is explained in the delegate events section
ResourceCacheLocation
is explained in the cache location section
VideoExportQuality
is explained in the properties section
public convenience init(delegate: URLVideoPlayerViewDelegate?,
sourceURLString: String,
cacheLocation: ResourceCacheLocation,
videoExportQuality: Celestial.VideoExportQuality = .default)
// Example
let urlString = ...
let cacheLocation: ResourceCacheLocation = .fileSystem
let imageView = URLPlayerVideoView(delegate: nil, sourceURLString: urlString, cacheLocation: cacheLocation)
public init(delegate: URLVideoPlayerViewDelegate?, cacheLocation: ResourceCacheLocation = .fileSystem)
public init(frame: CGRect, cacheLocation: ResourceCacheLocation)