react-native-theoplayer 3.0.0 → 3.0.1

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 CHANGED
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.1.0/)
6
6
  and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [3.0.1] - 23-10-12
9
+
10
+ ### Fixed
11
+
12
+ - Fixed compilation issues caused by Caching API not being supported on tvOS
13
+
8
14
  ## [3.0.0] - 23-10-06
9
15
 
10
16
  ### Fixed
package/README.md CHANGED
@@ -22,7 +22,7 @@ following platforms:
22
22
 
23
23
  - Android, Android TV & FireTV
24
24
  - iOS & tvOS (Apple TV)
25
- - Web (currently only HTML5 browsers are tested)
25
+ - HTML5, Tizen & webOS (web, mobile web, smart TVs, set-top boxes and gaming consoles).
26
26
 
27
27
  This document covers the creation of a minimal app including a `THEOplayerView` component,
28
28
  and an overview of the accompanying example app with a user interface provided
@@ -104,5 +104,5 @@ and discussed in the next section. Finally, an overview of features, limitations
104
104
  - [Media Caching](./doc/media_caching.md)
105
105
  - [Migrating to `react-native-theoplayer` v2.x](./doc/migrating_v2.md)
106
106
  - [Picture-in-Picture (PiP)](./doc/pip.md)
107
- - [Styling subtitles and closed captions](./doc/texttrackstyles.md)
108
- - [Limitations and known issues](./doc/limitations.md)
107
+ - [Subtitles, Closed Captions and Metadata tracks](./doc/texttracks.md)
108
+ - [Limitations and known issues](./doc/limitations.md)
@@ -4,6 +4,7 @@ import Foundation
4
4
  import THEOplayerSDK
5
5
  import UIKit
6
6
 
