[object Object] Icon

Learn how to create, start, manage and modify Encodings

[object Object] Icon

Learn how to create, start, manage and modify Players

[object Object] Icon

Learn how to create, start, manage and modify Analyticss

Docs Home
User shortcuts for search
Focus by pressing f
Hide results by pressing Esc
Navigate via   keys

Fri Sep 06 2019

How to setup Bitmovin iOS SDK with DRMToday content

OverviewLink Icon

Nearly every DRM license provider does have customized DRM workflow in place, which is different to the default approach, especially when it comes to Fairplay DRM. In order to support those custom requirements, each Bitmovin native SDK does support the same customizable callbacks as the HTML5 player, so you can adjust the DRM requests to the needs of your DRM provider accordingly.

If you are not yet familiar with the Bitmovin SDK, please see the related blog post and have a look at the demo applications available in our iOS sample applications or Android sample applications repository.

iOS SDK using DRMToday/Castlabs (Swift, Fairplay DRM)Link Icon

This example is based on the "BasicDRMPlayback" which is available in its sample application repository.

1let fpsConfig = FairplayConfiguration(license: licenseUrl, certificateURL: certificateUrl)
3let userData = "{\"userId\":\"YOURUSERID\", \"sessionId\":\"YOURSESSIONID\", \"merchant\":\"YOURMERCHANTSTRING\"}"
4let data = (userData).data(using: String.Encoding.utf8)
5let base64 = data!.base64EncodedString(options: NSData.Base64EncodingOptions(rawValue: 0))
7fpsConfig.licenseRequestHeaders = ["x-dt-custom-data": base64]
9fpsConfig.prepareContentId = { (contentId: String) -> String in
10 let pattern="skd://drmtoday?"
11 //let contentId = contentId.substring(from: pattern.endIndex)
12 let contentId = String(contentId[pattern.endIndex...])
13 print("contentId: \(contentId)")
14 return contentId
17fpsConfig.prepareMessage = { (data: Data, contentId: String) -> Data in
18 let base64String = data.base64EncodedString()
19 let uriEncodedMessage = base64String.addingPercentEncoding(withAllowedCharacters: CharacterSet.alphanumerics)!
20 let message = "spc=\(uriEncodedMessage)&\(contentId)"
21 print("message: \(message.data(using: String.Encoding.utf8)!)")
22 return message.data(using: String.Encoding.utf8)!

Offline playback of DRMtoday protected contentLink Icon

To request a Fairplay license which allows offline playback, an ?offline=true parameter must be added to the Fairplay DRM license server URL:

Give us feedback