5 Replies
      Latest reply on Apr 2, 2019 2:51 PM by ksherman-PIX
      Montree Level 1 Level 1 (0 points)

        I'm developing an Offline Rental Support. But I don't know that how to use 'makeSecureTokenForExpirationDateOfPersistableContentKey'.

         

        My step.

        KSM part.

             1. Create the KSM. --> done

             2. Create the Offline Key TLLV. --> done

             3. Delete the Content key duration TLLV from CKC response. --> done

         

        App part.

             1.  Modify the HLSCatalogWithFPS and use AVContentKeySession.

             In order to use Offline Rental Support. An app can obtain a Sync SPC via the method [AVContentKeySession makeSecureTokenForExpirationDateOfPersistableContentKey:completionHandler:].

             I don't know to use this method.

         

        While I still don't use the makeSecureTokenForExpirationDate, I got the result of Sync TLLV as following image. enter image description here

         

        Please advise me for using 'makeSecureTokenForExpirationDateOfPersistableContentKey' or step for implementation of Offline Rental (Sync TLLV).

        • Re: How to use the 'makeSecureTokenForExpirationDateOfPersistableContentKey ?
          Montree Level 1 Level 1 (0 points)

          Apple, please help me.

            • Re: How to use the 'makeSecureTokenForExpirationDateOfPersistableContentKey ?
              eskimo Apple Staff Apple Staff (12,435 points)

              Apple, please help me.

              DevForums is not an official Apple support channel.  If you want to request official support for this, open a DTS tech support incident.

              Also, it’s unlikely that any HLS experts are reading the Xcode > Swift topic area [1].  I’ve moved your question to a topic area (Media > FairPlay Streaming) that’s more likely to attract attention.

              Good luck!

              Share and Enjoy

              Quinn “The Eskimo!”
              Apple Developer Relations, Developer Technical Support, Core OS/Hardware
              let myEmail = "eskimo" + "1" + "@apple.com"

              [1] Which is, technically, for questions about the Swift programming language itself, although there’s also a lot of beginner traffic.

                • Re: How to use the 'makeSecureTokenForExpirationDateOfPersistableContentKey ?
                  3ZS Apple Staff Apple Staff (80 points)

                  Thanks eskimo for moving this question.

                   

                  Montree,

                   

                  The latest FPS SDK avalilbe from https://developer.apple.com/streaming/fps/ has a reference sample that uses AVContentKeySession and demonstrates how to handle persitable content keys.

                   

                  Also the FPS SDK has a reference key server that shows how to set how much time user has to start the playback after acquiring the key and how much time user has to complete watching after first playback started.

                    • Re: How to use the 'makeSecureTokenForExpirationDateOfPersistableContentKey ?
                      ksherman-PIX Level 1 Level 1 (0 points)

                      I've looked at the code in the sample and it doesn't use that method at all. I'm confused as to what the completion closure's `Data` consists of. I also don't see any reference to anything about this method in the server code after quickly perusing. Can you please advise what the data is? I already read through the specification doc included as well, so I understand what it's supposed to be used for.

                        • Re: How to use the 'makeSecureTokenForExpirationDateOfPersistableContentKey ?
                          ksherman-PIX Level 1 Level 1 (0 points)

                          Ok. I re-read everything a few more times (documentation in Xcode, header file documentation comments -- they're different, and the specification). You are supposed to call this method whenever you would like to tell your server the updated expiration date. The completion handler gives you the SPC data to send to your server. My thought is that you can use this SPC data and send it to your server to allow the server to decide if it wants to give you an updated CKC or not.

                           

                          My problem is, I don't see a way to update the CKC stored on disk from this server request because we are making this request out-of-band of the normal AVContentKeySession requests that are made. So, maybe this SPC is sent only for the server's informational purposes? I see a method `AVContentKeySession.renewExpiringResponseData(for: AVContentKeyRequest)`, but this requires an `AVContentKeyRequest` which can't be initialized. So, I'm not sure what to do about that. Maybe I'm supposed to just call `AVContentKeySession.processContentKeyRequest` to just start the whole process to get a CKC.

                           

                          --

                          The reason I'm wondering these things is I'm trying to just implement a 48 hour lease model that can be updated periodically and just before expiration for offline. It seems like the dual-expiry style is just a better, more robust type of offline key usage, so I figured I should probably use that. Also, since it seemed to have a mechanism for updating the server, that seemed helpful as well. However, maybe I'm wrong and just doing the standard content duration TLLV is better.