react-native-theoplayer 7.2.0 → 7.3.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 CHANGED
@@ -5,6 +5,20 @@ 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
+ ## [7.3.0] - 24-06-03
9
+
10
+ ### Changed
11
+
12
+ - Disabled skip forward/backward remote control buttons by default for Live content on Android TV platforms.
13
+
14
+ ### Added
15
+
16
+ - Added support for React Native 0.74 and upgraded the example application to depend on `react-native-tvos` 0.74.1.
17
+
18
+ ### Fixed
19
+
20
+ - Fixed an issue where on the iOS bridge the wrong value was extracted from the CachingParameters to configure the bandwidth setting on the MediaCache.
21
+
8
22
  ## [7.2.0] - 24-05-12
9
23
 
10
24
  ### Added
@@ -9,7 +9,7 @@ buildscript {
9
9
  }
10
10
 
11
11
  dependencies {
12
- classpath "com.android.tools.build:gradle:${safeExtGet('gradlePluginVersion', '8.2.2')}"
12
+ classpath "com.android.tools.build:gradle:${safeExtGet('gradlePluginVersion', '8.3.2')}"
13
13
  classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${safeExtGet('kotlinVersion', '1.9.21')}"
14
14
  }
15
15
  }
@@ -1,5 +1,5 @@
1
1
  distributionBase=GRADLE_USER_HOME
2
2
  distributionPath=wrapper/dists
3
- distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
3
+ distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
4
4
  zipStoreBase=GRADLE_USER_HOME
5
5
  zipStorePath=wrapper/dists
@@ -7,7 +7,8 @@ import com.facebook.react.bridge.Arguments
7
7
  import com.facebook.react.bridge.ReactApplicationContext
8
8
  import com.facebook.react.bridge.WritableMap
9
9
  import com.facebook.react.bridge.WritableNativeMap
10
- import com.facebook.react.uimanager.events.ReactEventEmitter
10
+ import com.facebook.react.uimanager.UIManagerHelper
11
+ import com.facebook.react.uimanager.common.ViewUtil
11
12
  import com.theoplayer.ads.AdEventAdapter
12
13
  import com.theoplayer.ads.AdEventAdapter.AdEventEmitter
13
14
  import com.theoplayer.android.api.THEOplayerGlobal
@@ -46,6 +47,7 @@ import com.theoplayer.track.*
46
47
  import com.theoplayer.util.PayloadBuilder
47
48
  import kotlin.math.floor
48
49
 
50
+
49
51
  private val TAG = PlayerEventEmitter::class.java.name
50
52
 
51
53
  private const val EVENT_PLAYER_READY = "onNativePlayerReady"
@@ -85,7 +87,7 @@ private const val EVENT_PROP_SUITE_VERSION = "playerSuiteVersion"
85
87
 
86
88
  @Suppress("UNCHECKED_CAST")
87
89
  class PlayerEventEmitter internal constructor(
88
- reactContext: ReactApplicationContext,
90
+ private val reactContext: ReactApplicationContext,
89
91
  playerView: ReactTHEOplayerView
90
92
  ) {
91
93
  @Retention(AnnotationRetention.SOURCE)
@@ -156,7 +158,6 @@ class PlayerEventEmitter internal constructor(
156
158
  )
157
159
  }
158
160
 
159
- private val eventEmitter: ReactEventEmitter
160
161
  private var viewId = View.NO_ID
161
162
  private val playerListeners = HashMap<EventType<*>, EventListener<*>>()
162
163
  private val textTrackListeners = HashMap<EventType<*>, EventListener<*>>()
@@ -174,7 +175,6 @@ class PlayerEventEmitter internal constructor(
174
175
  }
175
176
 
176
177
  init {
177
- eventEmitter = ReactEventEmitter(reactContext)
178
178
  this.playerView = playerView
179
179
 
180
180
  // Create listeners
@@ -615,7 +615,8 @@ class PlayerEventEmitter internal constructor(
615
615
  } catch (ignore: RuntimeException) {
616
616
  }
617
617
  }
618
- eventEmitter.receiveEvent(viewId, type, event)
618
+ val uiManager = UIManagerHelper.getUIManager(reactContext, ViewUtil.getUIManagerType(viewId))
619
+ uiManager?.receiveEvent(UIManagerHelper.getSurfaceId(reactContext), viewId, type, event)
619
620
  }
620
621
 
