react-native-theoplayer 3.7.0 → 3.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.
Files changed (82) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/android/build.gradle +1 -1
  3. package/android/local/com/theoplayer/theoplayer-sdk-android/ads-wrapper/6.10.0/ads-wrapper-6.10.0.aar +0 -0
  4. package/android/local/com/theoplayer/theoplayer-sdk-android/ads-wrapper/{4.8.0/ads-wrapper-4.8.0.pom → 6.10.0/ads-wrapper-6.10.0.pom} +1 -1
  5. package/android/local/com/theoplayer/theoplayer-sdk-android/ads-wrapper/maven-metadata-local.xml +4 -4
  6. package/android/src/main/java/com/theoplayer/PlayerConfigAdapter.kt +4 -0
  7. package/android/src/main/java/com/theoplayer/ads/AdEventAdapter.kt +9 -4
  8. package/android/src/main/java/com/theoplayer/ads/AdsModule.kt +1 -1
  9. package/android/src/main/java/com/theoplayer/broadcast/EventBroadcastModule.kt +1 -1
  10. package/android/src/main/java/com/theoplayer/cache/CacheModule.kt +1 -1
  11. package/android/src/main/java/com/theoplayer/cast/CastModule.kt +1 -1
  12. package/android/src/main/java/com/theoplayer/drm/ContentProtectionModule.kt +1 -1
  13. package/android/src/main/java/com/theoplayer/player/PlayerModule.kt +1 -1
  14. package/ios/THEOplayerRCTBridge.m +6 -6
  15. package/ios/THEOplayerRCTPlayerAPI.swift +25 -25
  16. package/ios/ads/THEOplayerRCTAdsAPI.swift +17 -17
  17. package/ios/cache/THEOplayerRCTCacheAPI.swift +29 -29
  18. package/ios/casting/THEOplayerRCTCastAPI.swift +9 -9
  19. package/ios/contentprotection/THEOplayerRCTContentProtectionAPI.swift +22 -22
  20. package/ios/eventBroadcasting/THEOplayerRCTEventBroadcastAPI.swift +5 -5
  21. package/lib/commonjs/api/config/PlayerConfiguration.js.map +1 -1
  22. package/lib/commonjs/internal/adapter/THEOplayerAdapter.js +18 -17
  23. package/lib/commonjs/internal/adapter/THEOplayerAdapter.js.map +1 -1
  24. package/lib/commonjs/internal/adapter/abr/AbrAdapter.js +2 -1
  25. package/lib/commonjs/internal/adapter/abr/AbrAdapter.js.map +1 -1
  26. package/lib/commonjs/internal/adapter/ads/THEOplayerNativeAdsAdapter.js +7 -6
  27. package/lib/commonjs/internal/adapter/ads/THEOplayerNativeAdsAdapter.js.map +1 -1
  28. package/lib/commonjs/internal/adapter/ads/THEOplayerNativeGoogleDAI.js +5 -4
  29. package/lib/commonjs/internal/adapter/ads/THEOplayerNativeGoogleDAI.js.map +1 -1
  30. package/lib/commonjs/internal/adapter/broadcast/EventBroadcastAdapter.js +2 -1
  31. package/lib/commonjs/internal/adapter/broadcast/EventBroadcastAdapter.js.map +1 -1
  32. package/lib/commonjs/internal/adapter/cast/THEOplayerNativeAirplay.js +5 -4
  33. package/lib/commonjs/internal/adapter/cast/THEOplayerNativeAirplay.js.map +1 -1
  34. package/lib/commonjs/internal/adapter/cast/THEOplayerNativeChromecast.js +7 -6
  35. package/lib/commonjs/internal/adapter/cast/THEOplayerNativeChromecast.js.map +1 -1
  36. package/lib/commonjs/internal/adapter/track/TextTrackStyleAdapter.js +11 -10
  37. package/lib/commonjs/internal/adapter/track/TextTrackStyleAdapter.js.map +1 -1
  38. package/lib/commonjs/internal/cache/MediaCache.js +4 -3
  39. package/lib/commonjs/internal/cache/MediaCache.js.map +1 -1
  40. package/lib/commonjs/internal/cache/NativeCachingTaskAdapter.js +5 -4
  41. package/lib/commonjs/internal/cache/NativeCachingTaskAdapter.js.map +1 -1
  42. package/lib/commonjs/internal/drm/ContentProtectionRegistry.js +23 -22
  43. package/lib/commonjs/internal/drm/ContentProtectionRegistry.js.map +1 -1
  44. package/lib/module/api/config/PlayerConfiguration.js.map +1 -1
  45. package/lib/module/internal/adapter/THEOplayerAdapter.js +18 -17
  46. package/lib/module/internal/adapter/THEOplayerAdapter.js.map +1 -1
  47. package/lib/module/internal/adapter/abr/AbrAdapter.js +2 -1
  48. package/lib/module/internal/adapter/abr/AbrAdapter.js.map +1 -1
  49. package/lib/module/internal/adapter/ads/THEOplayerNativeAdsAdapter.js +7 -6
  50. package/lib/module/internal/adapter/ads/THEOplayerNativeAdsAdapter.js.map +1 -1
  51. package/lib/module/internal/adapter/ads/THEOplayerNativeGoogleDAI.js +5 -4
  52. package/lib/module/internal/adapter/ads/THEOplayerNativeGoogleDAI.js.map +1 -1
  53. package/lib/module/internal/adapter/broadcast/EventBroadcastAdapter.js +2 -1
  54. package/lib/module/internal/adapter/broadcast/EventBroadcastAdapter.js.map +1 -1
  55. package/lib/module/internal/adapter/cast/THEOplayerNativeAirplay.js +5 -4
  56. package/lib/module/internal/adapter/cast/THEOplayerNativeAirplay.js.map +1 -1
  57. package/lib/module/internal/adapter/cast/THEOplayerNativeChromecast.js +7 -6
  58. package/lib/module/internal/adapter/cast/THEOplayerNativeChromecast.js.map +1 -1
  59. package/lib/module/internal/adapter/track/TextTrackStyleAdapter.js +11 -10
  60. package/lib/module/internal/adapter/track/TextTrackStyleAdapter.js.map +1 -1
  61. package/lib/module/internal/cache/MediaCache.js +4 -3
  62. package/lib/module/internal/cache/MediaCache.js.map +1 -1
  63. package/lib/module/internal/cache/NativeCachingTaskAdapter.js +5 -4
  64. package/lib/module/internal/cache/NativeCachingTaskAdapter.js.map +1 -1
  65. package/lib/module/internal/drm/ContentProtectionRegistry.js +23 -22
  66. package/lib/module/internal/drm/ContentProtectionRegistry.js.map +1 -1
  67. package/lib/typescript/api/config/PlayerConfiguration.d.ts +10 -0
  68. package/package.json +1 -1
  69. package/react-native-theoplayer.podspec +15 -8
  70. package/src/api/config/PlayerConfiguration.ts +11 -0
  71. package/src/internal/adapter/THEOplayerAdapter.ts +19 -17
  72. package/src/internal/adapter/abr/AbrAdapter.ts +3 -1
  73. package/src/internal/adapter/ads/THEOplayerNativeAdsAdapter.ts +8 -6
  74. package/src/internal/adapter/ads/THEOplayerNativeGoogleDAI.ts +6 -4
  75. package/src/internal/adapter/broadcast/EventBroadcastAdapter.ts +3 -1
  76. package/src/internal/adapter/cast/THEOplayerNativeAirplay.ts +6 -4
  77. package/src/internal/adapter/cast/THEOplayerNativeChromecast.ts +8 -6
  78. package/src/internal/adapter/track/TextTrackStyleAdapter.ts +11 -10
  79. package/src/internal/cache/MediaCache.ts +5 -3
  80. package/src/internal/cache/NativeCachingTaskAdapter.ts +6 -4
  81. package/src/internal/drm/ContentProtectionRegistry.ts +24 -22
  82. package/android/local/com/theoplayer/theoplayer-sdk-android/ads-wrapper/4.8.0/ads-wrapper-4.8.0.aar +0 -0
