Closed franciscocarodiaz closed 4 years ago
What error are you seeing? You can still follow the basic tutorial, since Widevine support doesn't require much work. You just need to set license servers. If you need a license filter, you can look at that tutorial.
There is a guide to implement in Swift widevine + shaka player using a content with DRM? I'm getting an error and this is my configuration:
class PlayerViewController: BaseViewController, UIGestureRecognizerDelegate { var playerView: ShakaPlayerView? var player: ShakaPlayer?
}
extension PlayerViewController: ShakaPlayerClient { func onPlayer(_ player: ShakaPlayer, bufferingChange is_buffering: Bool) { if (is_buffering) { self.loadingIndicator.isHidden = false self.loadingIndicator.startAnimating() } else { self.loadingIndicator.isHidden = true self.loadingIndicator.stopAnimating() } }
}
extension PlayerViewController: ShakaPlayerNetworkFilter { func stringArrayToData(stringArray: [String]) -> Data? { return try? JSONSerialization.data(withJSONObject: stringArray, options: []) } func onPlayer(_ player: ShakaPlayer, networkRequest request: ShakaPlayerRequest, of type: ShakaPlayerRequestType, with block: @escaping ShakaPlayerAsyncBlock) { if (type == ShakaPlayerRequestType.license) { request.headers[Globals.PlayerKeys.KEY_ACCESS_TOKEN] = token request.headers[Globals.PlayerKeys.KEY_DEVICE_ID] = xtvupdevice request.headers[Globals.PlayerKeys.KEY_EVENTID] = eventId // This cert.bin is the widevine from widevine if let data: Data = getFile(forResource: "cert", withExtension: "bin") { request.body = data } } block(nil) } func onPlayer( player: ShakaPlayer, networkResponse response: ShakaPlayerResponse, of type: ShakaPlayerRequestType, with block: @escaping ShakaPlayerAsyncBlock) { block(nil) }
}