AVURLAsset
An asset that represents media at a local or remote URL.
Declaration
class AVURLAssetOverview
This class is a concrete subclass of AVAsset. When you create an asset as shown below, the system creates and returns an instance of AVURLAsset.
// A local or remote asset URL.
guard let url: URL = Bundle.main.url(forResource: "Image",
withExtension: "png") else { return }
let asset = AVAsset(url: url)In many cases, this is an appropriate way to create asset instances, but you can also directly instantiate an AVURLAsset when you need more fine-grained control over its initialization. The initializer for AVURLAsset accepts an options dictionary, which you use to customize the asset’s initialization for your particular purpose. For example, if you’re creating an asset for an HLS stream, you may want to prevent it from retrieving its media when it connects over a cellular network. You can do this by providing the initialization option and value as shown below.
let url: URL = // A remote asset URL.
let options = [AVURLAssetAllowsCellularAccessKey: false]
let asset = AVURLAsset(url: url, options: options)