@@ -22,19 +22,19 @@ let ERROR_MESSAGE_CACHE_API_UNSUPPORTED_FEATURE = "Cache API is not supported fo
22
22
  class THEOplayerRCTCacheAPI: RCTEventEmitter {
23
23
  // MARK: Cache Listeners
24
24
  private var cacheStatusListener: EventListener?
25
-
25
+
26
26
  // MARK: CacheTask listeners (attached dynamically to new tasks)
27
27
  private var taskStateChangeListeners: [String:EventListener] = [:] // key is CacheTask.id
28
28
  private var taskProgressListeners: [String:EventListener] = [:] // key is CacheTask.id
29
-
29
+
30
30
  override static func moduleName() -> String! {
31
- return "CacheModule"
31
+ return "THEORCTCacheModule"
32
32
  }
33
-
33
+
34
34
  override static func requiresMainQueueSetup() -> Bool {
35
35
  return false
36
36
  }
37
-
37
+
38
38
  override func supportedEvents() -> [String]! {
39
39
  return [
40
40
  "onCacheStatusChange",
@@ -44,18 +44,18 @@ class THEOplayerRCTCacheAPI: RCTEventEmitter {
44
44
  "onCachingTaskStatusChangeEvent"
45
45
  ]
46
46
  }
47
-
47
+
48
48
  override init() {
49
49
  super.init()
50
-
50
+
51
51
  // attach listeners
52
52
  self.attachCacheListeners()
53
53
  }
54
-
54
+
55
55
  deinit {
56
56
  self.detachCacheListeners()
57
57
  }
58
-
58
+
59
59
  // MARK: - attach/dettach cache Listeners
60
60
  private func attachCacheListeners() {
61
61
  #if os(iOS)
@@ -67,14 +67,14 @@ class THEOplayerRCTCacheAPI: RCTEventEmitter {
67
67
  ])
68
68
  }
69
69
  if DEBUG_CACHE_EVENTS { PrintUtils.printLog(logText: "[NATIVE] StateChange listener attached to THEOplayer.cache") }
70
-
70
+
71
71
  // Attach listeners to all task currently known to cache
72
72
  for cachingTask in THEOplayer.cache.tasks {
73
73
  self.attachTaskListenersToTask(cachingTask)
74
74
  }
75
75
  #endif
76
76
  }
77
-
77
+
78
78
  private func detachCacheListeners() {
79
79
  #if os(iOS)
80
80
  // STATE_CHANGE
@@ -84,7 +84,7 @@ class THEOplayerRCTCacheAPI: RCTEventEmitter {
84
84
  }
85
85
  #endif
86
86
  }
87
-
87
+
88
88
  #if os(iOS)
89
89
  private func attachTaskListenersToTask(_ newTask: CachingTask) {
90
90
  // add STATE_CHANGE listeners to newly created task
@@ -94,7 +94,7 @@ class THEOplayerRCTCacheAPI: RCTEventEmitter {
94
94
  CACHETASK_PROP_ID: newTask.id,
95
95
  CACHE_EVENT_PROP_STATUS: THEOplayerRCTTypeUtils.cachingTaskStatusToString(newTask.status)
96
96
  ])
97
-
97
+
98
98
  if let errorEvent = event as? CachingTaskErrorStateChangeEvent,
99
99
  let error = errorEvent.error {
100
100
  if DEBUG_CACHE_EVENTS { PrintUtils.printLog(logText: "[NATIVE] STATE_CHANGE_ERROR event for task with id \(newTask.id): [error] \(error.code):\(error.category) - \(error.message)") }
@@ -103,7 +103,7 @@ class THEOplayerRCTCacheAPI: RCTEventEmitter {
103
103
  }
104
104
  }
105
105
  if DEBUG_CACHE_EVENTS { PrintUtils.printLog(logText: "[NATIVE] StateChange listener attached to task with id \(newTask.id).") }
