react-native-theoplayer 2.10.0 → 2.11.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 (36) hide show
  1. package/CHANGELOG.md +17 -1
  2. package/README.md +11 -9
  3. package/android/src/main/java/com/theoplayer/PlayerEventEmitter.kt +1 -1
  4. package/android/src/main/java/com/theoplayer/player/PlayerModule.kt +10 -0
  5. package/android/src/main/java/com/theoplayer/presentation/PipUtils.kt +16 -9
  6. package/android/src/main/java/com/theoplayer/track/TextTrackStyleAdapter.kt +79 -0
  7. package/android/src/main/java/com/theoplayer/util/ViewResolver.kt +6 -0
  8. package/ios/THEOplayerRCTBridge.m +3 -0
  9. package/ios/THEOplayerRCTPlayerAPI.swift +52 -0
  10. package/ios/THEOplayerRCTTypeUtils.swift +15 -0
  11. package/ios/ads/THEOplayerRCTAdsAPI+DAI.swift +1 -1
  12. package/ios/ads/THEOplayerRCTSourceDescriptionBuilder+Ads.swift +1 -1
  13. package/ios/ads/THEOplayerRCTView+AdsConfig.swift +1 -1
  14. package/ios/backgroundAudio/THEOplayerRCTNowPlayingManager.swift +3 -3
  15. package/lib/commonjs/api/track/TextTrackStyle.js +29 -0
  16. package/lib/commonjs/api/track/TextTrackStyle.js.map +1 -1
  17. package/lib/commonjs/internal/adapter/track/NamedColors.json +143 -0
  18. package/lib/commonjs/internal/adapter/track/TextTrackStyleAdapter.js +118 -22
  19. package/lib/commonjs/internal/adapter/track/TextTrackStyleAdapter.js.map +1 -1
  20. package/lib/commonjs/internal/adapter/web/WebMediaSession.js +1 -1
  21. package/lib/commonjs/internal/adapter/web/WebMediaSession.js.map +1 -1
  22. package/lib/module/api/track/TextTrackStyle.js +23 -0
  23. package/lib/module/api/track/TextTrackStyle.js.map +1 -1
  24. package/lib/module/internal/adapter/track/NamedColors.json +143 -0
  25. package/lib/module/internal/adapter/track/TextTrackStyleAdapter.js +117 -22
  26. package/lib/module/internal/adapter/track/TextTrackStyleAdapter.js.map +1 -1
  27. package/lib/module/internal/adapter/web/WebMediaSession.js +1 -1
  28. package/lib/module/internal/adapter/web/WebMediaSession.js.map +1 -1
  29. package/lib/typescript/api/track/TextTrackStyle.d.ts +43 -5
  30. package/lib/typescript/internal/adapter/track/TextTrackStyleAdapter.d.ts +26 -8
  31. package/package.json +1 -1
  32. package/react-native-theoplayer.podspec +1 -1
  33. package/src/api/track/TextTrackStyle.ts +45 -5
  34. package/src/internal/adapter/track/NamedColors.json +143 -0
  35. package/src/internal/adapter/track/TextTrackStyleAdapter.ts +132 -21
  36. package/src/internal/adapter/web/WebMediaSession.ts +1 -1
package/CHANGELOG.md CHANGED
@@ -2,9 +2,25 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
- The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
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
+ ## [2.11.0] - 23-08-10
9
+
10
+ ### Added
11
+
12
+ - Added DAI support through iOS Native pipeline, using new THEOplayerGoogleIMAIntegration functionality
13
+ - Added `TextTrackStyle` API for iOS and Android.
14
+
15
+ ### Fixed
16
+
17
+ - Fixed an issue on Android where the player would sometimes crash when requesting the current active video track.
18
+
19
+ ### Changed
20
+
21
+ - Switched to 'displayIconUri' in sourceDescription.metadata as primary field for artwork selection in NowplayingInfo/MediaSession, 'poster' in sourceDescription is now the fallback.
22
+ - Removed the play/pause icon in the PiP window on Android while playing an ad.
23
+
8
24
  ## [2.10.0] - 23-07-25
9
25
 
10
26
  ### Fixed
package/README.md CHANGED
@@ -55,14 +55,15 @@ React Native works to speed up the way of working with THEOplayer React Native S
55
55
  The `react-native-theoplayer` package can be combined with any number of connectors to provide extra
56
56
  functionality. Currently, the following connectors are available:
57
57
 
