2 Replies
      Latest reply on Sep 13, 2019 2:27 AM by karlg_arris
      carruis chen Level 1 Level 1 (0 points)

        streamingContentKeyRequestDataForApp:contentIdentifier  function    always  return error 268451843

         

        [1]@"NSLocalizedFailureReason" : @"An unknown error occurred (268451843)"

        [2]@"NSLocalizedDescription" : @"The operation could not be completed"


         

        
        - (NSData *)myGetAppCertificateData
        {
             NSString *resourcePath = [[NSBundle mainBundle] pathForResource:@"fairplay" ofType:@"der"];
            NSData*certificate=[NSData dataWithContentsOfFile:resourcePath];
            return certificate;
        }
        

         

        in  resourceLoader:(AVAssetResourceLoader *)resourceLoader shouldWaitForLoadingOfRequestedResource:(AVAssetResourceLoadingRequest *)loadingRequest

         

        
          NSString *assetStr;
          NSData *assetId;
          NSData *requestBytes;
        
        
            assetStr = [url host];
            assetId = [NSData dataWithBytes: [assetStr cStringUsingEncoding:NSUTF8StringEncoding] length:[assetStr lengthOfBytesUsingEncoding:NSUTF8StringEncoding]];
            NSData *certificate = [self myGetAppCertificateData];
            #pragma mark ADAPT: YOU MUST CALL: streamingContentKeyRequestDataForApp::options:
        
        
            requestBytes = [loadingRequest streamingContentKeyRequestDataForApp:certificate
                                                              contentIdentifier:assetId
                                                                        options:nil
                                                                          error:&error];
        

         

        please help us to debug