Download to Go (DTG) is an iOS library that facilitates the download of HLS video assets.
Supported Features
Downloading Kaltura HLS assets (Clear only)
Background downloading.
Resuming interrupted/paused downloads.
Known Limitations
No track selection (downloads all tracks)
Can’t play downloaded assets in background
Installation
[CocoaPods][cocoapods]
Add this to your podfile:
Overview
Simple Flow
Note:
Failed is a temp state, the delegate will notify and item has failed and content manager will remove this item. In addition, keep in mind that when receiving failed state an error will also be provided in the delegate to indicate the reason.
There is also Removed state which is not displayed here. Removed is a temporary state indicated an item was removed (can be considered as an event). You can remove an item from all states.
Download Sequence
Simple Playing Sequence (Using PlayKit Player)
Usage
To use the DTG make sure to import in each source file:
The following classes/interfaces are the public API of the library:
ContentManager - Use this class to interact with the library.
DTGContentManager - This is the main API you will use to interact with the library.
ContentManagerDelegate - Delegate calls available to observe.
DTGItem - Represent a single download item.
DTGItemState - The state of a download item.
Basic Implementation:
Basic Implementation with PlayKit:
On AppDelegate:
Make sure to call ContentManager.shared.setup()
(Optional) This is a good place to call ContentManager.shared.startItems(inStates: _) to resume interrupted or in progress downloads.
Note: Make sure to call ContentManager.shared.stop() when finished with playback.