106
-
106
+
107
107
  // add PROGRESS listeners to newly created task
108
108
  self.taskProgressListeners[newTask.id] = newTask.addEventListener(type: CachingTaskEventTypes.PROGRESS) { [weak self] event in
109
109
  if DEBUG_CACHE_EVENTS { PrintUtils.printLog(logText: "[NATIVE] Received PROGRESS event from task with id \(newTask.id): progress is \(newTask.percentageCached * 100.0)% of \(newTask.duration) sec.") }
@@ -114,7 +114,7 @@ class THEOplayerRCTCacheAPI: RCTEventEmitter {
114
114
  }
115
115
  if DEBUG_CACHE_EVENTS { PrintUtils.printLog(logText: "[NATIVE] Progress listener attached to task with id \(newTask.id).") }
116
116
  }
117
-
117
+
118
118
  private func detachTaskListenersFromTask(_ task: CachingTask) {
119
119
  // STATE_CHANGE
120
120
  if let taskStateChangeListener = self.taskStateChangeListeners[task.id] {
@@ -128,7 +128,7 @@ class THEOplayerRCTCacheAPI: RCTEventEmitter {
128
128
  }
129
129
  }
130
130
  #endif
131
-
131
+
132
132
  // MARK: API
133
133
 
134
134
  #if os(iOS)
@@ -139,7 +139,7 @@ class THEOplayerRCTCacheAPI: RCTEventEmitter {
139
139
  CACHE_EVENT_PROP_TASKS: THEOplayerRCTCacheAggregator.aggregateCacheTasks(tasks: THEOplayer.cache.tasks)
140
140
  ] as [String : Any])
141
141
  }
142
-
142
+
143
143
  @objc(createTask:params:)
144
144
  func createTask(_ src: NSDictionary, params: NSDictionary) -> Void {
145
145
  if DEBUG_CACHE_API { PrintUtils.printLog(logText: "[NATIVE] createTask triggered on Cache API.") }
@@ -148,17 +148,17 @@ class THEOplayerRCTCacheAPI: RCTEventEmitter {
148
148
  if let srcDescription = sourceDescription,
149
149
  let newTask = THEOplayer.cache.createTask(source: srcDescription, parameters: params) {
150
150
  if DEBUG_CACHE_API { PrintUtils.printLog(logText: "[NATIVE] New cache task created with id \(newTask.id)") }
151
-
151
+
152
152
  // emit onAddCachingTaskEvent
153
153
  self.sendEvent(withName: "onAddCachingTaskEvent", body: [
154
154
  CACHE_EVENT_PROP_TASK: THEOplayerRCTCacheAggregator.aggregateCacheTask(task: newTask)
155
155
  ])
156
-
156
+
157
157
  // attach the state and progress listeners to the new task
158
158
  self.attachTaskListenersToTask(newTask)
159
159
  }
160
160
  }
161
-
161
+
162
162
  @objc(startCachingTask:)
163
163
  func startCachingTask(_ id: NSString) -> Void {
164
164
  if DEBUG_CACHE_API { PrintUtils.printLog(logText: "[NATIVE] Start task triggered on Cache API for task with id \(id).") }
@@ -166,7 +166,7 @@ class THEOplayerRCTCacheAPI: RCTEventEmitter {
166
166
  task.start()
167
167
  }
168
168
  }
169
-
169
+
170
170
  @objc(pauseCachingTask:)
171
171
  func pauseCachingTask(_ id: NSString) -> Void {
172
172
  if DEBUG_CACHE_API { PrintUtils.printLog(logText: "[NATIVE] Pause task triggered on Cache API for task with id \(id).") }
@@ -174,7 +174,7 @@ class THEOplayerRCTCacheAPI: RCTEventEmitter {
174
174
  task.pause()
175
175
  }
176
176
  }
177
-
177
+
178
178
  @objc(removeCachingTask:)
179
179
  func removeCachingTask(_ id: NSString) -> Void {
180
180
  if DEBUG_CACHE_API { PrintUtils.printLog(logText: "[NATIVE] Remove task triggered on Cache API for task with id \(id).") }
@@ -185,7 +185,7 @@ class THEOplayerRCTCacheAPI: RCTEventEmitter {
185
185
  self.detachTaskListenersFromTask(task)
186
186
  }
187
187
  }
188
-
188
+
189
189
  @objc(renewLicense:drmConfig:)
190
190
  func renewLicense(_ id: NSString, drmConfig: NSDictionary) -> Void {
191
191
  if DEBUG_CACHE_API { PrintUtils.printLog(logText: "[NATIVE] Renew license triggered on Cache API for task with id \(id).") }
@@ -203,7 +203,7 @@ class THEOplayerRCTCacheAPI: RCTEventEmitter {
203
203
  }
204
204
  }
205
205
  }
206
-
206
+
207
207
  private func taskById(_ id: String) -> CachingTask? {
208
208
  return THEOplayer.cache.tasks.first {
209
209
  cachingTask in cachingTask.id == id
@@ -218,27 +218,27 @@ class THEOplayerRCTCacheAPI: RCTEventEmitter {
218
218
  CACHE_EVENT_PROP_TASKS: []
219
219
  ] as [String : Any])
220
220
  }
221
-
221
+
222
222
  @objc(createTask:params:)
223
223
  func createTask(_ src: NSDictionary, params: NSDictionary) -> Void {
224
224
  if DEBUG_CACHE_API { print(ERROR_MESSAGE_CACHE_API_UNSUPPORTED_FEATURE) }
225
225
  }
226
-
226
+
227
227
  @objc(startCachingTask:)
228
228
  func startCachingTask(_ id: NSString) -> Void {
229
229
  if DEBUG_CACHE_API { print(ERROR_MESSAGE_CACHE_API_UNSUPPORTED_FEATURE) }
230
230
  }
231
-
231
+
232
232
  @objc(pauseCachingTask:)