58
- | Package name | Purpose | Registry |
59
- |------------------------------------------------------------------------------------------------------------------|-------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------|
60
- | [`@theoplayer/react-native-analytics-adobe`](https://github.com/THEOplayer/react-native-theoplayer-analytics) | Adobe analytics connector | [![npm](https://img.shields.io/npm/v/@theoplayer/react-native-analytics-adobe)](https://www.npmjs.com/package/@theoplayer/react-native-analytics-adobe) |
61
- | [`@theoplayer/react-native-analytics-comscore`](https://github.com/THEOplayer/react-native-theoplayer-analytics) | Comscore analytics connector | [![npm](https://img.shields.io/npm/v/@theoplayer/react-native-analytics-comscore)](https://www.npmjs.com/package/@theoplayer/react-native-analytics-comscore) |
62
- | [`@theoplayer/react-native-analytics-conviva`](https://github.com/THEOplayer/react-native-theoplayer-analytics) | Conviva analytics connector | [![npm](https://img.shields.io/npm/v/@theoplayer/react-native-analytics-conviva)](https://www.npmjs.com/package/@theoplayer/react-native-analytics-conviva) |
63
- | [`@theoplayer/react-native-analytics-nielsen`](https://github.com/THEOplayer/react-native-theoplayer-analytics) | Nielsen analytics connector | [![npm](https://img.shields.io/npm/v/@theoplayer/react-native-analytics-nielsen)](https://www.npmjs.com/package/@theoplayer/react-native-analytics-nielsen) |
64
- | [`@theoplayer/react-native-drm`](https://github.com/THEOplayer/react-native-theoplayer-drm) | Content protection (DRM) connectors | [![npm](https://img.shields.io/npm/v/@theoplayer/react-native-drm)](https://www.npmjs.com/package/@theoplayer/react-native-drm) |
65
- | [`@theoplayer/react-native-ui`](https://github.com/THEOplayer/react-native-theoplayer-ui) | React Native user interface | [![npm](https://img.shields.io/npm/v/@theoplayer/react-native-ui)](https://www.npmjs.com/package/@theoplayer/react-native-ui) |
58
+ | Package name | Purpose | Registry |
59
+ |---------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------|
60
+ | [`@theoplayer/react-native-analytics-adobe`](https://github.com/THEOplayer/react-native-theoplayer-analytics) | Adobe analytics connector | [![npm](https://img.shields.io/npm/v/@theoplayer/react-native-analytics-adobe)](https://www.npmjs.com/package/@theoplayer/react-native-analytics-adobe) |
61
+ | [`@theoplayer/react-native-analytics-comscore`](https://github.com/THEOplayer/react-native-theoplayer-analytics) | Comscore analytics connector | [![npm](https://img.shields.io/npm/v/@theoplayer/react-native-analytics-comscore)](https://www.npmjs.com/package/@theoplayer/react-native-analytics-comscore) |
62
+ | [`@theoplayer/react-native-analytics-conviva`](https://github.com/THEOplayer/react-native-theoplayer-analytics) | Conviva analytics connector | [![npm](https://img.shields.io/npm/v/@theoplayer/react-native-analytics-conviva)](https://www.npmjs.com/package/@theoplayer/react-native-analytics-conviva) |
63
+ | [`@theoplayer/react-native-analytics-nielsen`](https://github.com/THEOplayer/react-native-theoplayer-analytics) | Nielsen analytics connector | [![npm](https://img.shields.io/npm/v/@theoplayer/react-native-analytics-nielsen)](https://www.npmjs.com/package/@theoplayer/react-native-analytics-nielsen) |
64
+ | [`@theoplayer/react-native-drm`](https://github.com/THEOplayer/react-native-theoplayer-drm) | Content protection (DRM) connectors | [![npm](https://img.shields.io/npm/v/@theoplayer/react-native-drm)](https://www.npmjs.com/package/@theoplayer/react-native-drm) |
65
+ | [`@theoplayer/react-native-ui`](https://github.com/THEOplayer/react-native-theoplayer-ui) | React Native user interface | [![npm](https://img.shields.io/npm/v/@theoplayer/react-native-ui)](https://www.npmjs.com/package/@theoplayer/react-native-ui) |
66
+ | [`@theoplayer/react-native-connector-template`](https://github.com/THEOplayer/react-native-theoplayer-connector-template) | A template for `react-native-theoplayer` connectors. | [![npm](https://img.shields.io/npm/v/@theoplayer/react-native-connector-template)](https://www.npmjs.com/package/@theoplayer/react-native-connector-template) |
66
67
 
67
68
  ## Getting Started
68
69
 
@@ -86,6 +87,7 @@ and discussed in the next section. Finally, an overview of features, limitations
86
87
  - [Casting with Chromecast and Airplay](./doc/cast.md)
87
88
  - [Custom iOS framework](./doc/custom-ios-framework.md)
88
89
  - [Digital Rights Management (DRM)](./doc/drm.md)
89
- - [Picture-in-Picture (PiP)](./doc/pip.md)
90
90
  - [Migrating to `react-native-theoplayer` v2.x](./doc/migrating_v2.md)
91
+ - [Picture-in-Picture (PiP)](./doc/pip.md)
92
+ - [Styling subtitles and closed captions](./doc/texttrackstyles.md)
91
93
  - [Limitations and known issues](./doc/limitations.md)
@@ -494,7 +494,7 @@ class PlayerEventEmitter internal constructor(
494
494
  }
495
495
 
496
496
  private fun <T : Quality?> activeTrack(tracks: MediaTrackList<T>?): MediaTrack<T>? {
497
- return tracks?.first { track ->
497
+ return tracks?.firstOrNull { track ->
498
498
  track.isEnabled
499
499
  }
500
500
  }
@@ -12,6 +12,7 @@ import com.theoplayer.android.api.player.track.texttrack.TextTrackMode
12
12
  import com.theoplayer.audio.BackgroundAudioConfigAdapter
13
13
  import com.theoplayer.presentation.PipConfigAdapter
14
14
  import com.theoplayer.track.QualityListFilter
15
+ import com.theoplayer.track.TextTrackStyleAdapter
15
16
  import com.theoplayer.track.emptyQualityList
16
17
  import com.theoplayer.util.ViewResolver
17
18
 
@@ -188,4 +189,13 @@ class PlayerModule(context: ReactApplicationContext) : ReactContextBaseJavaModul
188
189
  })
189
190
  }
190
191
  }
192
+
193
+ @ReactMethod
194
+ fun setTextTrackStyle(tag: Int, style: ReadableMap?) {
195
+ viewResolver.resolveViewByTag(tag) { view: ReactTHEOplayerView? ->
196
+ view?.player?.let { player ->
197
+ TextTrackStyleAdapter.applyTextTrackStyle(player.textTrackStyle, style)
198
+ }
199
+ }
200
+ }
191
201
  }
@@ -35,6 +35,7 @@ private const val ACTION_RWD = ACTION_PLAY + 2
35
35
  private const val ACTION_FFD = ACTION_PLAY + 3
36
36
  private const val ACTION_IGNORE = ACTION_PLAY + 999
37
37
  private const val SKIP_TIME = 15
38
+ private const val NO_ICON = -1
38
39
 
39
40
  private val PIP_ASPECT_RATIO_DEFAULT = Rational(16, 9)
40
41
  private val PIP_ASPECT_RATIO_MIN = Rational(100, 239)
@@ -125,21 +126,24 @@ class PipUtils(
125
126
  }
126
127
 
127
128
  // Play/pause
128
- // Always add this button, but send an ACTION_IGNORE if disabled.
129
+ // Always add this button, but send an ACTION_IGNORE and make invisible if disabled.
130
+ // If no RemoteActions are added, MediaSession takes over the UI.
129
131
  add(
130
132
  if (paused) {
131
133
  buildRemoteAction(
132
- if (enablePlayPause) ACTION_PLAY else ACTION_IGNORE,
134
+ ACTION_PLAY,
133
135
  R.drawable.ic_play,
134
136
  R.string.play_pip,
135
- R.string.play_desc_pip
137
+ R.string.play_desc_pip,
138
+ enablePlayPause
136
139
  )
137
140
  } else {
138
141
  buildRemoteAction(
139
- if (enablePlayPause) ACTION_PAUSE else ACTION_IGNORE,
142
+ ACTION_PAUSE,
140
143
  R.drawable.ic_pause,
141
144
  R.string.pause_pip,
142
- R.string.pause_desc_pip
145
+ R.string.pause_desc_pip,
146
+ enablePlayPause
143
147
  )
144
148
  }
145
149
  )
@@ -235,12 +239,15 @@ class PipUtils(
235
239
  requestId: Int,
236
240
  iconId: Int,
237
241
  titleId: Int,
238
- descId: Int
242
+ descId: Int,
243
+ enabled: Boolean = true
239
244
  ): RemoteAction {
240
- val intent = Intent(ACTION_MEDIA_CONTROL).putExtra(EXTRA_ACTION, requestId)
245
+ // Ignore the action if it is disabled
246
+ val requestCode = if (enabled) requestId else ACTION_IGNORE
247
+ val intent = Intent(ACTION_MEDIA_CONTROL).putExtra(EXTRA_ACTION, requestCode)
241
248
  val pendingIntent =
242
- PendingIntent.getBroadcast(reactContext, requestId, intent, PendingIntent.FLAG_IMMUTABLE)
243
- val icon: Icon = Icon.createWithResource(reactContext, iconId)
249
+ PendingIntent.getBroadcast(reactContext, requestCode, intent, PendingIntent.FLAG_IMMUTABLE)
250
+ val icon: Icon = Icon.createWithResource(reactContext, if (enabled) iconId else NO_ICON)
244
251
  val title = reactContext.getString(titleId)
245
252
  val desc = reactContext.getString(descId)
246
253
  return RemoteAction(icon, title, desc, pendingIntent)
@@ -0,0 +1,79 @@
1
+ package com.theoplayer.track
2
+
3
+ import android.graphics.Color
4
+ import com.facebook.react.bridge.ReadableMap
5
+ import com.theoplayer.android.api.player.track.texttrack.TextTrackStyle
6
+
7
+ private val PROP_BACKGROUND_COLOR = "backgroundColor"
8
+ private val PROP_EDGE_STYLE = "edgeStyle"
9
+ private val PROP_FONT_COLOR = "fontColor"
10
+ private val PROP_FONT_FAMILY = "fontFamily"
11
+ private val PROP_FONT_SIZE = "fontSize"
12
+ private val PROP_WINDOW_COLOR = "windowColor"
13
+ private val PROP_MARGIN_LEFT = "marginLeft"
14
+ private val PROP_MARGIN_TOP = "marginTop"
15
+ private val PROP_COLOR_R = "r"
16
+ private val PROP_COLOR_G = "g"
17
+ private val PROP_COLOR_B = "b"
18
+ private val PROP_COLOR_A = "a"
19
+
20
+ object TextTrackStyleAdapter {
21
+
22
+ fun applyTextTrackStyle(style: TextTrackStyle, props: ReadableMap?) {
23
+ if (props == null) {
24
+ return
25
+ }
26
+ if (props.hasKey(PROP_BACKGROUND_COLOR)) {
27
+ style.backgroundColor =
28
+ colorFromBridgeColor(props.getMap(PROP_BACKGROUND_COLOR)) ?: Color.BLACK
29
+ }
30
+ if (props.hasKey(PROP_EDGE_STYLE)) {
31
+ style.edgeType = edgeStyleFromProps(props.getString(PROP_EDGE_STYLE))
32
+ }
33
+ if (props.hasKey(PROP_FONT_COLOR)) {
34
+ style.fontColor = colorFromBridgeColor(props.getMap(PROP_FONT_COLOR)) ?: Color.WHITE
35
+ }
36
+ if (props.hasKey(PROP_FONT_FAMILY)) {
37
+ val family = props.getString(PROP_FONT_FAMILY)
38
+ if (family != null) {
39
+ style.setFont(family, TextTrackStyle.FontStyle.NORMAL)
40
+ } else {
41
+ style.setFont(TextTrackStyle.FontFamily.DEFAULT, TextTrackStyle.FontStyle.NORMAL)
42
+ }
43
+ }
44
+ if (props.hasKey(PROP_FONT_SIZE)) {
45
+ style.fontSize = props.getInt(PROP_FONT_SIZE)
46
+ }
47
+ if (props.hasKey(PROP_WINDOW_COLOR)) {
48
+ style.windowColor = colorFromBridgeColor(props.getMap(PROP_WINDOW_COLOR)) ?: Color.TRANSPARENT
49
+ }
50
+ if (props.hasKey(PROP_MARGIN_TOP)) {
51
+ style.marginTop = props.getInt(PROP_MARGIN_TOP)
52
+ }
53
+ if (props.hasKey(PROP_MARGIN_LEFT)) {
54
+ style.marginLeft = props.getInt(PROP_MARGIN_LEFT)
55
+ }
56
+ }
57
+
58
+ private fun edgeStyleFromProps(style: String?): TextTrackStyle.EdgeType {
59
+ return when (style) {
60
+ "dropshadow" -> TextTrackStyle.EdgeType.EDGE_TYPE_DROP_SHADOW
61
+ "raised" -> TextTrackStyle.EdgeType.EDGE_TYPE_RAISED
62
+ "depressed" -> TextTrackStyle.EdgeType.EDGE_TYPE_DEPRESSED
63
+ "uniform" -> TextTrackStyle.EdgeType.EDGE_TYPE_OUTLINE
64
+ else -> TextTrackStyle.EdgeType.EDGE_TYPE_NONE
65
+ }
66
+ }
67
+
68
+ private fun colorFromBridgeColor(color: ReadableMap?): Int? {
69
+ if (color == null) {
70
+ return null
71
+ }
72
+ return Color.argb(
73
+ color.getInt(PROP_COLOR_A),
74
+ color.getInt(PROP_COLOR_R),
75
+ color.getInt(PROP_COLOR_G),
76
+ color.getInt(PROP_COLOR_B),
77
+ )
78
+ }
79
+ }
@@ -6,11 +6,16 @@ import com.facebook.react.uimanager.UIManagerModule
6
6
  import com.theoplayer.ReactTHEOplayerView
7
7
 
8
8
  private const val TAG = "ViewResolver"
9
+ private const val INVALID_TAG = -1
9
10
 
10
11
  class ViewResolver(private val reactContext: ReactApplicationContext) {
11
12
  private var uiManager: UIManagerModule? = null
12
13
 
13
14
  fun resolveViewByTag(tag: Int, onResolved: (view: ReactTHEOplayerView?) -> Unit) {
15
+ if (tag == INVALID_TAG) {
16
+ // Don't bother trying to resolve an invalid tag.
17
+ onResolved(null)
18
+ }
14
19
  if (uiManager == null) {
15
20
  uiManager = reactContext.getNativeModule(UIManagerModule::class.java)
16
21
  }
@@ -20,6 +25,7 @@ class ViewResolver(private val reactContext: ReactApplicationContext) {
20
25
  } catch (ignore: Exception) {
21
26
  // The ReactTHEOplayerView instance could not be resolved: log but do not forward exception.
22
27
  Log.w(TAG, "Failed to resolve ReactTHEOplayerView tag $tag")
28
+ onResolved(null)
23
29
  }
24
30
  }
25
31
  }
@@ -108,6 +108,9 @@ RCT_EXTERN_METHOD(setTargetVideoQuality:(nonnull NSNumber *)node
108
108
  RCT_EXTERN_METHOD(setPreload:(nonnull NSNumber *)node
109
109
  type:(nonnull NSString *)type)
110
110
 
111
+ RCT_EXTERN_METHOD(setTextTrackStyle:(nonnull NSNumber *)node
112
+ textTrackStyle:(NSDictionary)textTrackStyle)
113
+
111
114
  @end
112
115
 
113
116
  // ----------------------------------------------------------------------------
@@ -10,6 +10,18 @@ let ERROR_MESSAGE_PLAYER_ABR_UNSUPPORTED_FEATURE: String = "Setting an ABRconfig
10
10
  let ERROR_MESSAGE_PLAYER_QUALITY_UNSUPPORTED_FEATURE: String = "Setting a target video quality is not supported on iOS/tvOS."
11
11
  let ERROR_MESSAGE_PLAYER_FULLSCREEN_UNSUPPORTED_FEATURE: String = "Fullscreen presentationmode should be implemented on the RN level for iOS/tvOS."
12
12
 
13
+ let TTS_PROP_BACKGROUND_COLOR = "backgroundColor"
14
+ let TTS_PROP_EDGE_STYLE = "edgeStyle"
15
+ let TTS_PROP_FONT_COLOR = "fontColor"
16
+ let TTS_PROP_FONT_FAMILY = "fontFamily"
17
+ let TTS_PROP_FONT_SIZE = "fontSize"
18
+ let TTS_PROP_MARGIN_LEFT = "marginLeft"
19
+ let TTS_PROP_MARGIN_TOP = "marginTop"
20
+ let TTS_PROP_COLOR_R = "r"
21
+ let TTS_PROP_COLOR_G = "g"
22
+ let TTS_PROP_COLOR_B = "b"
23
+ let TTS_PROP_COLOR_A = "a"
24
+
13
25
  @objc(THEOplayerRCTPlayerAPI)
14
26
  class THEOplayerRCTPlayerAPI: NSObject, RCTBridgeModule {
15
27
  @objc var bridge: RCTBridge!
@@ -251,4 +263,44 @@ class THEOplayerRCTPlayerAPI: NSObject, RCTBridgeModule {
251
263
  }
252
264
  }
253
265
 
266
+ @objc(setTextTrackStyle:textTrackStyle:)
267
+ func setTextTrackStyle(_ node: NSNumber, textTrackStyle: NSDictionary) -> Void {
268
+ DispatchQueue.main.async {
269
+ if let theView = self.bridge.uiManager.view(forReactTag: node) as? THEOplayerRCTView,
270
+ let player = theView.player {
271
+ if let bgColorMap = textTrackStyle[TTS_PROP_BACKGROUND_COLOR] as? [String:Any],
272
+ let r = bgColorMap[TTS_PROP_COLOR_R] as? Int,
273
+ let g = bgColorMap[TTS_PROP_COLOR_G] as? Int,
274
+ let b = bgColorMap[TTS_PROP_COLOR_B] as? Int,
275
+ let a = bgColorMap[TTS_PROP_COLOR_A] as? Int {
276
+ let bgColor = UIColor(red: CGFloat(r)/255.0, green: CGFloat(g)/255.0, blue: CGFloat(b)/255.0, alpha: CGFloat(a)/255.0)
277
+ player.textTrackStyle?.backgroundColor = [TextTrackStyleRuleColor(bgColor)]
278
+ }
279
+ if let fontColorMap = textTrackStyle[TTS_PROP_FONT_COLOR] as? [String:Any],
280
+ let r = fontColorMap[TTS_PROP_COLOR_R] as? Int,
281
+ let g = fontColorMap[TTS_PROP_COLOR_G] as? Int,
282
+ let b = fontColorMap[TTS_PROP_COLOR_B] as? Int,
283
+ let a = fontColorMap[TTS_PROP_COLOR_A] as? Int {
284
+ let fontColor = UIColor(red: CGFloat(r)/255.0, green: CGFloat(g)/255.0, blue: CGFloat(b)/255.0, alpha: CGFloat(a)/255.0)
285
+ player.textTrackStyle?.fontColor = [TextTrackStyleRuleColor(fontColor)]
286
+ }
287
+ if let edgeStyle = textTrackStyle[TTS_PROP_EDGE_STYLE] as? String {
288
+ player.textTrackStyle?.edgeStyle = [TextTrackStyleRuleString(THEOplayerRCTTypeUtils.textTrackEdgeStyleStringFromString(edgeStyle))]
289
+ }
290
+ if let fontFamily = textTrackStyle[TTS_PROP_FONT_FAMILY] as? String {
291
+ player.textTrackStyle?.fontFamily = [TextTrackStyleRuleString(fontFamily)]
292
+ }
293
+ if let fontSize = textTrackStyle[TTS_PROP_FONT_SIZE] as? Int {
294
+ player.textTrackStyle?.fontSize = [TextTrackStyleRuleNumber(fontSize)]
295
+ }
296
+ if let marginTop = textTrackStyle[TTS_PROP_MARGIN_TOP] as? Int {
297
+ player.textTrackStyle?.marginTop = [TextTrackStyleRuleNumber(marginTop)]
298
+ }
299
+ if let marginLeft = textTrackStyle[TTS_PROP_MARGIN_LEFT] as? Int {
300
+ player.textTrackStyle?.marginLeft = [TextTrackStyleRuleNumber(marginLeft)]
301
+ }
302
+ }
303
+ }
304
+ }
305
+
254
306
  }
@@ -83,4 +83,19 @@ class THEOplayerRCTTypeUtils {
83
83
  return "fit"
84
84
  }
85
85
  }
86
+
87
+ class func textTrackEdgeStyleStringFromString(_ style: String) -> String {
88
+ switch style {
89
+ case "dropshadow":
90
+ return TextTrackStyleEdgeStyle.dropShadow
91
+ case "raised":
92
+ return TextTrackStyleEdgeStyle.raised
93
+ case "depressed":
94
+ return TextTrackStyleEdgeStyle.depressed
95
+ case "uniform":
96
+ return TextTrackStyleEdgeStyle.uniform
97
+ default:
98
+ return TextTrackStyleEdgeStyle.none
99
+ }
100
+ }
86
101
  }
@@ -11,7 +11,7 @@ let ERROR_MESSAGE_DAI_GET_SNAPBACK_UNDEFINED = "Undefined dai snapback"
11
11
 
12
12
  extension THEOplayerRCTAdsAPI {
13
13
 
14
- #if GOOGLE_DAI
14
+ #if GOOGLE_DAI || canImport(THEOplayerGoogleIMAIntegration)
15
15
  @objc(daiSnapback:resolver:rejecter:)
16
16
  func daiSnapback(_ node: NSNumber, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) -> Void {
17
17
  DispatchQueue.main.async {
@@ -77,7 +77,7 @@ extension THEOplayerRCTSourceDescriptionBuilder {
77
77
  }
78
78
 
79
79
  static func buildDAITypedSource(_ typedSourceData: [String:Any], contentProtection: MultiplatformDRMConfiguration?) -> TypedSource? {
80
- #if GOOGLE_DAI
80
+ #if GOOGLE_DAI || canImport(THEOplayerGoogleIMAIntegration)
81
81
  // check for alternative Google DAI SSAI
82
82
  if let ssaiData = typedSourceData[SD_PROP_SSAI] as? [String:Any] {
83
83
  if let integration = ssaiData[SD_PROP_INTEGRATION] as? String,
@@ -72,7 +72,7 @@ extension THEOplayerRCTView {
72
72
 
73
73
  func parseAdsConfig(configDict: NSDictionary) {}
74
74
 
75
- #if GOOGLE_IMA || canImport(THEOplayerGoogleIMAIntegration)
75
+ #if (GOOGLE_IMA || GOOGLE_DAI) || canImport(THEOplayerGoogleIMAIntegration)
76
76
  func playerAdsConfiguration() -> AdsConfiguration? { return AdsConfiguration() }
77
77
  #else
78
78
  func playerAdsConfiguration() -> AdsConfiguration? { return nil }
@@ -79,13 +79,13 @@ class THEOplayerRCTNowPlayingManager {
79
79
  }
80
80
 
81
81
  private func getArtWorkUrlStringFromSourceDescription(_ sourceDescription: SourceDescription) -> String? {
82
- if let posterUrlString = sourceDescription.poster?.absoluteString {
83
- return posterUrlString
84
- }
85
82
  if let metadata = sourceDescription.metadata,
86
83
  let displayIconUrlString = metadata.metadataKeys?["displayIconUri"] as? String {
87
84
  return displayIconUrlString
88
85
  }
86
+ if let posterUrlString = sourceDescription.poster?.absoluteString {
87
+ return posterUrlString
88
+ }
89
89
 
90
90
  return nil
91
91
  }
@@ -1,2 +1,31 @@
1
1
  "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.EdgeStyle = void 0;
7
+ /**
8
+ * The text track style API.
9
+ *
10
+ * @public
11
+ */
12
+ /**
13
+ * The style of the edge, represented by a value from the following list:
14
+ * <br/> - `'none'`
15
+ * <br/> - `'dropshadow'`
16
+ * <br/> - `'raised'`
17
+ * <br/> - `'depressed'`
18
+ * <br/> - `'uniform'`
19
+ *
20
+ * @public
21
+ */
22
+ let EdgeStyle;
23
+ exports.EdgeStyle = EdgeStyle;
24
+ (function (EdgeStyle) {
25
+ EdgeStyle["none"] = "none";
26
+ EdgeStyle["dropshadow"] = "dropshadow";
27
+ EdgeStyle["raised"] = "raised";
28
+ EdgeStyle["depressed"] = "depressed";
29
+ EdgeStyle["uniform"] = "uniform";
30
+ })(EdgeStyle || (exports.EdgeStyle = EdgeStyle = {}));
2
31
  //# sourceMappingURL=TextTrackStyle.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["TextTrackStyle.ts"],"sourcesContent":["/**\n * The text track style API.\n *\n * @public\n */\nexport interface TextTrackStyle {\n /**\n * The font family for the text track.\n */\n fontFamily: string | undefined;\n\n /**\n * The font color for the text track.\n *\n * @example\n * <br/> - `red` will set the color of the text to red.\n * <br/> - `#ff0000` will set the color of the text to red.\n * <br/> - `rgba(255,0,0,0.5)` will set the color of the text to red, with 50% opacity.\n */\n fontColor: string | undefined;\n\n /**\n * The font size for the text track.\n *\n * @remarks\n * Can be a percentage value such as '50%', '75%', '100%', '150%' or '200%'.\n */\n fontSize: string | undefined;\n\n /**\n * The background color for the text track.\n *\n * @remarks\n * This targets the area directly behind the text.\n *\n * @example\n * <br/> - `red` will set the background color of the text track to red.\n * <br/> - `#ff0000` will set the background color of the text track to red.\n * <br/> - `rgba(255,0,0,0.5)` will set the background color of the text track to red, with 50% opacity.\n */\n backgroundColor: string | undefined;\n\n /**\n * The window color for the text track.\n *\n * @remarks\n * This targets the area covering the full width of the text track.\n *\n * @example\n * <br/> - `red` will set the background color of the window of the text track to red.\n * <br/> - `#ff0000` will set the background color of the window of the text track to red.\n * <br/> - `rgba(255,0,0,0.5)` will set the background color of the window of the text track to red, with 50% opacity.\n */\n windowColor: string | undefined;\n\n /**\n * The edge style of the text, represented by a value from the following list:\n * <br/> - `'none'`\n * <br/> - `'dropshadow'`\n * <br/> - `'raised'`\n * <br/> - `'depressed'`\n * <br/> - `'uniform`\n */\n edgeStyle: EdgeStyle | undefined;\n}\n\n/**\n * The style of the edge, represented by a value from the following list:\n * <br/> - `'none'`\n * <br/> - `'dropshadow'`\n * <br/> - `'raised'`\n * <br/> - `'depressed'`\n * <br/> - `'uniform'`\n *\n * @public\n */\nexport type EdgeStyle = 'none' | 'dropshadow' | 'raised' | 'depressed' | 'uniform';\n"],"mappings":""}
1
+ {"version":3,"names":["EdgeStyle","exports"],"sources":["TextTrackStyle.ts"],"sourcesContent":["/**\n * The text track style API.\n *\n * @public\n */\nexport interface TextTrackStyle {\n /**\n * The font family for the text track.\n */\n fontFamily: string | undefined;\n\n /**\n * The font color for the text track.\n *\n * @example\n * <br/> - `red` will set the color of the text to red.\n * <br/> - `#ff0000` will set the color of the text to red.\n * <br/> - Available on Web only: `rgba(255,0,0,0.5)` will set the color of the text to red, with 50% opacity.\n */\n fontColor: string | undefined;\n\n /**\n * The font size for the text track.\n *\n * @remarks\n * Can be a percentage value such as '50%', '75%', '100%', '150%' or '200%'.\n */\n fontSize: string | undefined;\n\n /**\n * The background color for the text track.\n *\n * @remarks\n * This targets the area directly behind the text.\n *\n * @example\n * <br/> - `red` will set the background color of the text track to red.\n * <br/> - `#ff0000` will set the background color of the text track to red.\n * <br/> - Available on Web only: `rgba(255,0,0,0.5)` will set the background color of the text track to red, with 50% opacity.\n */\n backgroundColor: string | undefined;\n\n /**\n * The window color for the text track.\n *\n * @remarks\n * <br/> - This targets the area covering the full width of the text track.\n * <br/> - Available on Web and Android only.\n *\n * @example\n * <br/> - `red` will set the background color of the window of the text track to red.\n * <br/> - `#ff0000` will set the background color of the window of the text track to red.\n * <br/> - Available on Web only: `rgba(255,0,0,0.5)` will set the background color of the window of the text track to red, with 50% opacity.\n */\n windowColor: string | undefined;\n\n /**\n * The edge style of the text, represented by a value from the following list:\n * <br/> - `'none'`\n * <br/> - `'dropshadow'`\n * <br/> - `'raised'`\n * <br/> - `'depressed'`\n * <br/> - `'uniform`\n */\n edgeStyle: EdgeStyle | undefined;\n\n /**\n * The top margin of the area where subtitles are being rendered.\n *\n * @remarks\n * <br/> - The margin is in number of pixels.\n */\n marginTop: number | undefined;\n\n /**\n * The bottom margin of the area where subtitles are being rendered.\n *\n * @remarks\n * <br/> - The margin is in number of pixels.\n * <br/> - Available on Web only.\n */\n marginBottom: number | undefined;\n /**\n * The left margin of the area where subtitles are being rendered.\n *\n * @remarks\n * <br/> - The margin is in number of pixels.\n */\n marginLeft: number | undefined;\n /**\n * The right margin of the area where subtitles are being rendered.\n *\n * @remarks\n * <br/> - The margin is in number of pixels.\n * <br/> - Useful for pushing the subtitles left, so they don't overlap with the UI.\n * <br/> - Available on Web only.\n */\n marginRight: number | undefined;\n}\n\n/**\n * The style of the edge, represented by a value from the following list:\n * <br/> - `'none'`\n * <br/> - `'dropshadow'`\n * <br/> - `'raised'`\n * <br/> - `'depressed'`\n * <br/> - `'uniform'`\n *\n * @public\n */\nexport enum EdgeStyle {\n none = 'none',\n dropshadow = 'dropshadow',\n raised = 'raised',\n depressed = 'depressed',\n uniform = 'uniform',\n}\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AAgGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AATA,IAUYA,SAAS;AAAAC,OAAA,CAAAD,SAAA,GAAAA,SAAA;AAAA,WAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;EAATA,SAAS;AAAA,GAATA,SAAS,KAAAC,OAAA,CAAAD,SAAA,GAATA,SAAS"}
@@ -0,0 +1,143 @@
1
+ {
2
+ "aliceblue": "f0f8ff",
3
+ "antiquewhite": "faebd7",
4
+ "aqua": "00ffff",
5
+ "aquamarine": "7fffd4",
6
+ "azure": "f0ffff",
7
+ "beige": "f5f5dc",
8
+ "bisque": "ffe4c4",
9
+ "black": "000000",
10
+ "blanchedalmond": "ffebcd",
11
+ "blue": "0000ff",
12
+ "blueviolet": "8a2be2",
13
+ "brown": "a52a2a",
14
+ "burlywood": "deb887",
15
+ "cadetblue": "5f9ea0",
16
+ "chartreuse": "7fff00",
17
+ "chocolate": "d2691e",
18
+ "coral": "ff7f50",
19
+ "cornflowerblue": "6495ed",
20
+ "cornsilk": "fff8dc",
21
+ "crimson": "dc143c",
22
+ "cyan": "00ffff",
23
+ "darkblue": "00008b",
24
+ "darkcyan": "008b8b",
25
+ "darkgoldenrod": "b8860b",
26
+ "darkgray": "a9a9a9",
27
+ "darkgreen": "006400",
28
+ "darkkhaki": "bdb76b",
29
+ "darkmagenta": "8b008b",
30
+ "darkolivegreen": "556b2f",
31
+ "darkorange": "ff8c00",
32
+ "darkorchid": "9932cc",
33
+ "darkred": "8b0000",
34
+ "darksalmon": "e9967a",
35
+ "darkseagreen": "8fbc8f",
36
+ "darkslateblue": "483d8b",
37
+ "darkslategray": "2f4f4f",
38
+ "darkturquoise": "00ced1",
39
+ "darkviolet": "9400d3",
40
+ "deeppink": "ff1493",
41
+ "deepskyblue": "00bfff",
42
+ "dimgray": "696969",
43
+ "dodgerblue": "1e90ff",
44
+ "firebrick": "b22222",
45
+ "floralwhite": "fffaf0",
46
+ "forestgreen": "228b22",
47
+ "fuchsia": "ff00ff",
48
+ "gainsboro": "dcdcdc",
49
+ "ghostwhite": "f8f8ff",
50
+ "gold": "ffd700",
51
+ "goldenrod": "daa520",
52
+ "gray": "808080",
53
+ "green": "008000",
54
+ "greenyellow": "adff2f",
55
+ "honeydew": "f0fff0",
56
+ "hotpink": "ff69b4",
57
+ "indianred": "cd5c5c",
58
+ "indigo": "4b0082",
59
+ "ivory": "fffff0",
60
+ "khaki": "f0e68c",
61
+ "lavender": "e6e6fa",
62
+ "lavenderblush": "fff0f5",
63
+ "lawngreen": "7cfc00",
64
+ "lemonchiffon": "fffacd",
65
+ "lightblue": "add8e6",
66
+ "lightcoral": "f08080",
67
+ "lightcyan": "e0ffff",
68
+ "lightgoldenrodyellow": "fafad2",
69
+ "lightgray": "d3d3d3",
70
+ "lightgreen": "90ee90",
71
+ "lightpink": "ffb6c1",
72
+ "lightsalmon": "ffa07a",
73
+ "lightseagreen": "20b2aa",
74
+ "lightskyblue": "87cefa",
75
+ "lightslategray": "778899",
76
+ "lightsteelblue": "b0c4de",
77
+ "lightyellow": "ffffe0",
78
+ "lime": "00ff00",
79
+ "limegreen": "32cd32",
80
+ "linen": "faf0e6",
81
+ "magenta": "ff00ff",
82
+ "maroon": "800000",
83
+ "mediumaquamarine": "66cdaa",
84
+ "mediumblue": "0000cd",
85
+ "mediumorchid": "ba55d3",
86
+ "mediumpurple": "9370db",
87
+ "mediumseagreen": "3cb371",
88
+ "mediumslateblue": "7b68ee",
89
+ "mediumspringgreen": "00fa9a",
90
+ "mediumturquoise": "48d1cc",
91
+ "mediumvioletred": "c71585",
92
+ "midnightblue": "191970",
93
+ "mintcream": "f5fffa",
94
+ "mistyrose": "ffe4e1",
95
+ "moccasin": "ffe4b5",
96
+ "navajowhite": "ffdead",
97
+ "navy": "000080",
98
+ "oldlace": "fdf5e6",
99
+ "olive": "808000",
100
+ "olivedrab": "6b8e23",
101
+ "orange": "ffa500",
102
+ "orangered": "ff4500",
103
+ "orchid": "da70d6",
104
+ "palegoldenrod": "eee8aa",
105
+ "palegreen": "98fb98",
106
+ "paleturquoise": "afeeee",
107
+ "palevioletred": "db7093",
108
+ "papayawhip": "ffefd5",
109
+ "peachpuff": "ffdab9",
110
+ "peru": "cd853f",
111
+ "pink": "ffc0cb",
112
+ "plum": "dda0dd",
113
+ "powderblue": "b0e0e6",
114
+ "purple": "800080",
115
+ "rebeccapurple": "663399",
116
+ "red": "ff0000",
117
+ "rosybrown": "bc8f8f",
118
+ "royalblue": "4169e1",
119
+ "saddlebrown": "8b4513",
120
+ "salmon": "fa8072",
121
+ "sandybrown": "f4a460",
122
+ "seagreen": "2e8b57",
123
+ "seashell": "fff5ee",
124
+ "sienna": "a0522d",
125
+ "silver": "c0c0c0",
126
+ "skyblue": "87ceeb",
127
+ "slateblue": "6a5acd",
128
+ "slategray": "708090",
129
+ "snow": "fffafa",
130
+ "springgreen": "00ff7f",
131
+ "steelblue": "4682b4",
132
+ "tan": "d2b48c",
133
+ "teal": "008080",
134
+ "thistle": "d8bfd8",
135
+ "tomato": "ff6347",
136
+ "turquoise": "40e0d0",
137
+ "violet": "ee82ee",
138
+ "wheat": "f5deb3",
139
+ "white": "ffffff",
140
+ "whitesmoke": "f5f5f5",
141
+ "yellow": "ffff00",
142
+ "yellowgreen": "9acd32"
143
+ }