Registering the download
An application must first register an asset to the downloader before actually downloading it. The registration step fetches the metadata that is related to the asset. As soon as an application registers a URL, the downloader will fetch the HLS playlists. When information in the playlist is available for the application to read, the download state will change PREPARED.
If the playlist cannot be acquired, the state of the download will change to FAILED.
Example code
The following code example shows how to register the download.
- (void) addDownloadUrl:(NSString*)url
{
if(_downloadManager == nil) {
_downloadManager = [[NMPDownloadManager alloc] init];
}
// register ourself as the delegate for notifications
[_downloadManager registerDownloadListener:self];
// register the download
[_downloadManager registerDownload:url];
}
See the NMPDownloadManager class reference for details of the API calls used above.
Next step:
- For clear content, you can start the download.
- For encrypted content, you need to import licences.