233
233
  func pauseCachingTask(_ id: NSString) -> Void {
234
234
  if DEBUG_CACHE_API { print(ERROR_MESSAGE_CACHE_API_UNSUPPORTED_FEATURE) }
235
235
  }
236
-
236
+
237
237
  @objc(removeCachingTask:)
238
238
  func removeCachingTask(_ id: NSString) -> Void {
239
239
  if DEBUG_CACHE_API { print(ERROR_MESSAGE_CACHE_API_UNSUPPORTED_FEATURE) }
240
240
  }
241
-
241
+
242
242
  @objc(renewLicense:drmConfig:)
243
243
  func renewLicense(_ id: NSString, drmConfig: NSDictionary) -> Void {
244
244
  if DEBUG_CACHE_API { print(ERROR_MESSAGE_CACHE_API_UNSUPPORTED_FEATURE) }
@@ -12,18 +12,18 @@ let ERROR_MESSAGE_CAST_ACCESS_FAILURE = "Could not access THEOplayer Cast Module
12
12
  @objc(THEOplayerRCTCastAPI)
13
13
  class THEOplayerRCTCastAPI: NSObject, RCTBridgeModule {
14
14
  @objc var bridge: RCTBridge!
15
-
15
+
16
16
  static func moduleName() -> String! {
17
- return "CastModule"
17
+ return "THEORCTCastModule"
18
18
  }
19
-
19
+
20
20
  static func requiresMainQueueSetup() -> Bool {
21
21
  return false
22
22
  }
23
-
23
+
24
24
  // MARK: CHROMECAST AND AIRPLAY
25
25
  #if os(iOS)
26
-
26
+
27
27
  @objc(casting:resolver:rejecter:)
28
28
  func casting(_ node: NSNumber, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) -> Void {
29
29
  DispatchQueue.main.async {
@@ -36,15 +36,15 @@ class THEOplayerRCTCastAPI: NSObject, RCTBridgeModule {
36
36
  }
37
37
  }
38
38
  }
39
-
39
+
40
40
  #else
41
-
41
+
42
42
  @objc(casting:resolver:rejecter:)
43
43
  func casting(_ node: NSNumber, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) -> Void {
44
44
  if DEBUG_CAST_API { print(ERROR_MESSAGE_CASTING_UNSUPPORTED_FEATURE) }
45
45
  resolve(false)
46
46
  }
47
-
47
+
48
48
  #endif
49
-
49
+
50
50
  }
@@ -18,7 +18,7 @@ let BRIDGE_REQUEST_TIMEOUT = 10.0
18
18
 
19
19
  @objc(THEOplayerRCTContentProtectionAPI)
20
20
  class THEOplayerRCTContentProtectionAPI: RCTEventEmitter {
21
-
21
+
22
22
  private var buildIntegrationCompletions: THEOplayerRCTSafeMap<String, (Bool) -> Void> = THEOplayerRCTSafeMap<String, (Bool) -> Void>() // [requestId : completion]
23
23
  private var certificateRequestCompletions: THEOplayerRCTSafeMap<String, (Data?, Error?) -> Void> = THEOplayerRCTSafeMap<String, (Data?, Error?) -> Void>() // [requestId : completion]
24
24
  private var certificateResponseCompletions: THEOplayerRCTSafeMap<String, (Data?, Error?) -> Void> = THEOplayerRCTSafeMap<String, (Data?, Error?) -> Void>() // [requestId : completion]
@@ -28,15 +28,15 @@ class THEOplayerRCTContentProtectionAPI: RCTEventEmitter {
28
28
  private var requestTimers: THEOplayerRCTSafeMap<String, Timer> = THEOplayerRCTSafeMap<String, Timer>() // [requestId : Timer]
29
29
  private var requestIntegrationIds: THEOplayerRCTSafeMap<String, String> = THEOplayerRCTSafeMap<String, String>() // [requestId : integrationId]
30
30
  private var requestKeySystemIds: THEOplayerRCTSafeMap<String, String> = THEOplayerRCTSafeMap<String, String>() // [requestId : keySystemId]
31
-
31
+
32
32
  override static func moduleName() -> String! {
33
- return "ContentProtectionModule"
33
+ return "THEORCTContentProtectionModule"
34
34
  }
35
-
35
+
36
36
  override static func requiresMainQueueSetup() -> Bool {
37
37
  return false
38
38
  }
39
-
39
+
40
40
  override func supportedEvents() -> [String]! {
41
41
  return ["onBuildIntegration",
42
42
  "onCertificateRequest",
@@ -46,14 +46,14 @@ class THEOplayerRCTContentProtectionAPI: RCTEventEmitter {
46
46
  "onExtractFairplayContentId"
47
47
  ]
48
48
  }
49
-
49
+
50
50
  private func invalidateRequestWithId(_ requestId: String) {
51
51
  if let timer = self.requestTimers[requestId] {
52
52
  timer.invalidate()
53
53
  _ = self.requestTimers.removeValue(forKey: requestId)
54
54
  }
55
55
  }
56
-
56
+
57
57
  // MARK: Module actions
58
58
  func handleBuildIntegration(integrationId: String, keySystemId: String, drmConfig: DRMConfiguration, completion: @escaping (Bool) -> Void) {
59
59
  if DEBUG_CONTENT_PROTECTION_API { print(CPI_TAG, "handleBuildIntegration.") }
@@ -70,7 +70,7 @@ class THEOplayerRCTContentProtectionAPI: RCTEventEmitter {
70
70
  _ = self.buildIntegrationCompletions.removeValue(forKey: requestId)
71
71
  })
72
72
  }
73
-
73
+
74
74
  func handleCertificateRequest(integrationId: String, keySystemId: String, certificateRequest: CertificateRequest, completion: @escaping (Data?, Error?) -> Void) {
75
75
  if DEBUG_CONTENT_PROTECTION_API { print(CPI_TAG, "handleCertificateRequest.") }
76
76
  let requestId = UUID().uuidString
@@ -90,7 +90,7 @@ class THEOplayerRCTContentProtectionAPI: RCTEventEmitter {
90
90
  _ = self.certificateRequestCompletions.removeValue(forKey: requestId)
91
91
  })
92
92
  }
93
-
93
+
94
94
  func handleCertificateResponse(integrationId: String, keySystemId: String, certificateResponse: CertificateResponse, completion: @escaping (Data?, Error?) -> Void) {
95
95
  if DEBUG_CONTENT_PROTECTION_API { print(CPI_TAG, "handleCertificateResponse.") }
96
96
  let requestId = UUID().uuidString
@@ -106,7 +106,7 @@ class THEOplayerRCTContentProtectionAPI: RCTEventEmitter {
106
106
  _ = self.certificateResponseCompletions.removeValue(forKey: requestId)
107
107
  })
108
108
  }
109
-
109
+
110
110
  func handleLicenseRequest(integrationId: String, keySystemId: String, licenseRequest: LicenseRequest, completion: @escaping (Data?, Error?) -> Void) {
111
111
  if DEBUG_CONTENT_PROTECTION_API { print(CPI_TAG, "handleLicenseRequest.") }
112
112
  let requestId = UUID().uuidString
@@ -126,7 +126,7 @@ class THEOplayerRCTContentProtectionAPI: RCTEventEmitter {
126
126
  _ = self.licenseRequestCompletions.removeValue(forKey: requestId)
127
127
  })
128
128
  }
