Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/ios passing drm request errors #193

Merged
merged 5 commits into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.1.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Fixed

- Fixed an issue on iOS where the error was not forwarded to theoplayer if a drm request fails on the iOS bridge

## [2.12.0] - 23-09-04

### Added
Expand Down
4 changes: 3 additions & 1 deletion ios/THEOplayerRCTNetworkUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class THEOplayerRCTNetworkUtils: NSObject, URLSessionDataDelegate {
let task = self.defaultUrlSession.dataTask(with: request) { data, response, error in
if let error = error {
PrintUtils.printLog(logText: "request Error: \(error.localizedDescription)")
return
}
if let urlResponse = response as? HTTPURLResponse {
let statusCode = urlResponse.statusCode
Expand All @@ -44,7 +43,10 @@ class THEOplayerRCTNetworkUtils: NSObject, URLSessionDataDelegate {
}
}
completion?(data, statusCode, allHeaders, error)
} else {
completion?(data, -1, [:], error)
}

}
// start the task
task.resume()
Expand Down
4 changes: 4 additions & 0 deletions ios/contentprotection/THEOplayerRCTContentProtectionAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,10 @@ class THEOplayerRCTContentProtectionAPI: RCTEventEmitter {
THEOplayerRCTNetworkUtils.shared.requestFromUrl(url: url, method: method, body: bodyData, headers: headers) { data, statusCode, responseHeaders, error in
if let responseError = error {
print(CPI_TAG, "Certificate request failure: error = \(responseError.localizedDescription)")
completion(data, error)
} else if statusCode >= 400 {
PrintUtils.printLog(logText: "Certificate request failure: statusCode = \(statusCode)")
completion(data, nil)
} else {
if DEBUG_CONTENT_PROTECTION_API {print(CPI_TAG, "Certificate request success: statusCode = \(statusCode)") }
let certificateRequest = CertificateRequest(url: urlString, method: method, headers: headers, body: bodyData)
Expand Down Expand Up @@ -279,8 +281,10 @@ class THEOplayerRCTContentProtectionAPI: RCTEventEmitter {
THEOplayerRCTNetworkUtils.shared.requestFromUrl(url: url, method: method, body: bodyData, headers: headers) { data, statusCode, responseHeaders, error in
if let responseError = error {
print(CPI_TAG, "License request failure: error = \(responseError.localizedDescription)")
completion(data, error)
} else if statusCode >= 400 {
print(CPI_TAG, "License request failure: statusCode = \(statusCode)")
completion(data, nil)
} else {
if DEBUG_CONTENT_PROTECTION_API {print(CPI_TAG, "License request success: statusCode = \(statusCode)") }
let licenseRequest = LicenseRequest(url: urlString, method: method, headers: headers, body: bodyData, fairplaySkdUrl: nil, useCredentials: false)
Expand Down