react-native-theoplayer 3.10.1 → 3.10.3

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,18 @@ 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.10.3] - 24-03-22
9
+
10
+ ### Fixed
11
+
12
+ - Fixed a crash on iOS when playing an IMA Ad after reparenting the THEOplayerView to a different native Viewcontroller.
13
+
14
+ ## [3.10.2] - 24-03-22
15
+
16
+ ### Changed
17
+
18
+ - Downgraded default `androidx.core:core-ktx` dependency version to support Android target sdk 33.
19
+
8
20
  ## [3.10.1] - 24-03-19
9
21
 
10
22
  ### Changed
@@ -9,7 +9,7 @@ buildscript {
9
9
  }
10
10
 
11
11
  dependencies {
12
- classpath 'com.android.tools.build:gradle:8.2.2'
12
+ classpath "com.android.tools.build:gradle:${safeExtGet('gradlePluginVersion', '8.2.2')}"
13
13
  classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${safeExtGet('kotlinVersion', '1.9.21')}"
14
14
  }
15
15
  }
@@ -108,9 +108,9 @@ repositories {
108
108
  dependencies {
109
109
  //noinspection GradleDynamicVersion
110
110
  implementation "com.facebook.react:react-native:+" // From node_modules
111
- implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3"
112
- implementation "androidx.appcompat:appcompat:1.6.1"
113
- implementation "androidx.core:core-ktx:1.12.0"
111
+ implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:${safeExtGet('coroutinesVersion', '1.7.3')}"
112
+ implementation "androidx.appcompat:appcompat:${safeExtGet('appcompatVersion', '1.6.1')}"
113
+ implementation "androidx.core:core-ktx:${safeExtGet('corektxVersion', '1.10.1')}"
114
114
 
115
115
  // The minimum supported THEOplayer version is 6.0.0
116
116
  def theoplayer_sdk_version = safeExtGet('THEOplayer_sdk', '[6.0.0,7.0)')
@@ -293,13 +293,18 @@ class MediaPlaybackService : MediaBrowserServiceCompat() {
293
293
 
294
294
  private fun startForegroundWithPlaybackState(@PlaybackStateCompat.State playbackState: Int, largeIcon: Bitmap? = null) {
295
295
  try {
296
- ServiceCompat.startForeground(
297
- this, NOTIFICATION_ID,
298
- notificationBuilder.build(playbackState, largeIcon, enableMediaControls),
299
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q)
296
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
297
+ startForeground(
298
+ NOTIFICATION_ID,
299
+ notificationBuilder.build(playbackState, largeIcon, enableMediaControls),
300
300
  ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK
301
- else 0
302
- )
301
+ )
302
+ } else {
303
+ startForeground(
304
+ NOTIFICATION_ID,
305
+ notificationBuilder.build(playbackState, largeIcon, enableMediaControls)
306
+ )
307
+ }
303
308
  } catch (e: IllegalStateException) {
304
309
  // Make sure that app does not crash in case anything goes wrong with starting the service.
305
310
  // https://issuetracker.google.com/issues/229000935
@@ -60,6 +60,7 @@ class THEOplayerRCTPlayerAPI: NSObject, RCTBridgeModule {
60
60
  let (sourceDescription, metadataTrackDescriptions) = THEOplayerRCTSourceDescriptionBuilder.buildSourceDescription(src)
61
61
  if let srcDescription = sourceDescription {
62
62
  if let player = theView.player {
63
+ self.triggerViewHierarchyValidation(player)
63
64
  self.setNewSourceDescription(player: player, srcDescription: srcDescription)
64
65
  theView.processMetadataTracks(metadataTrackDescriptions: metadataTrackDescriptions)
65
66
  }
@@ -71,6 +72,15 @@ class THEOplayerRCTPlayerAPI: NSObject, RCTBridgeModule {
71
72
  }
72
73
  }
73
74
  }
75
+
76
+ private func triggerViewHierarchyValidation(_ player: THEOplayer) {
77
+ // TEMP: trigger a ViewController Hierarchy revalidation for IMA on the iOS THEOplayer SDK
78
+ #if canImport(THEOplayerGoogleIMAIntegration)
79
+ let originalFrame = player.frame
80
+ player.frame.size.width -= 1
81
+ player.frame = originalFrame
82
+ #endif
83
+ }
74
84
 
75
85
  private func setNewSourceDescription(player: THEOplayer, srcDescription: SourceDescription) {
76
86
  if DEBUG_PLAYER_API { PrintUtils.printLog(logText: "[NATIVE] Setting new source on TheoPlayer") }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-theoplayer",
3
- "version": "3.10.1",
3
+ "version": "3.10.3",
4
4
  "description": "A THEOplayer video component for react-native.",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",