129
-
129
+
130
130
  func handleLicenseResponse(integrationId: String, keySystemId: String, licenseResponse: LicenseResponse, completion: @escaping (Data?, Error?) -> Void) {
131
131
  if DEBUG_CONTENT_PROTECTION_API { print(CPI_TAG, "handleLicenseResponse.") }
132
132
  let requestId = UUID().uuidString
@@ -142,7 +142,7 @@ class THEOplayerRCTContentProtectionAPI: RCTEventEmitter {
142
142
  _ = self.licenseResponseCompletions.removeValue(forKey: requestId)
143
143
  })
144
144
  }
145
-
145
+
146
146
  func handleExtractFairplayContentId(integrationId: String, keySystemId: String, skdUrl: String, completion: @escaping (String, Error?) -> Void) {
147
147
  if DEBUG_CONTENT_PROTECTION_API { print(CPI_TAG, "handleExtractFairplayContentId.") }
148
148
  let requestId = UUID().uuidString
@@ -159,7 +159,7 @@ class THEOplayerRCTContentProtectionAPI: RCTEventEmitter {
159
159
  _ = self.extractFairplayCompletions.removeValue(forKey: requestId)
160
160
  })
161
161
  }
162
-
162
+
163
163
  // MARK: Incoming JS Notifications
164
164
  @objc(registerContentProtectionIntegration:keySystemId:)
165
165
  func registerContentProtectionIntegration(_ integrationId: String, keySystemId: String) -> Void {
@@ -178,7 +178,7 @@ class THEOplayerRCTContentProtectionAPI: RCTEventEmitter {
178
178
  if DEBUG_CONTENT_PROTECTION_API { print(CPI_TAG, "Prevented registering ContentProtectionIntegration for \(integrationId) - \(keySystemId)") }
179
179
  }
180
180
  }
181
-
181
+
182
182
  @objc(onBuildProcessed:)
183
183
  func onBuildProcessed(_ result: NSDictionary) -> Void {
184
184
  if DEBUG_CONTENT_PROTECTION_API { print(CPI_TAG, "onBuildProcessed.") }
@@ -191,7 +191,7 @@ class THEOplayerRCTContentProtectionAPI: RCTEventEmitter {
191
191
  print(CPI_TAG, "Failed to process buildIntegration result")
192
192
  }
193
193
  }
194
-
194
+
195
195
  @objc(onCertificateRequestProcessedAsRequest:)
196
196
  func onCertificateRequestProcessedAsRequest(_ result: NSDictionary) -> Void {
197
197
  if DEBUG_CONTENT_PROTECTION_API { print(CPI_TAG, "onCertificateRequestProcessedAsRequest.") }
@@ -228,7 +228,7 @@ class THEOplayerRCTContentProtectionAPI: RCTEventEmitter {
228
228
  print(CPI_TAG, "Failed to process certificate request as request")
229
229
  }
230
230
  }
231
-
231
+
232
232
  @objc(onCertificateRequestProcessedAsCertificate:)
233
233
  func onCertificateRequestProcessedAsCertificate(_ result: NSDictionary) -> Void {
234
234
  if DEBUG_CONTENT_PROTECTION_API { print(CPI_TAG, "onCertificateRequestProcessedAsCertificate.") }
@@ -244,7 +244,7 @@ class THEOplayerRCTContentProtectionAPI: RCTEventEmitter {
244
244
  print(CPI_TAG, "Failed to process certificate request as certificate")
245
245
  }
246
246
  }
247
-
247
+
248
248
  @objc(onCertificateResponseProcessed:)
249
249
  func onCertificateResponseProcessed(_ result: NSDictionary) -> Void {
250
250
  if DEBUG_CONTENT_PROTECTION_API { print(CPI_TAG, "onCertificateResponseProcessed.") }
@@ -260,7 +260,7 @@ class THEOplayerRCTContentProtectionAPI: RCTEventEmitter {
260
260
  print(CPI_TAG, "Failed to process certificate response")
261
261
  }
262
262
  }
263
-
263
+
264
264
  @objc(onLicenseRequestProcessedAsRequest:)
265
265
  func onLicenseRequestProcessedAsRequest(_ result: NSDictionary) -> Void {
266
266
  if DEBUG_CONTENT_PROTECTION_API { print(CPI_TAG, "onLicenseRequestProcessedAsRequest.") }
@@ -297,7 +297,7 @@ class THEOplayerRCTContentProtectionAPI: RCTEventEmitter {
297
297
  print(CPI_TAG, "Failed to process license request as request")
298
298
  }
299
299
  }
