react-native-theoplayer 3.0.0-pre1 → 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,11 +5,22 @@ 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.0-pre1] - 23-10-05
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
+
14
+ ## [3.0.0] - 23-10-06
15
+
16
+ ### Fixed
17
+
18
+ - Fixed sourceDescription processing on iOS for offline playback.
9
19
 
10
20
  ### Changed
11
21
 
12
22
  - Added support for THEOplayer 6.0. See [THEOplayer's changelog](https://docs.theoplayer.com/changelog.md) for details.
23
+ - Bumped minimal version for SideloadedTextTracks connection on iOS to v6.1.1 which contains fix for iOS 17.0.
13
24
 
14
25
  ### Added
15
26
 
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([
@@ -134,9 +143,10 @@ class THEOplayerRCTCacheAPI: RCTEventEmitter {
134
143
  @objc(createTask:params:)
135
144
  func createTask(_ src: NSDictionary, params: NSDictionary) -> Void {
136
145
  if DEBUG_CACHE_API { PrintUtils.printLog(logText: "[NATIVE] createTask triggered on Cache API.") }
137
- let params = THEOplayerRCTCachingParametersBuilder.buildCachingParameters(params)
138
- if let srcDescription = THEOplayerRCTSourceDescriptionBuilder.buildSourceDescription(src),
139
- let newTask = THEOplayer.cache.createTask(source: srcDescription, parameters: params) {
146
+ let params = THEOplayerRCTCachingParametersBuilder.buildCachingParameters(params)
147
+ let (sourceDescription, _) = THEOplayerRCTSourceDescriptionBuilder.buildSourceDescription(src)
148
+ if let srcDescription = sourceDescription,
149
+ let newTask = THEOplayer.cache.createTask(source: srcDescription, parameters: params) {
140
150
  if DEBUG_CACHE_API { PrintUtils.printLog(logText: "[NATIVE] New cache task created with id \(newTask.id)") }
141
151
 
142
152
  // emit onAddCachingTaskEvent
@@ -199,4 +209,39 @@ class THEOplayerRCTCacheAPI: RCTEventEmitter {
199
209
  cachingTask in cachingTask.id == id
200
210
  }
201
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
202
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-pre1",
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",
@@ -47,7 +47,7 @@ Pod::Spec.new do |s|
47
47
  end
48
48
  if theofeatures.include?("SIDELOADED_TEXTTRACKS")
49
49
  puts "Adding THEOplayer-Connector-SideloadedSubtitle"
50
- s.dependency "THEOplayer-Connector-SideloadedSubtitle", "~> 6.0.1"
50
+ s.dependency "THEOplayer-Connector-SideloadedSubtitle", "~> 6.1", ">= 6.1.1"
51
51
  end
52
52
  end
53
53