6 Replies
      Latest reply on Jan 11, 2016 7:03 AM by lukaszpluto
      messerman Level 1 Level 1 (0 points)

        When attempting to stream fairplay-protected content to an Apple TV over AirPlay, we run into a problem, which is that the Apple TV does not request anything via FPS, but instead is seeking to do direct key-fetch from the App using the protocol handler (e.g. "fps://") - when disabling our protocol handler, and only having FPS, it just fails outright and does not contact the iOS App. Is there some special sequence of calls that needs to be made to make this work properly with an Apple TV?

         

        Note that everything plays properly (and is properly protected by FPS) when playing locally on a device.

        • Re: Unable to stream FPS-protected content over AirPlay to Apple TV
          srk Apple Staff Apple Staff (205 points)

          See the FairPlay Overview document Figure 1-3 (<https://developer.apple.com/services-account/download?path=/Documentation/FairPlay_Streaming_Overview/FairPlayStreaming_Overview.pdf>) which describes FPS streaming over AirPlay. In an AirPlay scenario, the FPS request is always routed through the app. The AppleTV never talks to the Key Server directly to get keys. To do this, the app must set the usesExternalPlaybackWhileExternalScreenIsActive property of the AVPlayer object to TRUE with code like this:

           

          // create AVPlayer object

          player = [AVPlayer playerWithURL:movieURL];

          // set the property to TRUE

          player.usesExternalPlaybackWhileExternalScreenIsActive = TRUE;

           

          This is discussed in the FairPlay Streaming Programming Guide section titled “Configuring AirPlay Mode” (<https://developer.apple.com/services-account/download?path=/Developer_Tools/FairPlay_Streaming_SDK/FairPlay_Streaming_Server_SDK.zip>).

           

          In other words, your app will receive the callback with the SPC just like in the local playback case. The behavior you are seeing is expected. You should expect your app to make the FPS request even in the case of AirPlay streaming.

            • Re: Unable to stream FPS-protected content over AirPlay to Apple TV
              messerman Level 1 Level 1 (0 points)

              Thanks - this helped, somewhat, but I'm still having problems with AirPlay. I put in the usesExternalPlaybackWhileExternalScreenIsActive, and now I'm seeing the initial request from (presumably) the Apple TV. But, I'm getting an error in gnerating the actual SPC.

               

              Note that this all works when I'm not playing through AirPlay (ie. when I'm playing local on the device).

               

              Specifically, the error happens in my delegate code during the call to shouldWaitForLoadingOfRequestedResource:

              NSData *requestBytes = nil;
              requestBytes = [loadingRequest streamingContentKeyRequestDataForApp:[NSData dataWithBytes:(const void*)certificate.Data() length:certificate.Size()] contentIdentifier:urlParams options:nil error:&error];
              if(requestBytes == nil) {
              NSLog(@"Error creating server request: "%@", error);
              return FALSE;
              }
              

               

              The error I see is similar to what I used to see when I did not have a valid certificate:

              <Warning>: Error creating server request: Error Domain=AVFoundationErrorDomain Code=-11800 "The operation could not be completed" UserInfo={NSLocalizedDescription=The operation could not be completed, NSUnderlyingError=0x190a83f0 {Error Domain=NSOSStatusErrorDomain Code=-6753 "(null)"}, NSLocalizedFailureReason=An unknown error occurred (-6753)}

               

              Any idea where I'm going wrong from there? Again this all works fine if AirPlay is not involved.

               

              Thanks!

              • Re: Unable to stream FPS-protected content over AirPlay to Apple TV
                messerman Level 1 Level 1 (0 points)

                Hi srk - any chance you can take a look at my other reply to this comment and see if you can help me out? We are still stuck trying to get this work at all. I'd really appreciate any help you can give us.

                 

                Thank you!