I'm trying to integrate Bitmovin ios. But when I Instantiate the Player through "let config = PlayerConfiguration.fromJson("");" method there show an error "Type 'PlayerConfiguration' has no member 'fromJson'". Please anyone help me.
Asked
Active
Viewed 162 times
1 Answers
0
Yes! I found a solution.
I added following callbacks.
- fpsConfig.prepareCertificate
- fpsConfig.prepareLicense
- fpsConfig.prepareContentId
- fpsConfig.prepareMessage *
- Custom request headers can be set using:
- fpsConfig.certificateRequestHeaders
fpsConfig.licenseRequestHeaders
do { try config.setSourceItem(url: fairplayStreamUrl) // create drm configuration let fpsConfig = FairplayConfiguration(license: licenseUrl, certificateURL: certificateUrl) // Example of how certificate data can be prepared if custom modifications are needed fpsConfig.prepareCertificate = { (data: Data) -> Data in // Do something with the loaded certificate return data } fpsConfig.prepareMessage = { (spcData: Data, assetID: String) -> Data in return spcData } fpsConfig.licenseRequestHeaders = ["content-type": "application/octet-stream"] fpsConfig.prepareLicense = { (ckc: Data) -> Data in return ckc } fpsConfig.prepareContentId = { (contentId: String) -> String in let part1 = contentId.components(separatedBy: ";")[1] let part2 = part1.components(separatedBy: "?")[0] return part2 } config.sourceItem?.add(drmConfiguration: fpsConfig) // Create player based on player configuration let player = BitmovinPlayer(configuration: config) // Create player view and pass the player instance to it let playerView = BMPBitmovinPlayerView(player: player, frame: .zero) // Listen to player events player.add(listener: self) playerView.autoresizingMask = [.flexibleHeight, .flexibleWidth] playerView.frame = view.bounds view.addSubview(playerView) view.bringSubview(toFront: playerView) self.player = player } catch { print("Configuration error: \(error)") }

AMIT
- 906
- 1
- 8
- 20