|
OpenTV Player SDK For iOS
version 2.30.0
|
This class offers the downloading and the storage management of adaptive streaming assets. More...
#import <DownloadManager.h>
Instance Methods | |
| (instancetype) | - initWithRefreshMetadata: |
| Returns an instance of NMPDownloadManager which manage for downloading feature of HLS streams. More... | |
| (BOOL) | - registerDownloadListener: |
| Registers an INMPDownloadListener object to the DownloadManager. More... | |
| (BOOL) | - unregisterDownloadListener: |
| Unregisters an INMPDownloadListener interface from the DownloadManager. More... | |
| (NSString *) | - registerDownload: |
| Registers an asset download to the NMPDownloadManager via its URL. More... | |
| (NSArray *) | - getDownloads |
| Returns all downloads currently registered in the download manager. More... | |
| (NMPDownload *) | - getDownloadByUUID: |
| Get the download registered to the download manager matching the UUID specified in parameter. More... | |
| (NSArray *) | - getDownloadByContentId: |
| Returns all downloads matching the Content ID specified in parameter. More... | |
| (BOOL) | - removeDownload: |
| Removes the download specified in parameter. More... | |
| (BOOL) | - startDownload:bitrate: |
| Starts the download specified in parameter. More... | |
| (BOOL) | - resumeDownload: |
| Resumes the paused or failed download specified in parameter. More... | |
| (BOOL) | - pauseDownload: |
| Pauses the running download specified in parameter. More... | |
| (NSString *) | - getPrivateMetadata: |
| Returns the private string previously associated to the download. More... | |
| (void) | - setPrivateMetadata:withUUID: |
| Associate a private string to the download. More... | |
| (BOOL) | - refreshDownload: |
| Refreshes the running download specified in parameter. More... | |
This class offers the downloading and the storage management of adaptive streaming assets.
The client application can register, start, pause or remove the download of assets. Information pertaining to the downloads can be queried. The queries extract snapshots of the downloads in the form of one or more NMPDownload objects.
Before usage, the DownloadManager must be provided with a storage path and an IDownloadListener interfacing object. Once the path has been set and one IDownloadListener has been registered, the client application can start registering downloads. Downloads registered to the DownloadManager will immediately attempt to access the network and retrieve metadata pertaining to the asset requested, but the raw media data will not be downloaded before the download is explicitly started by the client application.
The preparing and downloading are driven by the callbacks of IDownloadListener.
Objects of this class can be instantiated multiple times, but all instances will point to a single underlying database maintaining all ongoing or finished downloads. The lifecycle of downloads are directly linked to the DownloadManager.
The DownloadManager currently supports the following adaptive streaming protocols and protocol versions :
Definition at line 59 of file DownloadManager.h.
| - (NSArray*) getDownloadByContentId: | (NSString *) | xContentId |
Returns all downloads matching the Content ID specified in parameter.
| [in] | xContentId | Content ID of the download. |
| - (NMPDownload*) getDownloadByUUID: | (NSString *) | xUUID |
Get the download registered to the download manager matching the UUID specified in parameter.
| [in] | xUUID | Universal Unique ID of the download. |
| - (NSArray*) getDownloads |
Returns all downloads currently registered in the download manager.
| - (NSString *) getPrivateMetadata: | (NSString *) | xUUID |
Returns the private string previously associated to the download.
| [in] | xUUID | Universal Unique ID of the download. |
null if no string has ever been set. | - (instancetype) initWithRefreshMetadata: | (BOOL) | xEnabled |
Returns an instance of NMPDownloadManager which manage for downloading feature of HLS streams.
| [in] | xEnabled | Pass YES to allow paused or failed download to refresh the playlist on resume. NO to resume without refreshing. |
| - (BOOL) pauseDownload: | (NSString *) | xUUID |
Pauses the running download specified in parameter.
The download will change to the STATE_PAUSED state.
| [in] | xUUID | Universal Unique ID of the download. |
true if the action succeeded; false if the UUID does not exist. | - (BOOL) refreshDownload: | (NSString *) | xUUID |
Refreshes the running download specified in parameter.
The download will change to the STATE_REFRESHING state. Refresh the original playlist to get again with fresh URLs then carry on with the download maintaining the segments that have already succeeded. Query the DB to get the original playlist
| [in] | xUUID | Universal Unique ID of the download. |
true if the action succeeded; false otherwise. | - (NSString *) registerDownload: | (NSString *) | xUrl |
Registers an asset download to the NMPDownloadManager via its URL.
| [in] | xUrl | The URL to the master manifest of an adaptive streaming asset. |
null if the download could not be registered. | - (BOOL) registerDownloadListener: | (id< INMPDownloadListener >) | xListener |
Registers an INMPDownloadListener object to the DownloadManager.
All callbacks coming from the NMPDownloadManager will be fired on this interface.
Currently only support one listener.
| [in] | xListener | An INMPDownloadListener interface object to register |
true if the action succeeded; false if the UUID does not exist. | - (BOOL) removeDownload: | (NSString *) | xUUID |
Removes the download specified in parameter.
The download will disappear from the list of downloads and be unregistered from the download manager. onDownloadRemoved() will be fired when effective.
| [in] | xUUID | Universal Unique ID of the download |
true if the action succeeded; false if the UUID does not exist. | - (BOOL) resumeDownload: | (NSString *) | xUUID |
Resumes the paused or failed download specified in parameter.
The download will change to the STATE_RUNNING state.
| [in] | xUUID | Universal Unique ID of the download. |
true if the action succeeded; false if the UUID does not exist. | - (void) setPrivateMetadata: | (NSString *) | xMetadata | |
| withUUID: | (NSString *) | xUUID | |
Associate a private string to the download.
This allows the client application to associate applicative data with the download. The format is at the developper's convenience. (JSON, XML, ...)
| [in] | xUUID | Universal Unique ID of the download. |
| [in] | xMetadata | String to associate to the download. |
| - (BOOL) startDownload: | (NSString *) | xUUID | |
| bitrate: | (unsigned int) | xBitrate | |
Starts the download specified in parameter.
The download will change to the STATE_RUNNING state.
| [in] | xUUID | Universal Unique ID of the download. |
| [in] | xBitrate | The consumption bitrate to use with the download. Only bitrates found in MediaInfo objects are eligible. |
true if the action succeeded; false if the UUID does not exist. | - (BOOL) unregisterDownloadListener: | (id< INMPDownloadListener >) | xListener |
Unregisters an INMPDownloadListener interface from the DownloadManager.
| [in] | xListener | An INMPDownloadListener interface object to unregister |
true if the action succeeded; false if the UUID does not exist.