FairPlay Streaming

RSS for tag

Securely deliver streaming media to devices through the HTTP Live Streaming protocol using FairPlay Streaming (FPS).

Posts under FairPlay Streaming tag

46 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

FairPlay+AVC+AC-3 on iOS
We found that when enabled FairPlay to streams that uses AVC video codec and AC-3 + MP4 audio codec, the playback fails on some devices with CoreMedia error 1718449215 after started playback for about a second. Successful playback devices: iPhone SE Failed playback devices: iPhone 12 Pro, iPhone 14 Pro
0
0
68
4d
Stopped playing hls+fairplay, but was played yesterday
device iPhone 13 Pro max AVPlayer recieve error #Version: 1.0 #Software: AppleCoreMedia/1.0.0.21E236 (iPhone; U; CPU OS 17_4_1 like Mac OS X; en_us) #Date: 2024/06/11 14:06:18.018 CoreMediaErrorDomain error -42716 On system log we see propertyKey:IsLeaseExpired стандартное 14:38:28.008912+0300 mediaplaybackd <<<< FigCPECryptorPKD >>>> FigPKDCPECryptorSetKeyRequestResponse: 0xcc4160140 612C5D12-F92F-4897-B55D-854F842B41B4 keyResponseOptions:[] keyRequestResponse:0xcc5759d70 err:-42716 стандартное 14:38:28.009052+0300 mediaplaybackd keyboss ckb_transitionRequestToTerminalState: 0xcc5440380 <private> reqFin err <private> (-42716) dokeyCallbacksExist 0 стандартное 14:38:28.009138+0300 mediaplaybackd keyboss ckb_customURLReadCallback: 0xcc5440380 <private> customURLReqID 8 isComplete 1 err 0 error <private> (0) dokeyCallbacksExist 0 стандартное 14:38:28.009169+0300 mediaplaybackd <<<< FigPKDKeyManager >>>> keyManager_copyPropertyForEntryInternal: 0xcc546b280 6143FF61-5E6F-4506-A17D-4DB6B6BA0C5B propertyKey:IsLeaseExpired propertyValue: 0x16e5b17a0 стандартное 14:38:28.009196+0300 mediaplaybackd <<<< FigPKDKeyManager >>>> PKDKeyManagerSetKeyRequestError: keyManager:0xcc546b280 keyID:6143FF61-5E6F-4506-A17D-4DB6B6BA0C5B error:<private> (-19160) err:0 on server leaseDuration always is 0 But we have another device iPhone 15 Pro max, iOS 17.5.1 and he played correctly with the same crypt key from server
0
0
141
2w
Fairplay on M2/M3 MacBook's not honouring lease duration in license
Doing some testing around player behaviour when a license expires in Safari on MacOS. I had the following outcomes: On Safari 17.4.1 on an intel based Mac running Ventura, playback stopped when the license expired. On Safari 17.4.1 on an M3 running Sonoma, playback stalled briefly, and then continued to play unlimited. On Safari 16.5.2 on an M2 running Ventura, playback stalled briefly, and then continued to play unlimited. When playback stalled briefly, was at the time the license expired. I parsed the license and everything is set correctly for a lease license type: { "version" : 1, "payloadLength" : 1072, "iv" : "0H9NCXLQeh1ziYpmJXsnwQ==", "assetId" : "䙁㉌䉃\u0000\u0000\u0000", "hdcp" : "TYPE_0_REQUIRED", "contentKeyDuration" : { "leaseDurationSeconds" : 300, "rentalDurationSeconds" : 0, "persistenceAllowed" : false }, "keyType" : "Lease" } I cannot find any information relating to this behaviour. Per the docs for FPS, a lease license type: If the content key is not renewed, the Apple device stops the playback when the lease expires. Which is what is observed on the intel based macbook.
0
0
262
May ’24
AVPlayer CoreMediaErrorDomain -12642
Hi everyone, I am having a problem on AVPlayer when I try to play some videos. The video starts for a few seconds, but immediately after I see a black screen and in the console there is the following error: <__NSArrayM 0x14dbf9f30>( { StreamPlaylistError = "-12314"; comment = "have audio audio-aacl-54 in STREAMINF without EXT-X-MEDIA audio group"; date = "2024-05-13 20:46:19 +0000"; domain = CoreMediaErrorDomain; status = "-12642"; uri = "http://127.0.0.1:8080/master.m3u8"; }, { "c-conn-type" = 1; "c-severity" = 2; comment = "Playlist parse error"; "cs-guid" = "871C1871-D566-4A3A-8465-2C58FDC18A19"; date = "2024-05-13 20:46:19 +0000"; domain = CoreMediaErrorDomain; status = "-12642"; uri = "http://127.0.0.1:8080/master.m3u8"; } )
1
0
415
May ’24
Airplay not working with Encrypted HLS m3u8 url using avplayer
Hi, I am using avplayer, want to stream airplay with my encrypted hls m3u8 url. I am sharing my code snippet. ` let contentUrl = URL(string: String(format:videoUrl)) let headers = ["token": token] let asset: AVURLAsset = AVURLAsset(url: contentUrl!, options["AVURLAssetHTTPHeaderFieldsKey": headers]) let playerItem: AVPlayerItem = AVPlayerItem(asset: asset) self.avPlayer?.replaceCurrentItem(with: playerItem) self.avPlayer?.play()` Airplay is not working on my tv when i start stream. My encrypted url won't work. Is there any way to stream airplay with encrypted url. Stuck here........
0
0
276
May ’24
How to play Encrypted HLS m3u8 url via Airplay using avplayer.
I have an avplayer with an encrypted m3u8 url and this is my code snippet let contentUrl = URL(string: String(format:videoUrl)) let headers = ["token": token] let asset: AVURLAsset = AVURLAsset(url: contentUrl!, options: ["AVURLAssetHTTPHeaderFieldsKey": headers]) let playerItem: AVPlayerItem = AVPlayerItem(asset: asset) self.avPlayer?.replaceCurrentItem(with: playerItem) self.avPlayer?.play() When i try to stream Airplay the content not displaying. Airplay is not working with an encrypted url. How can i stream? Is there any way.
0
0
271
May ’24
RealityView with FairPlay
I'm trying to implement the playback of an HLS content with FairPlay, and I want to insert it into a RealityView using a VideoMaterial of a sphere. When I use unencrypted HLS content everything works correctly, but when I use FairPlay it doesn't. To initialize FairPlay I am using the following in the view: let contentKeyDelegate = ContentKeySessionDelegate(licenseURL: licenseURL, certificateURL: certificateURL) // Create the Content Key Session using the FairPlay Streaming key system. let contentKeySession = AVContentKeySession(keySystem: .fairPlayStreaming) contentKeySession.setDelegate(contentKeyDelegate, queue: DispatchQueue.main) contentKeySession.addContentKeyRecipient(asset) Has anyone else encountered this problem? Note: I'm testing in Vision Pro directly because the simulator hasn't support for FairPlay.
2
0
369
May ’24
HLS+FairPlay stream playback sometimes fails with Safari on macOS when variants are not ordered by increasing bitrate
While setting up our premium video-on-demand workflow in AWS, using AWS MediaConvert and MediaPackager and licence delivery from drmToday we encountered an issue with HLS+FairPlay playback (only) in Safari on macOS. The issue is that sometimes (more than 50% on the same video) the videoplayer initialization fails (with simple event of type=”error” in onerror callback). We are using Shaka player in our web application, so we first assumed that this (random) issue could be due to Shaka. However, we also tested with direct playback via the player and we observed the same issue, with same frequency. Since we have some content for which this problem does not occur and other content when the problem occurs very frequently, we tried to understand what could explain this difference. We noticed that for assets where the problem never occurs the order of the video submanifest was increasing, whereas for assets where the problem occurs frequently the order is decreasing. To isolate the issue we created a standalone page for a 2-minute asset and we are able to demonstrate that on this asset, when the bitrates are in decreasing order the playback with Safari on macOS fails more than 50% of the time. Test page using tag: KO: https://ntg-test-public-scr.s3.eu-west-1.amazonaws.com/aws-video.html OK: https://ntg-test-public-scr.s3.eu-west-1.amazonaws.com/aws-video.html?ok=1 Test page using Shaka: KO: https://ntg-test-public-scr.s3.eu-west-1.amazonaws.com/aws-shaka.html OK: https://ntg-test-public-scr.s3.eu-west-1.amazonaws.com/aws-shaka.html?ok=1 Notes: the issue is only reproducible with Safari on macOS (not with Safari on iOS) same HLS content + FairPlay plays OK 100% on tvOS the issue is only reproducible for HLS content with FairPlay (OK if no DRM)
0
0
580
Apr ’24
shouldWaitForLoadingOfRequestedResource delegate method not getting called on TVOS app
I'm attempting to integrate DRM into the app. I've developed a prototype, but the delegate method shouldWaitForLoadingOfRequestedResource isn't being triggered on certain devices, although it functions correctly on others. Notably, it's invoked on Apple TV 4K (3rd generation) Wi-Fi (A2737) but not on Apple TV HD (A1625). Are there any specific configurations needed to ensure this method is invoked? let url = URL(string: RESOURCE_URL)! // Create the asset instance and the resource loader because we will be asked // for the license to playback DRM protected asset. let asset = AVURLAsset(url: url) let queue = DispatchQueue(label: CUSTOM_SERIAL_QUEUE_LABEL) asset.resourceLoader.setDelegate(self, queue: queue) // Create the player item and the player to play it back in. let playerItem = AVPlayerItem(asset: asset) let player = AVPlayer(playerItem: playerItem) // Create a new AVPlayerViewController and pass it a reference to the player. let controller = AVPlayerViewController() controller.player = player // Modally present the player and call the player's play() method when complete. present(controller, animated: true) { player.play() } } //Please note if your delegate method is not being called then you need to run on a REAL DEVICE func resourceLoader(_ resourceLoader: AVAssetResourceLoader, shouldWaitForLoadingOfRequestedResource loadingRequest: AVAssetResourceLoadingRequest) -> Bool { // Getting data for KSM server. Get the URL from tha manifest, we wil need it later as it // contains the assetId required for the license request. guard let url = loadingRequest.request.url else { print(#function, "Unable to read URL from loadingRequest") loadingRequest.finishLoading(with: NSError(domain: "", code: -1, userInfo: nil)) return false } // Link to your certificate on BuyDRM's side. // Use the commented section if you want to refer the certificate from your bundle i.e. Store Locally /* guard let certificateURL = Bundle.main.url(forResource: "certificate", withExtension: "der"), let certificateData = try? Data(contentsOf: certificateURL) else { print("failed...", #function, "Unable to read the certificate data.") loadingRequest.finishLoading(with: NSError(domain: "com.domain.error", code: -2, userInfo: nil)) return false } */ guard let certificateData = try? Data(contentsOf: URL(string: CERTIFICATE_URL)!) else { print(#function, "Unable to read the certificate data.") loadingRequest.finishLoading(with: NSError(domain: "", code: -2, userInfo: nil)) return false } // The assetId from the main/variant manifest - skd://***, the *** part. Get the SPC based on the // already collected data i.e. certificate and the assetId guard let contentId = url.host, let contentIdData = contentId.data(using: String.Encoding.utf8) else { loadingRequest.finishLoading(with: NSError(domain: "", code: -3, userInfo: nil)) print(#function, "Unable to read the SPC data.") return false } guard let spcData = try? loadingRequest.streamingContentKeyRequestData(forApp: certificateData, contentIdentifier: contentIdData, options: nil) else { loadingRequest.finishLoading(with: NSError(domain: "", code: -3, userInfo: nil)) print(#function, "Unable to read the SPC data.") return false } // Prepare to get the license i.e. CKC. let requestUrl = CKC_URL let stringBody = "spc=\(spcData.base64EncodedString())&assetId=\(contentId)" let postData = NSData(data: stringBody.data(using: String.Encoding.utf8)!) // Make the POST request with customdata set to the authentication XML. var request = URLRequest(url: URL(string: requestUrl)!) request.httpMethod = "POST" request.httpBody = postData as Data request.allHTTPHeaderFields = ["customdata" : ACCESS_TOKEN] let configuration = URLSessionConfiguration.default let session = URLSession(configuration: configuration) let task = session.dataTask(with: request) { data, response, error in if let data = data { // The response from the KeyOS MultiKey License server may be an error inside JSON. do { let parsedData = try JSONSerialization.jsonObject(with: data) as! [String:Any] let errorId = parsedData["errorid"] as! String let errorMsg = parsedData["errormsg"] as! String print(#function, "License request failed with an error: \(errorMsg) [\(errorId)]") } catch let error as NSError { print(#function, "The response may be a license. Moving on.", error) } // The response from the KeyOS MultiKey License server is Base64 encoded. let dataRequest = loadingRequest.dataRequest! // This command sends the CKC to the player. dataRequest.respond(with: Data(base64Encoded: data)!) loadingRequest.finishLoading() } else { print(#function, error?.localizedDescription ?? "Error during CKC request.") } } task.resume() // Tell the AVPlayer instance to wait. We are working on getting what it wants. return true }
0
0
478
Mar ’24
Implementing FairPlayStreaming and getting error code -42671
Hi guys, I'm implementing FairPlay support for a video streaming application. I've managed to get as far as generating the SPC and acquiring a license from the license server. However when it comes to parsing the license (CKC) returned from the server, the FPS module returns error code -42671. Has anyone else faced this before and / or knows what the fix is? I thought passing it the license should be enough unless additional data is required?
0
0
488
Mar ’24
How to achieve license renewal case in safari based on ContentKeyDuration
Dear Apple Engineers, I have downloaded the FairPlay Streaming SDK 4.4 - In which i could able to make use of the fps_safari_hls_example.html file to make a successful playback of fairplay protected content in safari, by pointing our fairplay license server, .m3u8 file &amp; certificate. Now that, i'm trying to achieve the renewal concept, so i tried to use the fps_safari_hls_key_renewal.html file also setting up the ContentKeyDuration to 20sec in FP license server backend. But client didn't make any subsequent FP license request around when nearing 20th sec or post 20th sec. I wonder if this use case be achieved in safari, the only extra functionality i could see in renewal html file is below piece of code await runAndWaitForLicenseRequest(session, keyURI, () =&gt; { session.update(stringToUInt8Array("renew")) }); Based on the above piece, i assume that we are making sure that client to aware the when to renew the license. But in my case, there were no FP request is made , in-fact, this piece of code got executed immediate after the 1st FP license request call &amp; protected media continues to play despite setting the ContentKeyDuration to 20sec with LIMITED as contentkeyType . Could you please suggest on how to achieve the subsequent renewal request from client based on the ContentKeyDuration send in the CKC response using this sample renewal html file..? Is there any tewaks to be made in html file, kindly suggest.
0
0
427
Mar ’24
verify_ckc no longer works
Hello there, I understand most components of the FairPlay Streaming Server SDK haven't been updated in about a decade, but the verify_ckc tool no longer works, and it's really helpful. It throws errors when trying to import the Crypto library...probably something to do with this whole Python 2 vs Python 3 thing. I don't know anything about Python or I'd try to fix it myself but...I'm just bringing this up in case anyone from the FairPlay team reads these things! Thx
0
0
387
Feb ’24
SK..R1 integrity bytes do not match the value in SKR1 Integrity tag
Hi I am trying to implement D Function in python. import hashlib from Crypto.Cipher import AES from Crypto.Hash import SHA from Crypto.Util.Padding import pad as padding from Crypto.PublicKey import RSA PRIME = 813416437 NB_RD = 16 def dfunction(R2, ASk): tmp = bytearray(20) pad = bytearray(64) MBlock = [0] * 14 P = PRIME if len(R2) >= 56: return -1 # kDRMSKDServerParamErr # Padding until a multiple of 56B pad[:len(R2)] = R2 pad[len(R2)] = 0x80 pad[len(R2) + 1:56] = [0] * (56 - len(R2) - 1) # Create 14 32b values for i in range(14): MBlock[i] = (pad[4 * i] << 24) ^ (pad[4 * i + 1] << 16) ^ (pad[4 * i + 2] << 8) ^ pad[4 * i + 3] # Reunify into 2 32 bits values #MBlock[0] += sum(MBlock[1:7]) #MBlock[1] = 0 #MBlock[1] += sum(MBlock[7:]) # Reunify into 2 32 bits values for i in range(1, 7): MBlock[0] += MBlock[i] MBlock[1] = 0 for i in range(7): MBlock[1] += MBlock[i + 7] # Apply the function (C_r) for i in range(2): for r in range(NB_RD): if MBlock[i] & 1: MBlock[i] >>= 1 else: MBlock[i] = (3 * MBlock[i] + 1) % P # Append to M for i in range(4): pad[56 + i] = (MBlock[0] >> (8 * i)) & 0xFF pad[60 + i] = (MBlock[1] >> (8 * i)) & 0xFF h = hashlib.sha1() h.update(pad) hh = h.digest()[:16] cipher = AES.new(ASk, AES.MODE_ECB) DASk = cipher.encrypt(padding(hh, AES.block_size)) return DASk Then, i am trying to match integrities and they does not match. I think there is an mistake in D Function implementation. Any clue whats wrong? Thank you
0
0
384
Feb ’24
FPS key-rotation: use-case
We are aiming to apply KeyRotation for FPS service for our content streaming service. It is not clear from the spécifications how "FairPlay Streaming Programming Guide.pdf" How to apply this feature and let the "FPS DRM key server KSM " send multiple-keys at a time in one licence :(CKC) in the key rotation moment. without using the Renting and Leasing key features. Note that we don't use Offline Playback capabilities for our streams.
2
0
439
Mar ’24