Skip to main content
Skip table of contents

Purging the download

The purge download operation takes place when the user decides to delete a downloaded asset on their device.

On user input, the client application retrieves information from a downloaded asset to purge. Based on that information (PRM Syntax, PRM Content ID, or privately defined content ID), the client application can erase related licences from the PAK.

The client application can remove the downloaded asset sequentially or in parallel by calling removeDownload(). The operation is asynchronous as removal is potentially time-consuming.

Example code

The following code example shows how to purge a downloaded asset and its related license.

CODE
- (void)removeDownload:(NSString*) UUID
{
    NMPDownload* download = [_downloadManager getDownloadByUUID:UUID];
    NSString* contentID = download.asset.PRMContentID;
    if (download.asset.isProtected && contentID.length == 0)
    {
      NSString* meta = [_downloadManager getPrivateMetadata:download.UUID];
      if(meta.length > 0)
      {
        NSDictionary* metaDict = [NSJSONSerialization JSONObjectWithData:[meta dataUsingEncoding:NSUTF8StringEncoding] options:0 error:0];
        if (metaDict)
          contentID = metaDict[@"Content_ID"];
      }
    }
 
    if (download.asset.isProtected)
      [[self drmHandler] eraseLicense: contentID];
    [_downloadManager removeDownload:download.UUID];
}

See the NMPDownloadManager class reference for details of the API calls used above.

JavaScript errors detected

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

If this problem persists, please contact our support.