300
-
300
+
301
301
  @objc(onLicenseRequestProcessedAsLicense:)
302
302
  func onLicenseRequestProcessedAsLicense(_ result: NSDictionary) -> Void {
303
303
  if DEBUG_CONTENT_PROTECTION_API { print(CPI_TAG, "onLicenseRequestProcessedAsLicense.") }
@@ -313,7 +313,7 @@ class THEOplayerRCTContentProtectionAPI: RCTEventEmitter {
313
313
  print(CPI_TAG, "Failed to process license request as license")
314
314
  }
315
315
  }
316
-
316
+
317
317
  @objc(onLicenseResponseProcessed:)
318
318
  func onLicenseResponseProcessed(_ result: NSDictionary) -> Void {
319
319
  if DEBUG_CONTENT_PROTECTION_API { print(CPI_TAG, "onLicenseResponseProcessed.") }
@@ -329,7 +329,7 @@ class THEOplayerRCTContentProtectionAPI: RCTEventEmitter {
329
329
  print(CPI_TAG, "Failed to process license response")
330
330
  }
331
331
  }
332
-
332
+
333
333
  @objc(onExtractFairplayContentIdProcessed:)
334
334
  func onExtractFairplayContentIdProcessed(_ result: NSDictionary) -> Void {
335
335
  if DEBUG_CONTENT_PROTECTION_API { print(CPI_TAG, "onExtractFairplayContentIdProcessed.") }
@@ -342,7 +342,7 @@ class THEOplayerRCTContentProtectionAPI: RCTEventEmitter {
342
342
  print(CPI_TAG, "Failed to process extracted contentId result")
343
343
  }
344
344
  }
345
-
345
+
346
346
  // MARK: Helpers
