Skip to main content
Skip table of contents

Playing the download

Playback starts in the same way as for online playback but using the offlineURL instead. The client application picks an asset from the list of available assets. It retrieves the local (offline) URL associated with the download, loading and playing that URL just like a standard CDN-hosted stream.

CODE
func getPlaybackAsset(title: String) -> OTVAVURLAsset? {
	for persistenceAsset in OTVPersistenceManager.shared.getDownloads() {
		if persistenceAsset.state == .downloaded && title == persistenceAsset.title {
			if let streamURL = persistenceAsset.offlineURL {
				return OTVAVURLAsset(url: persistenceAsset.offlineURL)
			} 
	}
	// Cannot find the persisted asset
	return nil
}

Playback while downloading

Only OTVPersistenceAsset assets in the .downloaded state have a valid offlineURL property for playback. However, providing the device is online, you can play assets in the process of downloading using the CDN-hosted URL.

Next step: You can purge the download.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.