621
622
  private fun attachListeners(player: Player) {
@@ -155,10 +155,12 @@ class ReactTHEOplayerContext private constructor(
155
155
  // Reduce allowed set of remote control playback actions for ads & live streams.
156
156
  val isLive = player.duration.isInfinite()
157
157
  val isInAd = player.ads.isPlaying
158
- mediaSessionConnector?.enabledPlaybackActions = if (isInAd || isLive && !isTV) {
159
- 0
160
- } else {
161
- ALLOWED_PLAYBACK_ACTIONS
158
+ mediaSessionConnector?.enabledPlaybackActions = when {
159
+ isInAd || isLive && !isTV -> 0
160
+ isLive && isTV -> ALLOWED_PLAYBACK_ACTIONS xor
161
+ PlaybackStateCompat.ACTION_FAST_FORWARD xor
162
+ PlaybackStateCompat.ACTION_REWIND
163
+ else -> ALLOWED_PLAYBACK_ACTIONS
162
164
  }
163
165
  }
164
166
 
@@ -53,23 +53,22 @@ class ReactTHEOplayerView(private val reactContext: ThemedReactContext) :
53
53
  playerContext = ReactTHEOplayerContext.create(
54
54
  reactContext,
55
55
  PlayerConfigAdapter(configProps)
56
- )
57
- playerContext?.let {
56
+ ).apply {
58
57
  if (BuildConfig.EXTENSION_ADS) {
59
- adsApi.initialize(it.player, it.imaIntegration, it.daiIntegration)
58
+ adsApi.initialize(player, imaIntegration, daiIntegration)
60
59
  }
61
60
  val layoutParams = LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)
62
- it.playerView.layoutParams = layoutParams
63
- (it.playerView.parent as? ViewGroup)?.removeView(it.playerView)
64
- addView(it.playerView, 0, layoutParams)
61
+ playerView.layoutParams = layoutParams
62
+ (playerView.parent as? ViewGroup)?.removeView(playerView)
63
+ addView(playerView, 0, layoutParams)
65
64
 
66
65
  presentationManager = PresentationManager(
67
- it,
66
+ this,
68
67
  reactContext,
69
68
  eventEmitter
70
69
  )
71
70
 
72
- eventEmitter.preparePlayer(it.player)
71
+ eventEmitter.preparePlayer(player)
73
72
  }
74
73
  }
75
74
 
@@ -11,7 +11,7 @@ class THEOplayerRCTCachingParametersBuilder {
11
11
  if let expirationDateTimestamp = paramsData[CACHETASK_PROP_PARAMETERS_EXPIRATION_DATE] as? Double {
12
12
  expirationDate = Date(timeIntervalSince1970: expirationDateTimestamp * 0.001) // msec -> sec
13
13
  }
14
- let bandWidth = paramsData[CACHETASK_PROP_PARAMETERS_EXPIRATION_DATE] as? Int
14
+ let bandWidth = paramsData[CACHETASK_PROP_PARAMETERS_BANDWIDTH] as? Int
15
15
  let cachingParameters = CachingParameters(expirationDate: expirationDate, bandwidth: bandWidth)
16
16
  let preferredTrackSelection = paramsData[CACHETASK_PROP_PARAMETERS_TRACK_SELECTION] as? [String:Any]
17
17
  cachingParameters.preferredTrackSelection = THEOplayerRCTCachingParametersBuilder.buildPreferredTrackSelection(preferredTrackSelection)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-theoplayer",
3
- "version": "7.2.0",
3
+ "version": "7.3.0",
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 @@
47
47
  "registry": "https://registry.npmjs.org/"
48
48
  },
49
49
  "devDependencies": {
50
- "@react-native/eslint-config": "0.73.2",
50
+ "@react-native/eslint-config": "^0.74.83",
51
51
  "@types/react": "^18.2.24",
52
52
  "@types/react-native": "^0.73.0",
53
53
  "eslint": "^8.56.0",
@@ -55,9 +55,9 @@
55
55
  "pod-install": "^0.1.39",
56
56
  "prettier": "^3.2.5",
57
57
  "react": "^18.2.0",
58
- "react-native": "^0.73.4",
58
+ "react-native": "^0.74.1",
59
59
  "react-native-builder-bob": "^0.23.2",
60
- "theoplayer": "^7.0.0",
60
+ "theoplayer": "^7.4.1",
61
61
  "typedoc": "^0.25.12",
62
62
  "typedoc-plugin-external-resolver": "^1.0.3",
63
63
  "typedoc-plugin-mdn-links": "^3.1.18",
@@ -32,23 +32,23 @@ Pod::Spec.new do |s|
32
32
  s.dependency "React-Core"
33
33
 
34
34
  # THEOplayer core Dependency
35
- s.dependency "THEOplayerSDK-core", "~> 7.2"
35
+ s.dependency "THEOplayerSDK-core", "~> 7.4"
36
36
 
37
37
  if theofeatures.include?("GOOGLE_IMA")
38
38
  puts "Adding THEOplayer-Integration-GoogleIMA"
39
- s.dependency "THEOplayer-Integration-GoogleIMA/Base", "~> 7.2"
40
- s.dependency "THEOplayer-Integration-GoogleIMA/Dependencies", "~> 7.2"
39
+ s.dependency "THEOplayer-Integration-GoogleIMA/Base", "~> 7.4"
40
+ s.dependency "THEOplayer-Integration-GoogleIMA/Dependencies", "~> 7.4"
41
41
  end
42
42
 
43
43
  if theofeatures.include?("CHROMECAST")
44
44
  puts "Adding THEOplayer-Integration-GoogleCast"
45
- s.ios.dependency "THEOplayer-Integration-GoogleCast/Base", "~> 7.2"
45
+ s.ios.dependency "THEOplayer-Integration-GoogleCast/Base", "~> 7.4"
46
46
  s.ios.dependency "google-cast-sdk-dynamic-xcframework", "~> 4.8"
47
47
  end
48
48
 
49
49
  if theofeatures.include?("SIDELOADED_TEXTTRACKS")
50
50
  puts "Adding THEOplayer-Connector-SideloadedSubtitle"
51
- s.dependency "THEOplayer-Connector-SideloadedSubtitle", "~> 7.1"
51
+ s.dependency "THEOplayer-Connector-SideloadedSubtitle", "~> 7.4"
52
52
  end
53
53
 
54
54
  end