347
347
  private func keySystemFromString(_ keySystemIdString: String) -> THEOplayerSDK.KeySystemId {
348
348
  switch keySystemIdString.lowercased() {
@@ -12,16 +12,16 @@ protocol EventReceiver {
12
12
  @objc(THEOplayerRCTEventBroadcastAPI)
13
13
  class THEOplayerRCTBroadcastAPI: NSObject, RCTBridgeModule {
14
14
  @objc var bridge: RCTBridge!
15
-
16
-
15
+
16
+
17
17
  static func moduleName() -> String! {
18
- return "EventBroadcastModule"
18
+ return "THEORCTEventBroadcastModule"
19
19
  }
20
-
20
+
21
21
  static func requiresMainQueueSetup() -> Bool {
22
22
  return false
23
23
  }
24
-
24
+
25
25
  @objc(broadcastEvent:event:)
26
26
  func broadcastEvent(_ node: NSNumber, event: NSDictionary) -> Void {
27
27
  DispatchQueue.main.async {
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["PlayerConfiguration.ts"],"sourcesContent":["import type { AdsConfiguration } from '../ads/AdsConfiguration';\nimport type { CastConfiguration } from '../cast/CastConfiguration';\nimport type { MediaControlConfiguration } from '../media/MediaControlConfiguration';\nimport type { RetryConfiguration } from '../utils/RetryConfiguration';\nimport type { UIConfiguration } from '../ui/UIConfiguration';\n\nexport interface PlayerConfiguration {\n /**\n * The directory in which the THEOplayer library worker files are located.\n * These worker files are THEOplayer.transmux.*\n *\n * @remarks\n * <br/> - This parameter is required when using a HLS source and has no default.\n *\n * @example\n * `'/lib/theoplayer/'`\n */\n libraryLocation?: string;\n\n /**\n * The muted autoplay policy for web.\n *\n * @remarks\n * <br/> - The muted autoplay policy is impacted by this property and {@link SourceConfiguration.mutedAutoplay}.\n *\n * @defaultValue `'none'`.\n */\n mutedAutoplay?: MutedAutoplayConfiguration;\n\n /**\n * The ads configuration for the player.\n */\n ads?: AdsConfiguration;\n\n /**\n * The cast configuration for the player.\n */\n cast?: CastConfiguration;\n\n /**\n * The ui configuration for the underlying native player. Applies to Ad UI.\n */\n ui?: UIConfiguration;\n\n /**\n * The configuration of media controls and media sessions across platforms.\n */\n mediaControl?: MediaControlConfiguration;\n\n /**\n * The license for the player\n */\n readonly license?: string;\n\n /**\n * The url to fetch the license for the player\n */\n readonly licenseUrl?: string;\n\n /**\n * Sets whether the native player is chromeless (without UI).\n *\n * @remarks\n * <br/> - This parameter only applies to Web platforms.\n */\n readonly chromeless?: boolean;\n\n /**\n * Sets whether DateRange tags from the playlists should be imported as a textTrack.\n */\n readonly hlsDateRange?: boolean;\n\n /**\n * The retry configuration for the player.\n *\n * @remarks\n * <br/> - This parameter only applies to Web and Android platforms.\n */\n readonly retryConfiguration?: RetryConfiguration;\n}\n\n/**\n * The muted autoplay policy of a player for web.\n * <br/> - `'none'`: Disallow muted autoplay. If the player is requested to autoplay while unmuted, and the platform does not support unmuted autoplay, the player will not start playback.\n * <br/> - `'all'`: Allow muted autoplay. If the player is requested to autoplay while unmuted, and the platform supports muted autoplay, the player will start muted playback.\n * <br/> - `'content'`: Allow muted autoplay only for the main content. Disallow muted autoplay for e.g. advertisements. (Not yet supported.)\n *\n * @public\n */\nexport type MutedAutoplayConfiguration = 'none' | 'all' | 'content';\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["PlayerConfiguration.ts"],"sourcesContent":["import type { AdsConfiguration } from '../ads/AdsConfiguration';\nimport type { CastConfiguration } from '../cast/CastConfiguration';\nimport type { MediaControlConfiguration } from '../media/MediaControlConfiguration';\nimport type { RetryConfiguration } from '../utils/RetryConfiguration';\nimport type { UIConfiguration } from '../ui/UIConfiguration';\n\nexport interface PlayerConfiguration {\n /**\n * The directory in which the THEOplayer library worker files are located.\n * These worker files are THEOplayer.transmux.*\n *\n * @remarks\n * <br/> - This parameter is required when using a HLS source and has no default.\n *\n * @example\n * `'/lib/theoplayer/'`\n */\n libraryLocation?: string;\n\n /**\n * The muted autoplay policy for web.\n *\n * @remarks\n * <br/> - The muted autoplay policy is impacted by this property and {@link SourceConfiguration.mutedAutoplay}.\n *\n * @defaultValue `'none'`.\n */\n mutedAutoplay?: MutedAutoplayConfiguration;\n\n /**\n * The ads configuration for the player.\n */\n ads?: AdsConfiguration;\n\n /**\n * The cast configuration for the player.\n */\n cast?: CastConfiguration;\n\n /**\n * The ui configuration for the underlying native player. Applies to Ad UI.\n */\n ui?: UIConfiguration;\n\n /**\n * The configuration of media controls and media sessions across platforms.\n */\n mediaControl?: MediaControlConfiguration;\n\n /**\n * The license for the player\n */\n readonly license?: string;\n\n /**\n * The url to fetch the license for the player\n */\n readonly licenseUrl?: string;\n\n /**\n * Sets whether the native player is chromeless (without UI).\n *\n * @remarks\n * <br/> - This parameter only applies to Web platforms.\n */\n readonly chromeless?: boolean;\n\n /**\n * Sets whether DateRange tags from the playlists should be imported as a textTrack.\n */\n readonly hlsDateRange?: boolean;\n\n /**\n * The retry configuration for the player.\n *\n * @remarks\n * <br/> - This parameter only applies to Web and Android platforms.\n */\n readonly retryConfiguration?: RetryConfiguration;\n\n /**\n * The offset in seconds used to determine the live point.\n * This live point is the end of the manifest minus the provided offset.\n *\n * @defaultValue Three times the target duration of a segment, as specified by the manifest.\n *\n * @remarks\n * <br/> - This parameter only applies to Web and Android platforms.\n */\n liveOffset?: number;\n}\n\n/**\n * The muted autoplay policy of a player for web.\n * <br/> - `'none'`: Disallow muted autoplay. If the player is requested to autoplay while unmuted, and the platform does not support unmuted autoplay, the player will not start playback.\n * <br/> - `'all'`: Allow muted autoplay. If the player is requested to autoplay while unmuted, and the platform supports muted autoplay, the player will start muted playback.\n * <br/> - `'content'`: Allow muted autoplay only for the main content. Disallow muted autoplay for e.g. advertisements. (Not yet supported.)\n *\n * @public\n */\nexport type MutedAutoplayConfiguration = 'none' | 'all' | 'content';\n"],"mappings":""}
@@ -15,6 +15,7 @@ var _EventBroadcastAdapter = require("./broadcast/EventBroadcastAdapter");
15
15
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
16
16
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
17
17
  function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
18
+ const NativePlayerModule = _reactNative.NativeModules.THEORCTPlayerModule;
18
19
  const defaultPlayerState = {
19
20
  source: undefined,
20
21
  autoplay: false,
@@ -249,7 +250,7 @@ class THEOplayerAdapter extends _DefaultEventDispatcher.DefaultEventDispatcher {
249
250
  }
250
251
  set preload(type) {
251
252
  this._state.preload = type;
252
- _reactNative.NativeModules.PlayerModule.setPreload(this._view.nativeHandle, type);
253
+ NativePlayerModule.setPreload(this._view.nativeHandle, type);
253
254
  }
254
255
  get preload() {
255
256
  return this._state.preload;
@@ -284,7 +285,7 @@ class THEOplayerAdapter extends _DefaultEventDispatcher.DefaultEventDispatcher {
284
285
  seekTime = this.seekableEnd();
285
286
  }
286
287
  this._state.currentTime = seekTime;
287
- _reactNative.NativeModules.PlayerModule.setCurrentTime(this._view.nativeHandle, seekTime);
288
+ NativePlayerModule.setCurrentTime(this._view.nativeHandle, seekTime);
288
289
  }
289
290
  get duration() {
290
291
  return this._state.duration;
@@ -294,28 +295,28 @@ class THEOplayerAdapter extends _DefaultEventDispatcher.DefaultEventDispatcher {
294
295
  }
295
296
  set pipConfiguration(pipConfiguration) {
296
297
  this._state.pipConfig = pipConfiguration;
297
- _reactNative.NativeModules.PlayerModule.setPipConfig(this._view.nativeHandle, pipConfiguration);
298
+ NativePlayerModule.setPipConfig(this._view.nativeHandle, pipConfiguration);
298
299
  }
299
300
  get backgroundAudioConfiguration() {
300
301
  return this._state.backgroundAudioConfig;
301
302
  }
302
303
  set backgroundAudioConfiguration(backgroundAudioConfiguration) {
303
304
  this._state.backgroundAudioConfig = backgroundAudioConfiguration;
304
- _reactNative.NativeModules.PlayerModule.setBackgroundAudioConfig(this._view.nativeHandle, backgroundAudioConfiguration);
305
+ NativePlayerModule.setBackgroundAudioConfig(this._view.nativeHandle, backgroundAudioConfiguration);
305
306
  }
306
307
  get presentationMode() {
307
308
  return this._state.presentationMode;
308
309
  }
309
310
  set presentationMode(presentationMode) {
310
311
  this._state.presentationMode = presentationMode;
311
- _reactNative.NativeModules.PlayerModule.setPresentationMode(this._view.nativeHandle, presentationMode);
312
+ NativePlayerModule.setPresentationMode(this._view.nativeHandle, presentationMode);
312
313
  }
313
314
  get muted() {
314
315
  return this._state.muted;
315
316
  }
316
317
  set muted(muted) {
317
318
  this._state.muted = muted;
318
- _reactNative.NativeModules.PlayerModule.setMuted(this._view.nativeHandle, muted);
319
+ NativePlayerModule.setMuted(this._view.nativeHandle, muted);
319
320
  }
320
321
  get seeking() {
321
322
  return this._state.seeking;
@@ -328,7 +329,7 @@ class THEOplayerAdapter extends _DefaultEventDispatcher.DefaultEventDispatcher {
328
329
  }
329
330
  set playbackRate(playbackRate) {
330
331
  this._state.playbackRate = playbackRate;
331
- _reactNative.NativeModules.PlayerModule.setPlaybackRate(this._view.nativeHandle, playbackRate);
332
+ NativePlayerModule.setPlaybackRate(this._view.nativeHandle, playbackRate);
332
333
  }
333
334
  get audioTracks() {
334
335
  return this._state.audioTracks;
@@ -341,7 +342,7 @@ class THEOplayerAdapter extends _DefaultEventDispatcher.DefaultEventDispatcher {
341
342
  return;
342
343
  }
343
344
  this._state.selectedAudioTrack = trackUid;
344
- _reactNative.NativeModules.PlayerModule.setSelectedAudioTrack(this._view.nativeHandle, trackUid !== undefined ? trackUid : -1);
345
+ NativePlayerModule.setSelectedAudioTrack(this._view.nativeHandle, trackUid !== undefined ? trackUid : -1);
345
346
  }
346
347
  get videoTracks() {
347
348
  return this._state.videoTracks;
@@ -355,7 +356,7 @@ class THEOplayerAdapter extends _DefaultEventDispatcher.DefaultEventDispatcher {
355
356
  }
356
357
  this._state.selectedVideoTrack = trackUid;
357
358
  this._state.targetVideoQuality = undefined;
358
- _reactNative.NativeModules.PlayerModule.setSelectedVideoTrack(this._view.nativeHandle, trackUid !== undefined ? trackUid : -1);
359
+ NativePlayerModule.setSelectedVideoTrack(this._view.nativeHandle, trackUid !== undefined ? trackUid : -1);
359
360
  }
360
361
  get textTracks() {
361
362
  return this._state.textTracks;
@@ -375,7 +376,7 @@ class THEOplayerAdapter extends _DefaultEventDispatcher.DefaultEventDispatcher {
375
376
  track.mode = _reactNativeTheoplayer.TextTrackMode.disabled;
376
377
  }
377
378
  });
378
- _reactNative.NativeModules.PlayerModule.setSelectedTextTrack(this._view.nativeHandle, trackUid !== undefined ? trackUid : -1);
379
+ NativePlayerModule.setSelectedTextTrack(this._view.nativeHandle, trackUid !== undefined ? trackUid : -1);
379
380
  }
380
381
  get textTrackStyle() {
381
382
  return this._textTrackStyleAdapter;
@@ -387,7 +388,7 @@ class THEOplayerAdapter extends _DefaultEventDispatcher.DefaultEventDispatcher {
387
388
  // This is to correctly reset autoplay during a source change.
388
389
  this.pause();
389
390
  this._state.source = source;
390
- _reactNative.NativeModules.PlayerModule.setSource(this._view.nativeHandle, source);
391
+ NativePlayerModule.setSource(this._view.nativeHandle, source);
391
392
  // Reset state for play-out of new source
392
393
  Object.assign(this._state, {
393
394
  playbackRate: 1,
@@ -421,21 +422,21 @@ class THEOplayerAdapter extends _DefaultEventDispatcher.DefaultEventDispatcher {
421
422
  targetQuality: this._state.targetVideoQuality
422
423
  });
423
424
  }
424
- _reactNative.NativeModules.PlayerModule.setTargetVideoQuality(this._view.nativeHandle, this._state.targetVideoQuality);
425
+ NativePlayerModule.setTargetVideoQuality(this._view.nativeHandle, this._state.targetVideoQuality);
425
426
  }
426
427
  get volume() {
427
428
  return this._state.volume;
428
429
  }
429
430
  set volume(volume) {
430
431
  this._state.volume = volume;
431
- _reactNative.NativeModules.PlayerModule.setVolume(this._view.nativeHandle, volume);
432
+ NativePlayerModule.setVolume(this._view.nativeHandle, volume);
432
433
  }
433
434
  get aspectRatio() {
434
435
  return this._state.aspectRatio;
435
436
  }
436
437
  set aspectRatio(ratio) {
437
438
  this._state.aspectRatio = ratio;
438
- _reactNative.NativeModules.PlayerModule.setAspectRatio(this._view.nativeHandle, ratio);
439
+ NativePlayerModule.setAspectRatio(this._view.nativeHandle, ratio);
439
440
  }
440
441
  get keepScreenOn() {
441
442
  return this._state.keepScreenOn;
@@ -443,19 +444,19 @@ class THEOplayerAdapter extends _DefaultEventDispatcher.DefaultEventDispatcher {
443
444
  set keepScreenOn(value) {
444
445
  this._state.keepScreenOn = value;
445
446
  if (_reactNative.Platform.OS === 'android') {
446
- _reactNative.NativeModules.PlayerModule.setKeepScreenOn(this._view.nativeHandle, value);
447
+ NativePlayerModule.setKeepScreenOn(this._view.nativeHandle, value);
447
448
  }
448
449
  }
449
450
  pause() {
450
451
  if (this.hasValidSource()) {
451
452
  this._state.paused = true;
452
- _reactNative.NativeModules.PlayerModule.setPaused(this._view.nativeHandle, true);
453
+ NativePlayerModule.setPaused(this._view.nativeHandle, true);
453
454
  }
454
455
  }
455
456
  play() {
456
457
  if (this.hasValidSource()) {
457
458
  this._state.paused = false;
458
- _reactNative.NativeModules.PlayerModule.setPaused(this._view.nativeHandle, false);
459
+ NativePlayerModule.setPaused(this._view.nativeHandle, false);
459
460
  }
460
461
  }
461
462
  get version() {