7
+ #if os(iOS)
7
8
  class THEOplayerRCTSourceDescriptionAggregator {
8
9
  class func aggregateCacheTaskSourceDescription(sourceDescription: SourceDescription) -> [String:Any]? {
9
10
  do {
@@ -39,3 +40,4 @@ class THEOplayerRCTSourceDescriptionAggregator {
39
40
  return output
40
41
  }
41
42
  }
43
+ #endif
@@ -99,6 +99,7 @@ class THEOplayerRCTTypeUtils {
99
99
  }
100
100
  }
101
101
 
102
+ #if os(iOS)
102
103
  class func cacheStatusToString(_ status: CacheStatus) -> String {
103
104
  switch status {
104
105
  case CacheStatus.initialised:
@@ -135,4 +136,5 @@ class THEOplayerRCTTypeUtils {
135
136
  return "notStarted"
136
137
  }
137
138
  }
139
+ #endif
138
140
  }
@@ -16,6 +16,8 @@ let CACHE_EVENT_PROP_TASKS: String = "tasks"
16
16
 
17
17
  let CACHE_TAG: String = "[CacheAPI]"
18
18
 
19
+ let ERROR_MESSAGE_CACHE_API_UNSUPPORTED_FEATURE = "Cache API is not supported for tvOS"
20
+
19
21
  @objc(THEOplayerRCTCacheAPI)
20
22
  class THEOplayerRCTCacheAPI: RCTEventEmitter {
21
23
  // MARK: Cache Listeners
@@ -56,6 +58,7 @@ class THEOplayerRCTCacheAPI: RCTEventEmitter {
56
58
 
57
59
  // MARK: - attach/dettach cache Listeners
58
60
  private func attachCacheListeners() {
61
+ #if os(iOS)
59
62
  // STATE_CHANGE
60
63
  self.cacheStatusListener = THEOplayer.cache.addEventListener(type: CacheEventTypes.STATE_CHANGE) { [weak self] event in
61
64
  if DEBUG_CACHE_EVENTS { PrintUtils.printLog(logText: "[NATIVE] Received STATE_CHANGE event from THEOplayer.cache") }
@@ -69,16 +72,20 @@ class THEOplayerRCTCacheAPI: RCTEventEmitter {
69
72
  for cachingTask in THEOplayer.cache.tasks {
70
73
  self.attachTaskListenersToTask(cachingTask)
71
74
  }
75
+ #endif
72
76
  }
73
77
 
74
78
  private func detachCacheListeners() {
79
+ #if os(iOS)
75
80
  // STATE_CHANGE
76
81
  if let cacheStatusListener = self.cacheStatusListener {
77
82
  THEOplayer.cache.removeEventListener(type: CacheEventTypes.STATE_CHANGE, listener: cacheStatusListener)
78
83
  if DEBUG_CACHE_EVENTS { PrintUtils.printLog(logText: "[NATIVE] StateChange listener dettached from THEOplayer.cache") }
79
84
  }
85
+ #endif
80
86
  }
81
87
 
88
+ #if os(iOS)
82
89
  private func attachTaskListenersToTask(_ newTask: CachingTask) {
83
90
  // add STATE_CHANGE listeners to newly created task
84
91
  self.taskStateChangeListeners[newTask.id] = newTask.addEventListener(type: CachingTaskEventTypes.STATE_CHANGE) { [weak self] event in
@@ -120,9 +127,11 @@ class THEOplayerRCTCacheAPI: RCTEventEmitter {
120
127
  if DEBUG_CACHE_EVENTS { PrintUtils.printLog(logText: "[NATIVE] Progress listener dettached from task with id \(task.id)") }
121
128
  }
122
129
  }
130
+ #endif
123
131
 
124
132
  // MARK: API
125
-
133
+
134
+ #if os(iOS)
126
135
  @objc(getInitialState:rejecter:)
127
136
  func getInitialState(_ resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) -> Void {
128
137
  resolve([
@@ -200,4 +209,39 @@ class THEOplayerRCTCacheAPI: RCTEventEmitter {
200
209
  cachingTask in cachingTask.id == id
201
210
  }
202
211
  }
212
+ #else
213
+ @objc(getInitialState:rejecter:)
214
+ func getInitialState(_ resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) -> Void {
215
+ if DEBUG_CACHE_API { print(ERROR_MESSAGE_CACHE_API_UNSUPPORTED_FEATURE) }
216
+ resolve([
217
+ CACHE_EVENT_PROP_STATUS: "uninitialised",
218
+ CACHE_EVENT_PROP_TASKS: []
219
+ ] as [String : Any])
220
+ }
221
+
222
+ @objc(createTask:params:)
223
+ func createTask(_ src: NSDictionary, params: NSDictionary) -> Void {
224
+ if DEBUG_CACHE_API { print(ERROR_MESSAGE_CACHE_API_UNSUPPORTED_FEATURE) }
225
+ }
226
+
227
+ @objc(startCachingTask:)
228
+ func startCachingTask(_ id: NSString) -> Void {
229
+ if DEBUG_CACHE_API { print(ERROR_MESSAGE_CACHE_API_UNSUPPORTED_FEATURE) }
230
+ }
231
+
232
+ @objc(pauseCachingTask:)
233
+ func pauseCachingTask(_ id: NSString) -> Void {
234
+ if DEBUG_CACHE_API { print(ERROR_MESSAGE_CACHE_API_UNSUPPORTED_FEATURE) }
235
+ }
236
+
237
+ @objc(removeCachingTask:)
238
+ func removeCachingTask(_ id: NSString) -> Void {
239
+ if DEBUG_CACHE_API { print(ERROR_MESSAGE_CACHE_API_UNSUPPORTED_FEATURE) }
240
+ }
241
+
242
+ @objc(renewLicense:drmConfig:)
243
+ func renewLicense(_ id: NSString, drmConfig: NSDictionary) -> Void {
244
+ if DEBUG_CACHE_API { print(ERROR_MESSAGE_CACHE_API_UNSUPPORTED_FEATURE) }
245
+ }
246
+ #endif
203
247
  }
@@ -25,6 +25,7 @@ let CACHETASK_PROP_PARAMETERS_TEXT_TRACK_SELECTION: String = "textTrackSelection
25
25
 
26
26
  let CACHE_AGGREGATOR_TAG: String = "[CacheAggregator]"
27
27
 
28
+ #if os(iOS)
28
29
  class THEOplayerRCTCacheAggregator {
29
30
 
30
31
  class func aggregateCacheTasks(tasks: [CachingTask]) -> [[String:Any]] {
@@ -85,3 +86,4 @@ class THEOplayerRCTCacheAggregator {
85
86
  return aggregatedData
86
87
  }
87
88
  }
89
+ #endif
@@ -4,6 +4,7 @@ import Foundation
4
4
  import THEOplayerSDK
5
5
  import UIKit
6
6
 
7
+ #if os(iOS)
7
8
  class THEOplayerRCTCachingParametersBuilder {
8
9
  static func buildCachingParameters(_ paramsData: NSDictionary) -> CachingParameters {
9
10
  var expirationDate: Date = Date(timeInterval: TimeInterval(30*60), since: Date()) // default expiration is after 30 minutes
@@ -25,3 +26,4 @@ class THEOplayerRCTCachingParametersBuilder {
25
26
  return builder.build()
26
27
  }
27
28
  }
29
+ #endif
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-theoplayer",
3
- "version": "3.0.0",
3
+ "version": "3.0.1",
4
4
  "description": "A THEOplayer video component for react-native.",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",