react-native-theoplayer 11.7.0 → 11.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/android/build.gradle +2 -2
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
- package/android/gradlew +176 -110
- package/android/gradlew.bat +23 -18
- package/android/src/main/java/com/theoplayer/drm/ContentProtectionAdapter.kt +17 -5
- package/android/src/main/java/com/theoplayer/drm/ContentProtectionModule.kt +61 -7
- package/android/src/main/java/com/theoplayer/drm/ProxyContentProtectionIntegration.kt +12 -5
- package/android/src/main/java/com/theoplayer/drm/ProxyContentProtectionIntegrationFactory.kt +3 -1
- package/android/src/main/java/com/theoplayer/theolive/EndpointAdapter.kt +33 -0
- package/ios/contentprotection/THEOplayerRCTContentProtectionAPI.swift +39 -9
- package/ios/contentprotection/THEOplayerRCTContentProtectionAggregator.swift +15 -11
- package/ios/contentprotection/THEOplayerRCTProxyContentProtectionIntegration.swift +12 -7
- package/ios/theolive/THEOplayerRCTTHEOliveEventAdapter.swift +21 -0
- package/lib/commonjs/api/player/PlayerEventMap.js +1 -1
- package/lib/commonjs/internal/adapter/WebEventForwarder.js +61 -10
- package/lib/commonjs/internal/adapter/WebEventForwarder.js.map +1 -1
- package/lib/commonjs/internal/drm/ContentProtectionRegistry.js +38 -12
- package/lib/commonjs/internal/drm/ContentProtectionRegistry.js.map +1 -1
- package/lib/commonjs/manifest.json +1 -1
- package/lib/commonjs/plugins/typedoc-platform-icons/package-lock.json +200 -58
- package/lib/commonjs/plugins/typedoc-platform-icons/package.json +1 -1
- package/lib/commonjs/plugins/typedoc-platform-icons/tsconfig.json +2 -1
- package/lib/module/api/player/PlayerEventMap.js +1 -1
- package/lib/module/internal/adapter/WebEventForwarder.js +61 -10
- package/lib/module/internal/adapter/WebEventForwarder.js.map +1 -1
- package/lib/module/internal/drm/ContentProtectionRegistry.js +38 -12
- package/lib/module/internal/drm/ContentProtectionRegistry.js.map +1 -1
- package/lib/module/manifest.json +1 -1
- package/lib/module/plugins/typedoc-platform-icons/package-lock.json +200 -58
- package/lib/module/plugins/typedoc-platform-icons/package.json +1 -1
- package/lib/module/plugins/typedoc-platform-icons/tsconfig.json +2 -1
- package/lib/typescript/__tests__/ContentProtectionRegistry.test.d.ts +2 -0
- package/lib/typescript/__tests__/ContentProtectionRegistry.test.d.ts.map +1 -0
- package/lib/typescript/api/error/ChromecastError.d.ts +2 -2
- package/lib/typescript/api/player/PlayerEventMap.d.ts +1 -1
- package/lib/typescript/api/theoads/interstitial/Interstitial.d.ts +1 -1
- package/lib/typescript/api/theolive/TheoLiveEndpoint.d.ts +23 -5
- package/lib/typescript/api/theolive/TheoLiveEndpoint.d.ts.map +1 -1
- package/lib/typescript/api/theolive/WebrtcOptions.d.ts +1 -1
- package/lib/typescript/internal/adapter/WebEventForwarder.d.ts +3 -0
- package/lib/typescript/internal/adapter/WebEventForwarder.d.ts.map +1 -1
- package/lib/typescript/internal/adapter/web/PlayerFacadeAdsEvents.d.ts +2 -2
- package/lib/typescript/internal/adapter/web/PlayerFacadeAdsEvents.d.ts.map +1 -1
- package/lib/typescript/internal/drm/ContentProtectionRegistry.d.ts +3 -1
- package/lib/typescript/internal/drm/ContentProtectionRegistry.d.ts.map +1 -1
- package/lib/typescript/internal/drm/NativeContentProtectionEvent.d.ts +5 -0
- package/lib/typescript/internal/drm/NativeContentProtectionEvent.d.ts.map +1 -1
- package/package.json +5 -6
- package/react-native-theoplayer.podspec +6 -6
- package/src/__tests__/ContentProtectionRegistry.test.ts +239 -0
- package/src/api/error/ChromecastError.ts +2 -2
- package/src/api/player/PlayerEventMap.ts +1 -1
- package/src/api/theoads/interstitial/Interstitial.ts +1 -1
- package/src/api/theolive/TheoLiveEndpoint.ts +24 -5
- package/src/api/theolive/WebrtcOptions.ts +1 -1
- package/src/internal/adapter/WebEventForwarder.ts +69 -10
- package/src/internal/drm/ContentProtectionRegistry.ts +35 -17
- package/src/internal/drm/NativeContentProtectionEvent.ts +5 -0
- package/src/manifest.json +1 -1
- package/src/plugins/typedoc-platform-icons/package-lock.json +200 -58
- package/src/plugins/typedoc-platform-icons/package.json +1 -1
- package/src/plugins/typedoc-platform-icons/tsconfig.json +2 -1
- package/lib/typescript/plugins/expo/Common.d.ts +0 -13
- package/lib/typescript/plugins/expo/Common.d.ts.map +0 -1
- package/lib/typescript/plugins/expo/withCustomPod.d.ts +0 -2
- package/lib/typescript/plugins/expo/withCustomPod.d.ts.map +0 -1
- package/lib/typescript/plugins/expo/withTHEOplayer.d.ts +0 -4
- package/lib/typescript/plugins/expo/withTHEOplayer.d.ts.map +0 -1
- package/lib/typescript/plugins/expo/withTHEOplayerAndroid.d.ts +0 -4
- package/lib/typescript/plugins/expo/withTHEOplayerAndroid.d.ts.map +0 -1
- package/lib/typescript/plugins/expo/withTHEOplayerIOS.d.ts +0 -4
- package/lib/typescript/plugins/expo/withTHEOplayerIOS.d.ts.map +0 -1
- package/lib/typescript/plugins/typedoc-platform-icons/src/index.d.ts +0 -3
- package/lib/typescript/plugins/typedoc-platform-icons/src/index.d.ts.map +0 -1
|
@@ -14,6 +14,7 @@ import com.theoplayer.android.api.contentprotection.*
|
|
|
14
14
|
import com.theoplayer.android.api.error.ErrorCode
|
|
15
15
|
import com.theoplayer.android.api.error.THEOplayerException
|
|
16
16
|
import com.theoplayer.android.api.source.drm.DRMConfiguration
|
|
17
|
+
import java.lang.ref.WeakReference
|
|
17
18
|
|
|
18
19
|
data class BridgeRequest(
|
|
19
20
|
val onResult: HashMap<String, (result: ReadableMap) -> Unit>,
|
|
@@ -35,6 +36,7 @@ private const val EVENT_LICENSE_REQUEST_PROCESSED_AS_REQUEST = "onLicenseRequest
|
|
|
35
36
|
private const val EVENT_LICENSE_REQUEST_PROCESSED_AS_LICENSE = "onLicenseRequestProcessedAsLicense"
|
|
36
37
|
private const val EVENT_LICENSE_RESPONSE = "onLicenseResponse"
|
|
37
38
|
private const val EVENT_LICENSE_RESPONSE_PROCESSED = "onLicenseResponseProcessed"
|
|
39
|
+
private const val EVENT_INTEGRATION_DISPOSED = "onIntegrationDisposed"
|
|
38
40
|
|
|
39
41
|
@Suppress("unused")
|
|
40
42
|
@ReactModule(name = ContentProtectionModule.NAME)
|
|
@@ -52,6 +54,7 @@ class ContentProtectionModule(private val context: ReactApplicationContext) :
|
|
|
52
54
|
isTurboModule = false,
|
|
53
55
|
)
|
|
54
56
|
const val REQUEST_TIMEOUT_MS = 10000L
|
|
57
|
+
const val PRUNE_INTERVAL_MS = 30000L
|
|
55
58
|
}
|
|
56
59
|
|
|
57
60
|
private val handler = Handler(Looper.getMainLooper())
|
|
@@ -60,6 +63,47 @@ class ContentProtectionModule(private val context: ReactApplicationContext) :
|
|
|
60
63
|
|
|
61
64
|
private val requestQueue: HashMap<String, BridgeRequest> = HashMap()
|
|
62
65
|
|
|
66
|
+
// Weak references to every proxy integration instance built by the native SDK.
|
|
67
|
+
// The Android content protection API has no disposal callback, so instance
|
|
68
|
+
// cleanup is detected through garbage collection and reported to JavaScript.
|
|
69
|
+
private val integrationRefs: HashMap<String, WeakReference<ProxyContentProtectionIntegration>> = HashMap()
|
|
70
|
+
|
|
71
|
+
// Periodically reports collected proxy instances to JavaScript, so cleanup also
|
|
72
|
+
// happens when no further DRM events trigger it.
|
|
73
|
+
private val pruneRunnable = object : Runnable {
|
|
74
|
+
override fun run() {
|
|
75
|
+
pruneDisposedIntegrations()
|
|
76
|
+
if (integrationRefs.isNotEmpty()) {
|
|
77
|
+
handler.postDelayed(this, PRUNE_INTERVAL_MS)
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
fun trackIntegration(integration: ProxyContentProtectionIntegration) {
|
|
83
|
+
integrationRefs[integration.integrationInstanceId] = WeakReference(integration)
|
|
84
|
+
if (integrationRefs.size == 1) {
|
|
85
|
+
handler.postDelayed(pruneRunnable, PRUNE_INTERVAL_MS)
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
override fun invalidate() {
|
|
90
|
+
handler.removeCallbacks(pruneRunnable)
|
|
91
|
+
super.invalidate()
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
private fun pruneDisposedIntegrations() {
|
|
95
|
+
val disposed = integrationRefs.filterValues { it.get() == null }.keys
|
|
96
|
+
disposed.forEach { integrationInstanceId ->
|
|
97
|
+
integrationRefs.remove(integrationInstanceId)
|
|
98
|
+
context.getJSModule(RCTDeviceEventEmitter::class.java).emit(
|
|
99
|
+
EVENT_INTEGRATION_DISPOSED,
|
|
100
|
+
Arguments.createMap().apply {
|
|
101
|
+
putString(PROP_INTEGRATION_INSTANCE_ID, integrationInstanceId)
|
|
102
|
+
}
|
|
103
|
+
)
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
63
107
|
override fun getName(): String {
|
|
64
108
|
return NAME
|
|
65
109
|
}
|
|
@@ -117,8 +161,8 @@ class ContentProtectionModule(private val context: ReactApplicationContext) :
|
|
|
117
161
|
receive(EVENT_LICENSE_RESPONSE_PROCESSED, payload)
|
|
118
162
|
}
|
|
119
163
|
|
|
120
|
-
fun onBuild(integrationId: String, keySystemId: KeySystemId, config: DRMConfiguration?) {
|
|
121
|
-
val payload = createBridgeData(integrationId, keySystemId)
|
|
164
|
+
fun onBuild(integrationId: String, keySystemId: KeySystemId, integrationInstanceId: String, config: DRMConfiguration?) {
|
|
165
|
+
val payload = createBridgeData(integrationId, keySystemId, integrationInstanceId)
|
|
122
166
|
if (config != null) {
|
|
123
167
|
payload.putMap(PROP_DRM_CONFIG, ContentProtectionAdapter.fromDRMConfiguration(config))
|
|
124
168
|
}
|
|
@@ -132,10 +176,11 @@ class ContentProtectionModule(private val context: ReactApplicationContext) :
|
|
|
132
176
|
fun onCertificateRequest(
|
|
133
177
|
integrationId: String,
|
|
134
178
|
keySystemId: KeySystemId,
|
|
179
|
+
integrationInstanceId: String,
|
|
135
180
|
request: Request,
|
|
136
181
|
callback: CertificateRequestCallback
|
|
137
182
|
) {
|
|
138
|
-
val payload = ContentProtectionAdapter.fromRequest(integrationId, keySystemId, request)
|
|
183
|
+
val payload = ContentProtectionAdapter.fromRequest(integrationId, keySystemId, integrationInstanceId, request)
|
|
139
184
|
emit(
|
|
140
185
|
EVENT_CERTIFICATE_REQUEST, payload,
|
|
141
186
|
onResult = hashMapOf(
|
|
@@ -163,10 +208,11 @@ class ContentProtectionModule(private val context: ReactApplicationContext) :
|
|
|
163
208
|
fun onCertificateResponse(
|
|
164
209
|
integrationId: String,
|
|
165
210
|
keySystemId: KeySystemId,
|
|
211
|
+
integrationInstanceId: String,
|
|
166
212
|
response: Response,
|
|
167
213
|
callback: CertificateResponseCallback
|
|
168
214
|
) {
|
|
169
|
-
val payload = ContentProtectionAdapter.fromResponse(integrationId, keySystemId, response)
|
|
215
|
+
val payload = ContentProtectionAdapter.fromResponse(integrationId, keySystemId, integrationInstanceId, response)
|
|
170
216
|
emit(
|
|
171
217
|
EVENT_CERTIFICATE_RESPONSE, payload,
|
|
172
218
|
onResult = hashMapOf(
|
|
@@ -182,10 +228,11 @@ class ContentProtectionModule(private val context: ReactApplicationContext) :
|
|
|
182
228
|
fun onLicenseRequest(
|
|
183
229
|
integrationId: String,
|
|
184
230
|
keySystemId: KeySystemId,
|
|
231
|
+
integrationInstanceId: String,
|
|
185
232
|
request: Request,
|
|
186
233
|
callback: LicenseRequestCallback
|
|
187
234
|
) {
|
|
188
|
-
val payload = ContentProtectionAdapter.fromRequest(integrationId, keySystemId, request)
|
|
235
|
+
val payload = ContentProtectionAdapter.fromRequest(integrationId, keySystemId, integrationInstanceId, request)
|
|
189
236
|
emit(
|
|
190
237
|
EVENT_LICENSE_REQUEST, payload,
|
|
191
238
|
onResult = hashMapOf(
|
|
@@ -213,10 +260,11 @@ class ContentProtectionModule(private val context: ReactApplicationContext) :
|
|
|
213
260
|
fun onLicenseResponse(
|
|
214
261
|
integrationId: String,
|
|
215
262
|
keySystemId: KeySystemId,
|
|
263
|
+
integrationInstanceId: String,
|
|
216
264
|
response: Response,
|
|
217
265
|
callback: LicenseResponseCallback
|
|
218
266
|
) {
|
|
219
|
-
val payload = ContentProtectionAdapter.fromResponse(integrationId, keySystemId, response)
|
|
267
|
+
val payload = ContentProtectionAdapter.fromResponse(integrationId, keySystemId, integrationInstanceId, response)
|
|
220
268
|
emit(
|
|
221
269
|
EVENT_LICENSE_RESPONSE, payload,
|
|
222
270
|
onResult = hashMapOf(
|
|
@@ -246,6 +294,7 @@ class ContentProtectionModule(private val context: ReactApplicationContext) :
|
|
|
246
294
|
onResult: HashMap<String, (result: ReadableMap) -> Unit>,
|
|
247
295
|
onError: (error: THEOplayerException) -> Unit
|
|
248
296
|
) {
|
|
297
|
+
pruneDisposedIntegrations()
|
|
249
298
|
val requestId = createRequestId()
|
|
250
299
|
if (BuildConfig.DEBUG) {
|
|
251
300
|
Log.d(NAME, "emit $eventName ($requestId)")
|
|
@@ -289,9 +338,14 @@ class ContentProtectionModule(private val context: ReactApplicationContext) :
|
|
|
289
338
|
return (requestId++).toString()
|
|
290
339
|
}
|
|
291
340
|
|
|
292
|
-
private fun createBridgeData(
|
|
341
|
+
private fun createBridgeData(
|
|
342
|
+
integrationId: String,
|
|
343
|
+
keySystemId: KeySystemId,
|
|
344
|
+
integrationInstanceId: String
|
|
345
|
+
): WritableMap {
|
|
293
346
|
return Arguments.createMap().apply {
|
|
294
347
|
putString(PROP_INTEGRATION_ID, integrationId)
|
|
348
|
+
putString(PROP_INTEGRATION_INSTANCE_ID, integrationInstanceId)
|
|
295
349
|
putString(PROP_KEYSYSTEM_ID, KeySystemAdapter.toString(keySystemId))
|
|
296
350
|
}
|
|
297
351
|
}
|
|
@@ -2,6 +2,7 @@ package com.theoplayer.drm
|
|
|
2
2
|
|
|
3
3
|
import com.theoplayer.android.api.contentprotection.*
|
|
4
4
|
import com.theoplayer.android.api.source.drm.DRMConfiguration
|
|
5
|
+
import java.util.UUID
|
|
5
6
|
|
|
6
7
|
class ProxyContentProtectionIntegration(
|
|
7
8
|
private val integrationId: String,
|
|
@@ -10,23 +11,29 @@ class ProxyContentProtectionIntegration(
|
|
|
10
11
|
private val module: ContentProtectionModule
|
|
11
12
|
) : ContentProtectionIntegration() {
|
|
12
13
|
|
|
14
|
+
/**
|
|
15
|
+
* Unique identifier for this integration instance, shared with the JavaScript
|
|
16
|
+
* content protection registry to route callbacks to the matching integration.
|
|
17
|
+
*/
|
|
18
|
+
val integrationInstanceId: String = UUID.randomUUID().toString()
|
|
19
|
+
|
|
13
20
|
init {
|
|
14
|
-
module.onBuild(integrationId, keySystemId, config)
|
|
21
|
+
module.onBuild(integrationId, keySystemId, integrationInstanceId, config)
|
|
15
22
|
}
|
|
16
23
|
|
|
17
24
|
override fun onCertificateRequest(request: Request, callback: CertificateRequestCallback) {
|
|
18
|
-
module.onCertificateRequest(integrationId, keySystemId, request, callback)
|
|
25
|
+
module.onCertificateRequest(integrationId, keySystemId, integrationInstanceId, request, callback)
|
|
19
26
|
}
|
|
20
27
|
|
|
21
28
|
override fun onCertificateResponse(response: Response, callback: CertificateResponseCallback) {
|
|
22
|
-
module.onCertificateResponse(integrationId, keySystemId, response, callback)
|
|
29
|
+
module.onCertificateResponse(integrationId, keySystemId, integrationInstanceId, response, callback)
|
|
23
30
|
}
|
|
24
31
|
|
|
25
32
|
override fun onLicenseRequest(request: Request, callback: LicenseRequestCallback) {
|
|
26
|
-
module.onLicenseRequest(integrationId, keySystemId, request, callback)
|
|
33
|
+
module.onLicenseRequest(integrationId, keySystemId, integrationInstanceId, request, callback)
|
|
27
34
|
}
|
|
28
35
|
|
|
29
36
|
override fun onLicenseResponse(response: Response, callback: LicenseResponseCallback) {
|
|
30
|
-
module.onLicenseResponse(integrationId, keySystemId, response, callback)
|
|
37
|
+
module.onLicenseResponse(integrationId, keySystemId, integrationInstanceId, response, callback)
|
|
31
38
|
}
|
|
32
39
|
}
|
package/android/src/main/java/com/theoplayer/drm/ProxyContentProtectionIntegrationFactory.kt
CHANGED
|
@@ -12,6 +12,8 @@ class ProxyContentProtectionIntegrationFactory(
|
|
|
12
12
|
) : ContentProtectionIntegrationFactory {
|
|
13
13
|
|
|
14
14
|
override fun build(config: DRMConfiguration): ContentProtectionIntegration {
|
|
15
|
-
return ProxyContentProtectionIntegration(integrationId, keySystemId, config, module)
|
|
15
|
+
return ProxyContentProtectionIntegration(integrationId, keySystemId, config, module).also {
|
|
16
|
+
module.trackIntegration(it)
|
|
17
|
+
}
|
|
16
18
|
}
|
|
17
19
|
}
|
|
@@ -5,14 +5,25 @@ import com.facebook.react.bridge.WritableMap
|
|
|
5
5
|
import com.theoplayer.android.api.theolive.ContentProtectionConfiguration
|
|
6
6
|
import com.theoplayer.android.api.theolive.Endpoint
|
|
7
7
|
import com.theoplayer.android.api.theolive.EndpointMillicastSource
|
|
8
|
+
import com.theoplayer.android.api.theolive.EndpointSource
|
|
8
9
|
import com.theoplayer.android.api.theolive.FairPlayConfiguration
|
|
9
10
|
import com.theoplayer.android.api.theolive.KeySystemConfiguration
|
|
11
|
+
import com.theoplayer.android.api.theolive.PlayoutDelay
|
|
12
|
+
import com.theoplayer.android.api.theolive.WebRTCOptions
|
|
10
13
|
|
|
14
|
+
private const val PROP_SRC = "src"
|
|
15
|
+
private const val PROP_SRC_TYPE = "srcType"
|
|
16
|
+
private const val PROP_PROVIDER = "provider"
|
|
17
|
+
private const val PROP_AD_SYSTEM = "adSystem"
|
|
11
18
|
private const val PROP_MILLICAST_SRC = "millicastSrc"
|
|
12
19
|
private const val PROP_MILLICAST_NAME = "name"
|
|
13
20
|
private const val PROP_MILLICAST_ACCOUNTID = "accountId"
|
|
14
21
|
private const val PROP_MILLICAST_SUBSCRIBER_TOKEN ="subscriberToken"
|
|
15
22
|
private const val PROP_MILLICAST_DIRECTOR_URL = "directorUrl"
|
|
23
|
+
private const val PROP_MILLICAST_WEBRTC = "webrtc"
|
|
24
|
+
private const val PROP_PLAYOUT_DELAY_MS = "playoutDelayMs"
|
|
25
|
+
private const val PROP_PLAYOUT_DELAY_MINIMUM = "minimum"
|
|
26
|
+
private const val PROP_PLAYOUT_DELAY_MAXIMUM = "maximum"
|
|
16
27
|
private const val PROP_HESP_SRC = "hespSrc"
|
|
17
28
|
private const val PROP_HLS_SRC = "hlsSrc"
|
|
18
29
|
private const val PROP_HLS_MPEG_TS_SRC = "hlsMpegTsSrc"
|
|
@@ -32,12 +43,26 @@ private const val PROP_CERTIFICATE_URL = "certificateUrl"
|
|
|
32
43
|
|
|
33
44
|
object EndpointAdapter {
|
|
34
45
|
|
|
46
|
+
private fun fromPlayoutDelay(playoutDelay: PlayoutDelay): WritableMap {
|
|
47
|
+
return Arguments.createMap().apply {
|
|
48
|
+
putInt(PROP_PLAYOUT_DELAY_MINIMUM, playoutDelay.minimum)
|
|
49
|
+
putInt(PROP_PLAYOUT_DELAY_MAXIMUM, playoutDelay.maximum)
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
private fun fromWebrtcOptions(webrtc: WebRTCOptions): WritableMap {
|
|
54
|
+
return Arguments.createMap().apply {
|
|
55
|
+
webrtc.playoutDelayMs?.let { putMap(PROP_PLAYOUT_DELAY_MS, fromPlayoutDelay(it)) }
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
35
59
|
fun fromEndPointMillicastSource(millicastSource: EndpointMillicastSource): WritableMap {
|
|
36
60
|
return Arguments.createMap().apply {
|
|
37
61
|
putString(PROP_MILLICAST_NAME , millicastSource.name)
|
|
38
62
|
putString(PROP_MILLICAST_ACCOUNTID, millicastSource.accountId)
|
|
39
63
|
millicastSource.directorUrl?.let { putString(PROP_MILLICAST_DIRECTOR_URL, it) }
|
|
40
64
|
millicastSource.subscriberToken?.let { putString(PROP_MILLICAST_SUBSCRIBER_TOKEN, it) }
|
|
65
|
+
millicastSource.webrtc?.let { putMap(PROP_MILLICAST_WEBRTC, fromWebrtcOptions(it)) }
|
|
41
66
|
}
|
|
42
67
|
}
|
|
43
68
|
|
|
@@ -50,12 +75,20 @@ object EndpointAdapter {
|
|
|
50
75
|
endPoint.adSrc?.let { putString(PROP_AD_SRC, it) }
|
|
51
76
|
endPoint.daiAssetKey?.let { putString(PROP_DAI_ASSET_KEY, it) }
|
|
52
77
|
endPoint.cdn?.let { putString(PROP_CDN, it) }
|
|
78
|
+
endPoint.provider?.let { putString(PROP_PROVIDER, it) }
|
|
79
|
+
endPoint.adSystem?.let { putString(PROP_AD_SYSTEM, it) }
|
|
53
80
|
endPoint.targetLatency?.let { putDouble(PROP_TARGET_LATENCY, it) }
|
|
54
81
|
putInt(PROP_WEIGHT, endPoint.weight)
|
|
55
82
|
putInt(PROP_PRIORITY, endPoint.priority)
|
|
56
83
|
endPoint.contentProtection?.let {
|
|
57
84
|
putMap(PROP_CONTENT_PROTECTION, fromContentProtection(it))
|
|
58
85
|
}
|
|
86
|
+
when (val src = endPoint.src) {
|
|
87
|
+
is EndpointSource.Url -> putString(PROP_SRC, src.value)
|
|
88
|
+
is EndpointSource.Millicast -> putMap(PROP_SRC, fromEndPointMillicastSource(src.source))
|
|
89
|
+
null -> Unit
|
|
90
|
+
}
|
|
91
|
+
endPoint.srcType?.let { putString(PROP_SRC_TYPE, it) }
|
|
59
92
|
}
|
|
60
93
|
}
|
|
61
94
|
|
|
@@ -9,6 +9,7 @@ import THEOplayerSDK
|
|
|
9
9
|
|
|
10
10
|
let CPI_EVENT_PROP_REQUEST_ID: String = "requestId"
|
|
11
11
|
let CPI_EVENT_PROP_INTEGRATION_ID: String = "integrationId"
|
|
12
|
+
let CPI_EVENT_PROP_INTEGRATION_INSTANCE_ID: String = "integrationInstanceId"
|
|
12
13
|
let CPI_EVENT_PROP_KEYSYSTEM_ID: String = "keySystemId"
|
|
13
14
|
let CPI_EVENT_PROP_DRM_CONFIG: String = "drmConfig"
|
|
14
15
|
let CPI_EVENT_PROP_FAIRPLAY_SKD_URL: String = "fairplaySkdUrl"
|
|
@@ -28,6 +29,7 @@ class THEOplayerRCTContentProtectionAPI: RCTEventEmitter {
|
|
|
28
29
|
private var requestTimers: THEOplayerRCTSafeMap<String, Timer> = THEOplayerRCTSafeMap<String, Timer>() // [requestId : Timer]
|
|
29
30
|
private var requestIntegrationIds: THEOplayerRCTSafeMap<String, String> = THEOplayerRCTSafeMap<String, String>() // [requestId : integrationId]
|
|
30
31
|
private var requestKeySystemIds: THEOplayerRCTSafeMap<String, String> = THEOplayerRCTSafeMap<String, String>() // [requestId : keySystemId]
|
|
32
|
+
private var requestIntegrationInstanceIds: THEOplayerRCTSafeMap<String, String> = THEOplayerRCTSafeMap<String, String>() // [requestId : integrationInstanceId]
|
|
31
33
|
|
|
32
34
|
override static func moduleName() -> String! {
|
|
33
35
|
return "THEORCTContentProtectionModule"
|
|
@@ -43,7 +45,8 @@ class THEOplayerRCTContentProtectionAPI: RCTEventEmitter {
|
|
|
43
45
|
"onCertificateResponse",
|
|
44
46
|
"onLicenseRequest",
|
|
45
47
|
"onLicenseResponse",
|
|
46
|
-
"onExtractFairplayContentId"
|
|
48
|
+
"onExtractFairplayContentId",
|
|
49
|
+
"onIntegrationDisposed"
|
|
47
50
|
]
|
|
48
51
|
}
|
|
49
52
|
|
|
@@ -55,13 +58,14 @@ class THEOplayerRCTContentProtectionAPI: RCTEventEmitter {
|
|
|
55
58
|
}
|
|
56
59
|
|
|
57
60
|
// MARK: Module actions
|
|
58
|
-
func handleBuildIntegration(integrationId: String, keySystemId: String, drmConfig: DRMConfiguration, completion: @escaping (Bool) -> Void) {
|
|
61
|
+
func handleBuildIntegration(integrationId: String, keySystemId: String, integrationInstanceId: String, drmConfig: DRMConfiguration, completion: @escaping (Bool) -> Void) {
|
|
59
62
|
if DEBUG_CONTENT_PROTECTION_API { print(CPI_TAG, "handleBuildIntegration.") }
|
|
60
63
|
let requestId = UUID().uuidString
|
|
61
64
|
self.buildIntegrationCompletions[requestId] = completion
|
|
62
65
|
self.sendEvent(withName: "onBuildIntegration",
|
|
63
66
|
body: THEOplayerRCTContentProtectionAggregator.aggregateDrmConfiguration(integrationId: integrationId,
|
|
64
67
|
keySystemId: keySystemId,
|
|
68
|
+
integrationInstanceId: integrationInstanceId,
|
|
65
69
|
requestId: requestId,
|
|
66
70
|
drmConfig: drmConfig))
|
|
67
71
|
self.requestTimers[requestId] = Timer.scheduledTimer(withTimeInterval: BRIDGE_REQUEST_TIMEOUT, repeats: false, block: { t in
|
|
@@ -71,15 +75,17 @@ class THEOplayerRCTContentProtectionAPI: RCTEventEmitter {
|
|
|
71
75
|
})
|
|
72
76
|
}
|
|
73
77
|
|
|
74
|
-
func handleCertificateRequest(integrationId: String, keySystemId: String, certificateRequest: CertificateRequest, completion: @escaping (Data?, Error?) -> Void) {
|
|
78
|
+
func handleCertificateRequest(integrationId: String, keySystemId: String, integrationInstanceId: String, certificateRequest: CertificateRequest, completion: @escaping (Data?, Error?) -> Void) {
|
|
75
79
|
if DEBUG_CONTENT_PROTECTION_API { print(CPI_TAG, "handleCertificateRequest.") }
|
|
76
80
|
let requestId = UUID().uuidString
|
|
77
81
|
self.requestIntegrationIds[requestId] = integrationId
|
|
78
82
|
self.requestKeySystemIds[requestId] = keySystemId
|
|
83
|
+
self.requestIntegrationInstanceIds[requestId] = integrationInstanceId
|
|
79
84
|
self.certificateRequestCompletions[requestId] = completion
|
|
80
85
|
self.sendEvent(withName: "onCertificateRequest",
|
|
81
86
|
body: THEOplayerRCTContentProtectionAggregator.aggregateCertificateRequest(integrationId: integrationId,
|
|
82
87
|
keySystemId: keySystemId,
|
|
88
|
+
integrationInstanceId: integrationInstanceId,
|
|
83
89
|
requestId: requestId,
|
|
84
90
|
certificateRequest: certificateRequest))
|
|
85
91
|
self.requestTimers[requestId] = Timer.scheduledTimer(withTimeInterval: BRIDGE_REQUEST_TIMEOUT, repeats: false, block: { t in
|
|
@@ -87,17 +93,19 @@ class THEOplayerRCTContentProtectionAPI: RCTEventEmitter {
|
|
|
87
93
|
self.invalidateRequestWithId(requestId)
|
|
88
94
|
_ = self.requestIntegrationIds.removeValue(forKey: requestId)
|
|
89
95
|
_ = self.requestKeySystemIds.removeValue(forKey: requestId)
|
|
96
|
+
_ = self.requestIntegrationInstanceIds.removeValue(forKey: requestId)
|
|
90
97
|
_ = self.certificateRequestCompletions.removeValue(forKey: requestId)
|
|
91
98
|
})
|
|
92
99
|
}
|
|
93
100
|
|
|
94
|
-
func handleCertificateResponse(integrationId: String, keySystemId: String, certificateResponse: CertificateResponse, completion: @escaping (Data?, Error?) -> Void) {
|
|
101
|
+
func handleCertificateResponse(integrationId: String, keySystemId: String, integrationInstanceId: String, certificateResponse: CertificateResponse, completion: @escaping (Data?, Error?) -> Void) {
|
|
95
102
|
if DEBUG_CONTENT_PROTECTION_API { print(CPI_TAG, "handleCertificateResponse.") }
|
|
96
103
|
let requestId = UUID().uuidString
|
|
97
104
|
self.certificateResponseCompletions[requestId] = completion
|
|
98
105
|
self.sendEvent(withName: "onCertificateResponse",
|
|
99
106
|
body: THEOplayerRCTContentProtectionAggregator.aggregateCertificateResponse(integrationId: integrationId,
|
|
100
107
|
keySystemId: keySystemId,
|
|
108
|
+
integrationInstanceId: integrationInstanceId,
|
|
101
109
|
requestId: requestId,
|
|
102
110
|
certificateResponse: certificateResponse))
|
|
103
111
|
self.requestTimers[requestId] = Timer.scheduledTimer(withTimeInterval: BRIDGE_REQUEST_TIMEOUT, repeats: false, block: { t in
|
|
@@ -107,15 +115,17 @@ class THEOplayerRCTContentProtectionAPI: RCTEventEmitter {
|
|
|
107
115
|
})
|
|
108
116
|
}
|
|
109
117
|
|
|
110
|
-
func handleLicenseRequest(integrationId: String, keySystemId: String, licenseRequest: LicenseRequest, completion: @escaping (Data?, Error?) -> Void) {
|
|
118
|
+
func handleLicenseRequest(integrationId: String, keySystemId: String, integrationInstanceId: String, licenseRequest: LicenseRequest, completion: @escaping (Data?, Error?) -> Void) {
|
|
111
119
|
if DEBUG_CONTENT_PROTECTION_API { print(CPI_TAG, "handleLicenseRequest.") }
|
|
112
120
|
let requestId = UUID().uuidString
|
|
113
121
|
self.requestIntegrationIds[requestId] = integrationId
|
|
114
122
|
self.requestKeySystemIds[requestId] = keySystemId
|
|
123
|
+
self.requestIntegrationInstanceIds[requestId] = integrationInstanceId
|
|
115
124
|
self.licenseRequestCompletions[requestId] = completion
|
|
116
125
|
self.sendEvent(withName: "onLicenseRequest",
|
|
117
126
|
body: THEOplayerRCTContentProtectionAggregator.aggregateLicenseRequest(integrationId: integrationId,
|
|
118
127
|
keySystemId: keySystemId,
|
|
128
|
+
integrationInstanceId: integrationInstanceId,
|
|
119
129
|
requestId: requestId,
|
|
120
130
|
licenseRequest: licenseRequest))
|
|
121
131
|
self.requestTimers[requestId] = Timer.scheduledTimer(withTimeInterval: BRIDGE_REQUEST_TIMEOUT, repeats: false, block: { t in
|
|
@@ -123,17 +133,19 @@ class THEOplayerRCTContentProtectionAPI: RCTEventEmitter {
|
|
|
123
133
|
self.invalidateRequestWithId(requestId)
|
|
124
134
|
_ = self.requestIntegrationIds.removeValue(forKey: requestId)
|
|
125
135
|
_ = self.requestKeySystemIds.removeValue(forKey: requestId)
|
|
136
|
+
_ = self.requestIntegrationInstanceIds.removeValue(forKey: requestId)
|
|
126
137
|
_ = self.licenseRequestCompletions.removeValue(forKey: requestId)
|
|
127
138
|
})
|
|
128
139
|
}
|
|
129
140
|
|
|
130
|
-
func handleLicenseResponse(integrationId: String, keySystemId: String, licenseResponse: LicenseResponse, completion: @escaping (Data?, Error?) -> Void) {
|
|
141
|
+
func handleLicenseResponse(integrationId: String, keySystemId: String, integrationInstanceId: String, licenseResponse: LicenseResponse, completion: @escaping (Data?, Error?) -> Void) {
|
|
131
142
|
if DEBUG_CONTENT_PROTECTION_API { print(CPI_TAG, "handleLicenseResponse.") }
|
|
132
143
|
let requestId = UUID().uuidString
|
|
133
144
|
self.licenseResponseCompletions[requestId] = completion
|
|
134
145
|
self.sendEvent(withName: "onLicenseResponse",
|
|
135
146
|
body: THEOplayerRCTContentProtectionAggregator.aggregateLicenseResponse(integrationId: integrationId,
|
|
136
147
|
keySystemId: keySystemId,
|
|
148
|
+
integrationInstanceId: integrationInstanceId,
|
|
137
149
|
requestId: requestId,
|
|
138
150
|
licenseResponse: licenseResponse))
|
|
139
151
|
self.requestTimers[requestId] = Timer.scheduledTimer(withTimeInterval: BRIDGE_REQUEST_TIMEOUT, repeats: false, block: { t in
|
|
@@ -143,13 +155,14 @@ class THEOplayerRCTContentProtectionAPI: RCTEventEmitter {
|
|
|
143
155
|
})
|
|
144
156
|
}
|
|
145
157
|
|
|
146
|
-
func handleExtractFairplayContentId(integrationId: String, keySystemId: String, skdUrl: String, completion: @escaping (String, Error?) -> Void) {
|
|
158
|
+
func handleExtractFairplayContentId(integrationId: String, keySystemId: String, integrationInstanceId: String, skdUrl: String, completion: @escaping (String, Error?) -> Void) {
|
|
147
159
|
if DEBUG_CONTENT_PROTECTION_API { print(CPI_TAG, "handleExtractFairplayContentId.") }
|
|
148
160
|
let requestId = UUID().uuidString
|
|
149
161
|
self.extractFairplayCompletions[requestId] = completion
|
|
150
162
|
self.sendEvent(withName: "onExtractFairplayContentId", body: [
|
|
151
163
|
CPI_EVENT_PROP_INTEGRATION_ID: integrationId,
|
|
152
164
|
CPI_EVENT_PROP_KEYSYSTEM_ID: keySystemId,
|
|
165
|
+
CPI_EVENT_PROP_INTEGRATION_INSTANCE_ID: integrationInstanceId,
|
|
153
166
|
CPI_EVENT_PROP_REQUEST_ID: requestId,
|
|
154
167
|
CPI_EVENT_PROP_FAIRPLAY_SKD_URL: skdUrl
|
|
155
168
|
])
|
|
@@ -160,6 +173,15 @@ class THEOplayerRCTContentProtectionAPI: RCTEventEmitter {
|
|
|
160
173
|
})
|
|
161
174
|
}
|
|
162
175
|
|
|
176
|
+
func handleIntegrationDisposed(integrationId: String, keySystemId: String, integrationInstanceId: String) {
|
|
177
|
+
if DEBUG_CONTENT_PROTECTION_API { print(CPI_TAG, "handleIntegrationDisposed \(integrationInstanceId).") }
|
|
178
|
+
self.sendEvent(withName: "onIntegrationDisposed", body: [
|
|
179
|
+
CPI_EVENT_PROP_INTEGRATION_ID: integrationId,
|
|
180
|
+
CPI_EVENT_PROP_KEYSYSTEM_ID: keySystemId,
|
|
181
|
+
CPI_EVENT_PROP_INTEGRATION_INSTANCE_ID: integrationInstanceId
|
|
182
|
+
])
|
|
183
|
+
}
|
|
184
|
+
|
|
163
185
|
// MARK: Incoming JS Notifications
|
|
164
186
|
@objc(registerContentProtectionIntegration:keySystemId:)
|
|
165
187
|
func registerContentProtectionIntegration(_ integrationId: String, keySystemId: String) -> Void {
|
|
@@ -203,6 +225,7 @@ class THEOplayerRCTContentProtectionAPI: RCTEventEmitter {
|
|
|
203
225
|
let url = URL(string: urlString),
|
|
204
226
|
let method = result["method"] as? String,
|
|
205
227
|
let headers = result["headers"] as? [String:String] {
|
|
228
|
+
let integrationInstanceId = self.requestIntegrationInstanceIds.removeValue(forKey: requestId) ?? ""
|
|
206
229
|
var bodyData: Data?
|
|
207
230
|
if let base64body = result["base64body"] as? String {
|
|
208
231
|
bodyData = Data(base64Encoded: base64body, options: .ignoreUnknownCharacters)
|
|
@@ -219,7 +242,7 @@ class THEOplayerRCTContentProtectionAPI: RCTEventEmitter {
|
|
|
219
242
|
if DEBUG_CONTENT_PROTECTION_API {print(CPI_TAG, "Certificate request success: statusCode = \(statusCode)") }
|
|
220
243
|
let certificateRequest = CertificateRequest(url: urlString, method: method, headers: headers, body: bodyData)
|
|
221
244
|
let certificateResponse = CertificateResponse(certificateRequest: certificateRequest, url: urlString, status: statusCode, statusText: "", headers: responseHeaders, body: data ?? Data())
|
|
222
|
-
self.handleCertificateResponse(integrationId: integrationId, keySystemId: keySystemId, certificateResponse: certificateResponse) { data, error in
|
|
245
|
+
self.handleCertificateResponse(integrationId: integrationId, keySystemId: keySystemId, integrationInstanceId: integrationInstanceId, certificateResponse: certificateResponse) { data, error in
|
|
223
246
|
completion(data, error)
|
|
224
247
|
}
|
|
225
248
|
}
|
|
@@ -234,6 +257,9 @@ class THEOplayerRCTContentProtectionAPI: RCTEventEmitter {
|
|
|
234
257
|
if DEBUG_CONTENT_PROTECTION_API { print(CPI_TAG, "onCertificateRequestProcessedAsCertificate.") }
|
|
235
258
|
if let requestId = result["requestId"] as? String,
|
|
236
259
|
let completion = self.certificateRequestCompletions.removeValue(forKey: requestId) {
|
|
260
|
+
_ = self.requestIntegrationIds.removeValue(forKey: requestId)
|
|
261
|
+
_ = self.requestKeySystemIds.removeValue(forKey: requestId)
|
|
262
|
+
_ = self.requestIntegrationInstanceIds.removeValue(forKey: requestId)
|
|
237
263
|
var bodyData = Data()
|
|
238
264
|
if let base64body = result["base64body"] as? String {
|
|
239
265
|
bodyData = Data(base64Encoded: base64body, options: .ignoreUnknownCharacters) ?? Data()
|
|
@@ -272,6 +298,7 @@ class THEOplayerRCTContentProtectionAPI: RCTEventEmitter {
|
|
|
272
298
|
let url = URL(string: urlString),
|
|
273
299
|
let method = result["method"] as? String,
|
|
274
300
|
let headers = result["headers"] as? [String:String] {
|
|
301
|
+
let integrationInstanceId = self.requestIntegrationInstanceIds.removeValue(forKey: requestId) ?? ""
|
|
275
302
|
var bodyData: Data?
|
|
276
303
|
if let base64body = result["base64body"] as? String {
|
|
277
304
|
bodyData = Data(base64Encoded: base64body, options: .ignoreUnknownCharacters)
|
|
@@ -288,7 +315,7 @@ class THEOplayerRCTContentProtectionAPI: RCTEventEmitter {
|
|
|
288
315
|
if DEBUG_CONTENT_PROTECTION_API {print(CPI_TAG, "License request success: statusCode = \(statusCode)") }
|
|
289
316
|
let licenseRequest = LicenseRequest(url: urlString, method: method, headers: headers, body: bodyData, fairplaySkdUrl: nil, useCredentials: false)
|
|
290
317
|
let licenseResponse = LicenseResponse(licenseRequest: licenseRequest, url: urlString, status: statusCode, statusText: "", headers: responseHeaders, body: data ?? Data())
|
|
291
|
-
self.handleLicenseResponse(integrationId: integrationId, keySystemId: keySystemId, licenseResponse: licenseResponse) { data, error in
|
|
318
|
+
self.handleLicenseResponse(integrationId: integrationId, keySystemId: keySystemId, integrationInstanceId: integrationInstanceId, licenseResponse: licenseResponse) { data, error in
|
|
292
319
|
completion(data, error)
|
|
293
320
|
}
|
|
294
321
|
}
|
|
@@ -303,6 +330,9 @@ class THEOplayerRCTContentProtectionAPI: RCTEventEmitter {
|
|
|
303
330
|
if DEBUG_CONTENT_PROTECTION_API { print(CPI_TAG, "onLicenseRequestProcessedAsLicense.") }
|
|
304
331
|
if let requestId = result["requestId"] as? String,
|
|
305
332
|
let completion = self.licenseRequestCompletions.removeValue(forKey: requestId) {
|
|
333
|
+
_ = self.requestIntegrationIds.removeValue(forKey: requestId)
|
|
334
|
+
_ = self.requestKeySystemIds.removeValue(forKey: requestId)
|
|
335
|
+
_ = self.requestIntegrationInstanceIds.removeValue(forKey: requestId)
|
|
306
336
|
var bodyData = Data()
|
|
307
337
|
if let base64body = result["base64body"] as? String {
|
|
308
338
|
bodyData = Data(base64Encoded: base64body, options: .ignoreUnknownCharacters) ?? Data()
|
|
@@ -5,6 +5,7 @@ import THEOplayerSDK
|
|
|
5
5
|
|
|
6
6
|
let DRM_PROP_INTEGRATION: String = "integration"
|
|
7
7
|
let DRM_PROP_INTEGRATION_ID: String = "integrationId"
|
|
8
|
+
let DRM_PROP_INTEGRATION_INSTANCE_ID: String = "integrationInstanceId"
|
|
8
9
|
let DRM_PROP_REQUEST_ID: String = "requestId"
|
|
9
10
|
let DRM_PROP_KEYSYSTEM_ID: String = "keySystemId"
|
|
10
11
|
let DRM_PROP_DRM_CONFIG: String = "drmConfig"
|
|
@@ -27,8 +28,8 @@ let CPI_AGGREGATOR_TAG: String = "[ContentProtectionAggregator]"
|
|
|
27
28
|
|
|
28
29
|
class THEOplayerRCTContentProtectionAggregator {
|
|
29
30
|
|
|
30
|
-
class func aggregateDrmConfiguration(integrationId: String, keySystemId: String, requestId: String, drmConfig: THEOplayerSDK.DRMConfiguration) -> [String:Any] {
|
|
31
|
-
var aggregatedData: [String:Any] = THEOplayerRCTContentProtectionAggregator.bridgeData(integrationId: integrationId, keySystemId: keySystemId, requestId: requestId)
|
|
31
|
+
class func aggregateDrmConfiguration(integrationId: String, keySystemId: String, integrationInstanceId: String, requestId: String, drmConfig: THEOplayerSDK.DRMConfiguration) -> [String:Any] {
|
|
32
|
+
var aggregatedData: [String:Any] = THEOplayerRCTContentProtectionAggregator.bridgeData(integrationId: integrationId, keySystemId: keySystemId, integrationInstanceId: integrationInstanceId, requestId: requestId)
|
|
32
33
|
|
|
33
34
|
var aggregatedDrmConfig: [String:Any] = [:]
|
|
34
35
|
aggregatedDrmConfig[DRM_PROP_INTEGRATION] = drmConfig.customIntegrationId ?? "unknown"
|
|
@@ -51,8 +52,8 @@ class THEOplayerRCTContentProtectionAggregator {
|
|
|
51
52
|
return aggregatedData
|
|
52
53
|
}
|
|
53
54
|
|
|
54
|
-
class func aggregateCertificateRequest(integrationId: String, keySystemId: String, requestId: String, certificateRequest: THEOplayerSDK.Request) -> [String:Any] {
|
|
55
|
-
var aggregatedData: [String:Any] = THEOplayerRCTContentProtectionAggregator.bridgeData(integrationId: integrationId, keySystemId: keySystemId, requestId: requestId)
|
|
55
|
+
class func aggregateCertificateRequest(integrationId: String, keySystemId: String, integrationInstanceId: String, requestId: String, certificateRequest: THEOplayerSDK.Request) -> [String:Any] {
|
|
56
|
+
var aggregatedData: [String:Any] = THEOplayerRCTContentProtectionAggregator.bridgeData(integrationId: integrationId, keySystemId: keySystemId, integrationInstanceId: integrationInstanceId, requestId: requestId)
|
|
56
57
|
aggregatedData[DRM_PROP_URL] = certificateRequest.url
|
|
57
58
|
aggregatedData[DRM_PROP_METHOD] = certificateRequest.method
|
|
58
59
|
aggregatedData[DRM_PROP_HEADERS] = certificateRequest.headers
|
|
@@ -62,22 +63,23 @@ class THEOplayerRCTContentProtectionAggregator {
|
|
|
62
63
|
return aggregatedData
|
|
63
64
|
}
|
|
64
65
|
|
|
65
|
-
class func aggregateCertificateResponse(integrationId: String, keySystemId: String, requestId: String, certificateResponse: THEOplayerSDK.Response) -> [String:Any] {
|
|
66
|
-
var aggregatedData: [String:Any] = THEOplayerRCTContentProtectionAggregator.bridgeData(integrationId: integrationId, keySystemId: keySystemId, requestId: requestId)
|
|
66
|
+
class func aggregateCertificateResponse(integrationId: String, keySystemId: String, integrationInstanceId: String, requestId: String, certificateResponse: THEOplayerSDK.Response) -> [String:Any] {
|
|
67
|
+
var aggregatedData: [String:Any] = THEOplayerRCTContentProtectionAggregator.bridgeData(integrationId: integrationId, keySystemId: keySystemId, integrationInstanceId: integrationInstanceId, requestId: requestId)
|
|
67
68
|
aggregatedData[DRM_PROP_URL] = certificateResponse.url
|
|
68
69
|
aggregatedData[DRM_PROP_STATUS] = certificateResponse.status
|
|
69
70
|
aggregatedData[DRM_PROP_STATUS_TEXT] = certificateResponse.statusText
|
|
70
71
|
aggregatedData[DRM_PROP_HEADERS] = certificateResponse.headers
|
|
71
72
|
aggregatedData[DRM_PROP_REQUEST] = THEOplayerRCTContentProtectionAggregator.aggregateCertificateRequest(integrationId:integrationId,
|
|
72
73
|
keySystemId:keySystemId,
|
|
74
|
+
integrationInstanceId: integrationInstanceId,
|
|
73
75
|
requestId: requestId,
|
|
74
76
|
certificateRequest: certificateResponse.request)
|
|
75
77
|
aggregatedData[DRM_PROP_BASE64_BODY] = certificateResponse.body.base64EncodedString()
|
|
76
78
|
return aggregatedData
|
|
77
79
|
}
|
|
78
80
|
|
|
79
|
-
class func aggregateLicenseRequest(integrationId: String, keySystemId: String, requestId: String, licenseRequest: THEOplayerSDK.Request) -> [String:Any] {
|
|
80
|
-
var aggregatedData: [String:Any] = THEOplayerRCTContentProtectionAggregator.bridgeData(integrationId: integrationId, keySystemId: keySystemId, requestId: requestId)
|
|
81
|
+
class func aggregateLicenseRequest(integrationId: String, keySystemId: String, integrationInstanceId: String, requestId: String, licenseRequest: THEOplayerSDK.Request) -> [String:Any] {
|
|
82
|
+
var aggregatedData: [String:Any] = THEOplayerRCTContentProtectionAggregator.bridgeData(integrationId: integrationId, keySystemId: keySystemId, integrationInstanceId: integrationInstanceId, requestId: requestId)
|
|
81
83
|
aggregatedData[DRM_PROP_URL] = licenseRequest.url
|
|
82
84
|
aggregatedData[DRM_PROP_METHOD] = licenseRequest.method
|
|
83
85
|
aggregatedData[DRM_PROP_HEADERS] = licenseRequest.headers
|
|
@@ -88,24 +90,26 @@ class THEOplayerRCTContentProtectionAggregator {
|
|
|
88
90
|
return aggregatedData
|
|
89
91
|
}
|
|
90
92
|
|
|
91
|
-
class func aggregateLicenseResponse(integrationId: String, keySystemId: String, requestId: String, licenseResponse: THEOplayerSDK.Response) -> [String:Any] {
|
|
92
|
-
var aggregatedData: [String:Any] = THEOplayerRCTContentProtectionAggregator.bridgeData(integrationId: integrationId, keySystemId: keySystemId, requestId: requestId)
|
|
93
|
+
class func aggregateLicenseResponse(integrationId: String, keySystemId: String, integrationInstanceId: String, requestId: String, licenseResponse: THEOplayerSDK.Response) -> [String:Any] {
|
|
94
|
+
var aggregatedData: [String:Any] = THEOplayerRCTContentProtectionAggregator.bridgeData(integrationId: integrationId, keySystemId: keySystemId, integrationInstanceId: integrationInstanceId, requestId: requestId)
|
|
93
95
|
aggregatedData[DRM_PROP_URL] = licenseResponse.url
|
|
94
96
|
aggregatedData[DRM_PROP_STATUS] = licenseResponse.status
|
|
95
97
|
aggregatedData[DRM_PROP_STATUS_TEXT] = licenseResponse.statusText
|
|
96
98
|
aggregatedData[DRM_PROP_HEADERS] = licenseResponse.headers
|
|
97
99
|
aggregatedData[DRM_PROP_REQUEST] = THEOplayerRCTContentProtectionAggregator.aggregateLicenseRequest(integrationId:integrationId,
|
|
98
100
|
keySystemId:keySystemId,
|
|
101
|
+
integrationInstanceId: integrationInstanceId,
|
|
99
102
|
requestId: requestId,
|
|
100
103
|
licenseRequest: licenseResponse.request)
|
|
101
104
|
aggregatedData[DRM_PROP_BASE64_BODY] = licenseResponse.body.base64EncodedString()
|
|
102
105
|
return aggregatedData
|
|
103
106
|
}
|
|
104
107
|
|
|
105
|
-
private class func bridgeData(integrationId: String, keySystemId: String, requestId: String) -> [String:Any] {
|
|
108
|
+
private class func bridgeData(integrationId: String, keySystemId: String, integrationInstanceId: String, requestId: String) -> [String:Any] {
|
|
106
109
|
var aggregatedData: [String:Any] = [:]
|
|
107
110
|
aggregatedData[DRM_PROP_REQUEST_ID] = requestId
|
|
108
111
|
aggregatedData[DRM_PROP_INTEGRATION_ID] = integrationId
|
|
112
|
+
aggregatedData[DRM_PROP_INTEGRATION_INSTANCE_ID] = integrationInstanceId
|
|
109
113
|
aggregatedData[DRM_PROP_KEYSYSTEM_ID] = keySystemId
|
|
110
114
|
return aggregatedData
|
|
111
115
|
}
|