react-native-theoplayer 8.17.0 → 9.0.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 (136) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/README.md +2 -1
  3. package/android/build.gradle +21 -30
  4. package/android/local/com/theoplayer/theoplayer-sdk-android/ads-wrapper/9.0.0/ads-wrapper-9.0.0.aar +0 -0
  5. package/android/local/com/theoplayer/theoplayer-sdk-android/ads-wrapper/{8.0.0/ads-wrapper-8.0.0.pom → 9.0.0/ads-wrapper-9.0.0.pom} +2 -2
  6. package/android/local/com/theoplayer/theoplayer-sdk-android/ads-wrapper/maven-metadata-local.xml +4 -4
  7. package/android/src/main/java/com/theoplayer/PlayerConfigAdapter.kt +2 -18
  8. package/android/src/main/java/com/theoplayer/ReactTHEOplayerContext.kt +3 -25
  9. package/android/src/main/java/com/theoplayer/ReactTHEOplayerViewManager.kt +1 -8
  10. package/android/src/main/java/com/theoplayer/ads/AdAdapter.kt +24 -31
  11. package/android/src/main/java/com/theoplayer/ads/AdEventAdapter.kt +1 -1
  12. package/android/src/main/java/com/theoplayer/cache/CacheAdapter.kt +12 -0
  13. package/android/src/main/java/com/theoplayer/cmcd/CmcdTransmissionMode.kt +8 -0
  14. package/android/src/main/java/com/theoplayer/player/PlayerModule.kt +13 -0
  15. package/android/src/main/java/com/theoplayer/presentation/FullscreenLayoutObserver.kt +39 -0
  16. package/android/src/main/java/com/theoplayer/presentation/PipUtils.kt +8 -14
  17. package/android/src/main/java/com/theoplayer/presentation/PresentationManager.kt +103 -34
  18. package/android/src/main/java/com/theoplayer/source/SourceAdapter.kt +43 -5
  19. package/android/src/main/java/com/theoplayer/track/TrackListAdapter.kt +1 -1
  20. package/ios/THEOplayerRCTSourceDescriptionBuilder.swift +9 -1
  21. package/ios/THEOplayerRCTTrackMetadataAggregator.swift +2 -11
  22. package/lib/commonjs/api/cache/CachingTaskParameters.js +17 -0
  23. package/lib/commonjs/api/cache/CachingTaskParameters.js.map +1 -1
  24. package/lib/commonjs/api/player/THEOplayer.js.map +1 -1
  25. package/lib/commonjs/api/source/SourceDescription.js +12 -1
  26. package/lib/commonjs/api/source/SourceDescription.js.map +1 -1
  27. package/lib/commonjs/api/source/ads/Ads.js +0 -2
  28. package/lib/commonjs/api/source/ads/Ads.js.map +1 -1
  29. package/lib/commonjs/api/source/barrel.js +15 -4
  30. package/lib/commonjs/api/source/barrel.js.map +1 -1
  31. package/lib/commonjs/api/source/cmcd/CmcdConfiguration.js +18 -0
  32. package/lib/commonjs/api/source/cmcd/CmcdConfiguration.js.map +1 -0
  33. package/lib/commonjs/api/source/cmcd/barrel.js +17 -0
  34. package/lib/commonjs/api/source/cmcd/barrel.js.map +1 -0
  35. package/lib/commonjs/internal/THEOplayerView.js +12 -2
  36. package/lib/commonjs/internal/THEOplayerView.js.map +1 -1
  37. package/lib/commonjs/internal/THEOplayerView.web.js +2 -15
  38. package/lib/commonjs/internal/THEOplayerView.web.js.map +1 -1
  39. package/lib/commonjs/internal/adapter/THEOplayerAdapter.js +5 -0
  40. package/lib/commonjs/internal/adapter/THEOplayerAdapter.js.map +1 -1
  41. package/lib/commonjs/internal/adapter/THEOplayerWebAdapter.js +30 -0
  42. package/lib/commonjs/internal/adapter/THEOplayerWebAdapter.js.map +1 -1
  43. package/lib/commonjs/internal/adapter/theoads/THEOAdsNativeAdapter.js +31 -0
  44. package/lib/commonjs/internal/adapter/theoads/THEOAdsNativeAdapter.js.map +1 -0
  45. package/lib/commonjs/internal/adapter/theoads/THEOAdsWebAdapter.js +2 -2
  46. package/lib/commonjs/internal/adapter/theoads/THEOAdsWebAdapter.js.map +1 -1
  47. package/lib/commonjs/internal/utils/Dimensions.js +7 -15
  48. package/lib/commonjs/internal/utils/Dimensions.js.map +1 -1
  49. package/lib/commonjs/manifest.json +1 -1
  50. package/lib/module/api/cache/CachingTaskParameters.js +17 -1
  51. package/lib/module/api/cache/CachingTaskParameters.js.map +1 -1
  52. package/lib/module/api/player/THEOplayer.js.map +1 -1
  53. package/lib/module/api/source/SourceDescription.js +12 -0
  54. package/lib/module/api/source/SourceDescription.js.map +1 -1
  55. package/lib/module/api/source/ads/Ads.js +0 -2
  56. package/lib/module/api/source/ads/Ads.js.map +1 -1
  57. package/lib/module/api/source/barrel.js +1 -0
  58. package/lib/module/api/source/barrel.js.map +1 -1
  59. package/lib/module/api/source/cmcd/CmcdConfiguration.js +13 -0
  60. package/lib/module/api/source/cmcd/CmcdConfiguration.js.map +1 -0
  61. package/lib/module/api/source/cmcd/barrel.js +2 -0
  62. package/lib/module/api/source/cmcd/barrel.js.map +1 -0
  63. package/lib/module/internal/THEOplayerView.js +12 -2
  64. package/lib/module/internal/THEOplayerView.js.map +1 -1
  65. package/lib/module/internal/THEOplayerView.web.js +3 -16
  66. package/lib/module/internal/THEOplayerView.web.js.map +1 -1
  67. package/lib/module/internal/adapter/THEOplayerAdapter.js +5 -0
  68. package/lib/module/internal/adapter/THEOplayerAdapter.js.map +1 -1
  69. package/lib/module/internal/adapter/THEOplayerWebAdapter.js +31 -1
  70. package/lib/module/internal/adapter/THEOplayerWebAdapter.js.map +1 -1
  71. package/lib/module/internal/adapter/theoads/THEOAdsNativeAdapter.js +24 -0
  72. package/lib/module/internal/adapter/theoads/THEOAdsNativeAdapter.js.map +1 -0
  73. package/lib/module/internal/adapter/theoads/THEOAdsWebAdapter.js +2 -2
  74. package/lib/module/internal/adapter/theoads/THEOAdsWebAdapter.js.map +1 -1
  75. package/lib/module/internal/utils/Dimensions.js +8 -16
  76. package/lib/module/internal/utils/Dimensions.js.map +1 -1
  77. package/lib/module/manifest.json +1 -1
  78. package/lib/typescript/api/ads/GoogleImaAd.d.ts +8 -0
  79. package/lib/typescript/api/ads/GoogleImaAd.d.ts.map +1 -1
  80. package/lib/typescript/api/cache/CachingTaskParameters.d.ts +34 -0
  81. package/lib/typescript/api/cache/CachingTaskParameters.d.ts.map +1 -1
  82. package/lib/typescript/api/config/PlayerConfiguration.d.ts +0 -26
  83. package/lib/typescript/api/config/PlayerConfiguration.d.ts.map +1 -1
  84. package/lib/typescript/api/player/THEOplayer.d.ts +5 -0
  85. package/lib/typescript/api/player/THEOplayer.d.ts.map +1 -1
  86. package/lib/typescript/api/source/SourceDescription.d.ts +35 -0
  87. package/lib/typescript/api/source/SourceDescription.d.ts.map +1 -1
  88. package/lib/typescript/api/source/ads/Ads.d.ts +0 -2
  89. package/lib/typescript/api/source/ads/Ads.d.ts.map +1 -1
  90. package/lib/typescript/api/source/ads/ssai/GoogleDAIConfiguration.d.ts +9 -0
  91. package/lib/typescript/api/source/ads/ssai/GoogleDAIConfiguration.d.ts.map +1 -1
  92. package/lib/typescript/api/source/barrel.d.ts +1 -0
  93. package/lib/typescript/api/source/barrel.d.ts.map +1 -1
  94. package/lib/typescript/api/source/cmcd/CmcdConfiguration.d.ts +79 -0
  95. package/lib/typescript/api/source/cmcd/CmcdConfiguration.d.ts.map +1 -0
  96. package/lib/typescript/api/source/cmcd/barrel.d.ts +2 -0
  97. package/lib/typescript/api/source/cmcd/barrel.d.ts.map +1 -0
  98. package/lib/typescript/api/source/dash/DashPlaybackConfiguration.d.ts +9 -0
  99. package/lib/typescript/api/source/dash/DashPlaybackConfiguration.d.ts.map +1 -1
  100. package/lib/typescript/api/theoads/TheoAdsAPI.d.ts +2 -2
  101. package/lib/typescript/api/theoads/TheoAdsAPI.d.ts.map +1 -1
  102. package/lib/typescript/internal/THEOplayerView.d.ts.map +1 -1
  103. package/lib/typescript/internal/THEOplayerView.web.d.ts.map +1 -1
  104. package/lib/typescript/internal/adapter/THEOplayerAdapter.d.ts +3 -1
  105. package/lib/typescript/internal/adapter/THEOplayerAdapter.d.ts.map +1 -1
  106. package/lib/typescript/internal/adapter/THEOplayerWebAdapter.d.ts +3 -3
  107. package/lib/typescript/internal/adapter/THEOplayerWebAdapter.d.ts.map +1 -1
  108. package/lib/typescript/internal/adapter/theoads/THEOAdsNativeAdapter.d.ts +9 -0
  109. package/lib/typescript/internal/adapter/theoads/THEOAdsNativeAdapter.d.ts.map +1 -0
  110. package/lib/typescript/internal/adapter/theoads/THEOAdsWebAdapter.d.ts +3 -4
  111. package/lib/typescript/internal/adapter/theoads/THEOAdsWebAdapter.d.ts.map +1 -1
  112. package/lib/typescript/internal/utils/Dimensions.d.ts +1 -1
  113. package/lib/typescript/internal/utils/Dimensions.d.ts.map +1 -1
  114. package/package.json +4 -3
  115. package/react-native-theoplayer.podspec +6 -6
  116. package/src/api/ads/GoogleImaAd.ts +9 -0
  117. package/src/api/cache/CachingTaskParameters.ts +37 -0
  118. package/src/api/config/PlayerConfiguration.ts +0 -29
  119. package/src/api/player/THEOplayer.ts +6 -0
  120. package/src/api/source/SourceDescription.ts +39 -0
  121. package/src/api/source/ads/Ads.ts +0 -2
  122. package/src/api/source/ads/ssai/GoogleDAIConfiguration.ts +10 -0
  123. package/src/api/source/barrel.ts +1 -0
  124. package/src/api/source/cmcd/CmcdConfiguration.ts +84 -0
  125. package/src/api/source/cmcd/barrel.ts +1 -0
  126. package/src/api/source/dash/DashPlaybackConfiguration.ts +10 -0
  127. package/src/api/theoads/TheoAdsAPI.ts +2 -2
  128. package/src/internal/THEOplayerView.tsx +10 -2
  129. package/src/internal/THEOplayerView.web.tsx +3 -20
  130. package/src/internal/adapter/THEOplayerAdapter.ts +8 -0
  131. package/src/internal/adapter/THEOplayerWebAdapter.ts +41 -4
  132. package/src/internal/adapter/theoads/THEOAdsNativeAdapter.ts +26 -0
  133. package/src/internal/adapter/theoads/THEOAdsWebAdapter.ts +5 -6
  134. package/src/internal/utils/Dimensions.ts +8 -16
  135. package/src/manifest.json +1 -1
  136. package/android/local/com/theoplayer/theoplayer-sdk-android/ads-wrapper/8.0.0/ads-wrapper-8.0.0.aar +0 -0
package/CHANGELOG.md CHANGED
@@ -5,6 +5,42 @@ 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
+ ## [9.0.0] - 25-04-04
9
+
10
+ ### Removed
11
+
12
+ - Removed `chromeless` property from `PlayerConfiguration`. Only React Native based UIs are supported.
13
+ - Removed ad integration kind `theo`.
14
+ - Removed `enableTHEOlive` property from `PlayerConfiguration` as THEOlive is always enabled.
15
+
16
+ ### Added
17
+
18
+ - Added `liveOffset` property to `SourceDescription` for Web and Android platforms.
19
+ - Added `description` property for Google IMA ads on Web and Android platforms.
20
+ - Added `networkCode` property for Google DAI configuration on Web platforms.
21
+ - Added `segmentRelativeVttTiming` property on `DashPlaybackConfiguration` for Web to indicate whether segmented WebVTT files' timestamps should be considered relative to the segment start time.
22
+ - Added `storageType` to `CachingTaskParameters` to allow writing to either the legacy cache or Media3 cache on Android.
23
+
24
+ ### Changed
25
+
26
+ - Reverted DataRangeCue timings calculation on iOS (based on programDateTime offset). Correct values are provided by the native SDK.
27
+
28
+ ## [8.18.0] - 25-04-02
29
+
30
+ ### Changed
31
+
32
+ - No longer showing poster after setting the source when the player has been configured to use autoplay. With autoplay enabled, displaying the poster will only result in a brief flash of the image.
33
+ - Changed the fullscreen screen dimension calculation on Android, taking into account edgeToEdge layouts.
34
+
35
+ ### Added
36
+
37
+ - Exposed THEOads API through the Player API.
38
+ - Added support for Common Media Client Data (CMCD) on all platforms. More info on the [documentation](./doc/cmcd.md) page.
39
+
40
+ ### Fixed
41
+
42
+ - Fixed an issue on Android where the transition to a PiP window would not focus on the player window.
43
+
8
44
  ## [8.17.0] - 25-03-20
9
45
 
10
46
  ### Fixed
@@ -34,6 +70,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
34
70
  - Fixed an issue on Android, where the player would sometimes not initialise correctly in case New Architecture was not being used, resulting in a black screen.
35
71
  - Fixed an issue on iOS Safari browsers, where the `presentationmodechange` event would not be dispatched when entering or exiting fullscreen.
36
72
 
73
+
37
74
  ## [8.15.0] - 25-02-12
38
75
 
39
76
  ### Changed
package/README.md CHANGED
@@ -105,7 +105,7 @@ please reach out to us for support.
105
105
  </tr>
106
106
  <tr>
107
107
  <td><strong>Advertising Integration</strong></td>
108
- <td colspan="3">Google IMA, Google DAI</td>
108
+ <td colspan="3">Google IMA, Google DAI, THEOads</td>
109
109
  </tr>
110
110
  <tr>
111
111
  <td><strong>Cast Integration</strong></td>
@@ -178,6 +178,7 @@ This section gives an overview of features, limitations and known issues:
178
178
  - [Audio Control Management](./doc/audio-control.md)
179
179
  - [Background playback and notifications](./doc/background.md)
180
180
  - [Casting with Chromecast and Airplay](./doc/cast.md)
181
+ - [Common Media Client Data (CMCD)](./doc/cmcd.md)
181
182
  - [Digital Rights Management (DRM)](./doc/drm.md)
182
183
  - [Fullscreen presentation](./doc/fullscreen.md)
183
184
  - [Media Caching](./doc/media-caching.md)
@@ -40,7 +40,6 @@ def enabledTHEOads = safeExtGet("THEOplayer_extensionTHEOads", 'false').toBoolea
40
40
  def enabledAds = enabledGoogleIMA || enabledGoogleDAI || enabledTHEOads
41
41
  def enabledCast = safeExtGet("THEOplayer_extensionCast", 'false').toBoolean()
42
42
  def enabledMediaSession = safeExtGet("THEOplayer_extensionMediaSession", 'true').toBoolean()
43
- def enabledMedia3 = safeExtGet("THEOplayer_extensionMedia3", 'false').toBoolean()
44
43
 
45
44
  android {
46
45
  compileSdk safeExtGet('THEOplayer_compileSdkVersion', 34)
@@ -59,8 +58,9 @@ android {
59
58
  def TimeUpdateRate = "com.theoplayer.TimeUpdateRate"
60
59
  buildConfigField TimeUpdateRate, "TIMEUPDATE_RATE", safeExtGet('THEOplayer_timeUpdateRate', "${TimeUpdateRate}.UNLIMITED")
61
60
 
62
- // Optionally re-parent player view on fullscreen event
61
+ // Optionally re-parent player view on fullscreen or PiP event
63
62
  buildConfigField "boolean", "REPARENT_ON_FULLSCREEN", "${safeExtGet('THEOplayer_reparent_on_fullscreen', 'true')}"
63
+ buildConfigField "boolean", "REPARENT_ON_PIP", "${safeExtGet('THEOplayer_reparent_on_PiP', 'false')}"
64
64
 
65
65
  // Optionally log events to logcat
66
66
  buildConfigField "boolean", "LOG_PLAYER_EVENTS", "${safeExtGet('THEOplayer_logPlayerEvents', 'false')}"
@@ -75,7 +75,6 @@ android {
75
75
  buildConfigField "boolean", "EXTENSION_ADS", "${enabledAds}"
76
76
  buildConfigField "boolean", "EXTENSION_CAST", "${enabledCast}"
77
77
  buildConfigField "boolean", "EXTENSION_MEDIASESSION", "${enabledMediaSession}"
78
- buildConfigField "boolean", "EXTENSION_MEDIA3", "${enabledMedia3}"
79
78
 
80
79
  buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
81
80
 
@@ -124,70 +123,62 @@ repositories {
124
123
  maven { url "https://maven.theoplayer.com/releases" }
125
124
  }
126
125
 
127
- // The minimum supported THEOplayer version is 8.5.1
128
- def theoplayer_sdk_version = safeExtGet('THEOplayer_sdk', '[8.5.1, 9.0.0)')
129
- def theoplayer_mediasession_version = safeExtGet('THEOplayer_mediasession', '[8.0.0, 9.0.0)')
126
+ // The minimum supported THEOplayer version is 9.0.0
127
+ def theoplayer_sdk_version = safeExtGet('THEOplayer_sdk', '[9.0.0, 10.0.0)')
128
+ def theoplayer_mediasession_version = safeExtGet('THEOplayer_mediasession', '[8.0.0, 10.0.0)')
129
+ def theoplayer_ads_wrapper_version = "9.0.0"
130
130
 
131
131
  dependencies {
132
132
  //noinspection GradleDynamicVersion
133
133
  implementation "com.facebook.react:react-native:+" // From node_modules
134
134
  implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:${safeExtGet('coroutinesVersion', '1.7.3')}"
135
135
  implementation "androidx.appcompat:appcompat:${safeExtGet('appcompatVersion', '1.6.1')}"
136
- implementation "androidx.core:core-ktx:${safeExtGet('corektxVersion', '1.10.1')}"
136
+ implementation "androidx.core:core-ktx:${safeExtGet('corektxVersion', '1.13.1')}"
137
137
  implementation "com.google.code.gson:gson:2.11.0"
138
138
 
139
139
  println("Using THEOplayer (${versionString(theoplayer_sdk_version)})")
140
- implementation "com.theoplayer.theoplayer-sdk-android:core:${theoplayer_sdk_version}"
141
- implementation "com.theoplayer.theoplayer-sdk-android:ads-wrapper:8.0.0"
142
- implementation "com.theoplayer.android-connector:mediasession:${theoplayer_mediasession_version}"
140
+ implementation "com.theoplayer.theoplayer-sdk-android:core:$theoplayer_sdk_version"
141
+ implementation "com.theoplayer.theoplayer-sdk-android:ads-wrapper:$theoplayer_ads_wrapper_version"
142
+ implementation "com.theoplayer.android-connector:mediasession:$theoplayer_mediasession_version"
143
143
 
144
144
  if (enabledGoogleIMA) {
145
145
  println('Enable THEOplayer IMA extension.')
146
- implementation "com.theoplayer.theoplayer-sdk-android:integration-ads-ima:${theoplayer_sdk_version}"
146
+ implementation "com.theoplayer.theoplayer-sdk-android:integration-ads-ima:$theoplayer_sdk_version"
147
147
  } else {
148
148
  println('Disable THEOplayer IMA extension.')
149
- compileOnly "com.theoplayer.theoplayer-sdk-android:integration-ads-ima:${theoplayer_sdk_version}"
149
+ compileOnly "com.theoplayer.theoplayer-sdk-android:integration-ads-ima:$theoplayer_sdk_version"
150
150
  }
151
151
 
152
152
  if (enabledGoogleDAI) {
153
153
  println('Enable THEOplayer DAI extension.')
154
- implementation "com.theoplayer.theoplayer-sdk-android:integration-ads-dai:${theoplayer_sdk_version}"
154
+ implementation "com.theoplayer.theoplayer-sdk-android:integration-ads-dai:$theoplayer_sdk_version"
155
155
  } else {
156
156
  println('Disable THEOplayer DAI extension.')
157
- compileOnly "com.theoplayer.theoplayer-sdk-android:integration-ads-dai:${theoplayer_sdk_version}"
157
+ compileOnly "com.theoplayer.theoplayer-sdk-android:integration-ads-dai:$theoplayer_sdk_version"
158
158
  }
159
159
 
160
160
  if (enabledTHEOads) {
161
161
  println('Enable THEOplayer THEOads extension.')
162
- implementation "com.theoplayer.theoplayer-sdk-android:integration-ads-theoads:${theoplayer_sdk_version}"
162
+ implementation "com.theoplayer.theoplayer-sdk-android:integration-ads-theoads:$theoplayer_sdk_version"
163
163
  } else {
164
164
  println('Disable THEOplayer THEOads extension.')
165
- compileOnly "com.theoplayer.theoplayer-sdk-android:integration-ads-theoads:${theoplayer_sdk_version}"
165
+ compileOnly "com.theoplayer.theoplayer-sdk-android:integration-ads-theoads:$theoplayer_sdk_version"
166
166
  }
167
167
 
168
168
  if (enabledCast) {
169
169
  println('Enable THEOplayer cast extension.')
170
- implementation "com.theoplayer.theoplayer-sdk-android:integration-cast:${theoplayer_sdk_version}"
170
+ implementation "com.theoplayer.theoplayer-sdk-android:integration-cast:$theoplayer_sdk_version"
171
171
  } else {
172
172
  println('Disable THEOplayer cast extension.')
173
- compileOnly "com.theoplayer.theoplayer-sdk-android:integration-cast:${theoplayer_sdk_version}"
174
- }
175
-
176
- if (enabledMedia3) {
177
- println('Enable THEOplayer media3 extension.')
178
- implementation "com.theoplayer.theoplayer-sdk-android:integration-media3:${theoplayer_sdk_version}"
179
- } else {
180
- println('Disable THEOplayer media3 extension.')
181
- compileOnly "com.theoplayer.theoplayer-sdk-android:integration-media3:${theoplayer_sdk_version}"
173
+ compileOnly "com.theoplayer.theoplayer-sdk-android:integration-cast:$theoplayer_sdk_version"
182
174
  }
183
175
  }
184
176
 
185
177
  // Make sure to align all ads extension versions
186
178
  configurations.configureEach {
187
179
  resolutionStrategy {
188
- force "com.theoplayer.theoplayer-sdk-android:integration-ads-ima:${theoplayer_sdk_version}"
189
- force "com.theoplayer.theoplayer-sdk-android:integration-ads-dai:${theoplayer_sdk_version}"
190
- force "com.theoplayer.theoplayer-sdk-android:integration-ads-theoads:${theoplayer_sdk_version}"
180
+ force "com.theoplayer.theoplayer-sdk-android:integration-ads-ima:$theoplayer_sdk_version"
181
+ force "com.theoplayer.theoplayer-sdk-android:integration-ads-dai:$theoplayer_sdk_version"
182
+ force "com.theoplayer.theoplayer-sdk-android:integration-ads-theoads:$theoplayer_sdk_version"
191
183
  }
192
184
  }
193
-
@@ -1,10 +1,10 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
3
3
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
4
- <modelVersion>8.0.0</modelVersion>
4
+ <modelVersion>9.0.0</modelVersion>
5
5
  <groupId>com.theoplayer.theoplayer-sdk-android</groupId>
6
6
  <artifactId>ads-wrapper</artifactId>
7
- <version>8.0.0</version>
7
+ <version>9.0.0</version>
8
8
  <packaging>aar</packaging>
9
9
  <dependencies>
10
10
  <!-- Include transitive dependencies -->
@@ -3,11 +3,11 @@
3
3
  <groupId>com.theoplayer.theoplayer-sdk-android</groupId>
4
4
  <artifactId>ads-wrapper</artifactId>
5
5
  <versioning>
6
- <latest>8.0.0</latest>
7
- <release>8.0.0</release>
6
+ <latest>9.0.0</latest>
7
+ <release>9.0.0</release>
8
8
  <versions>
9
- <version>8.0.0</version>
9
+ <version>9.0.0</version>
10
10
  </versions>
11
- <lastUpdated>20240909163212</lastUpdated>
11
+ <lastUpdated>20250327163212</lastUpdated>
12
12
  </versioning>
13
13
  </metadata>
@@ -17,12 +17,9 @@ import com.theoplayer.media.MediaSessionConfigAdapter
17
17
  private const val PROP_LICENSE = "license"
18
18
  private const val PROP_LICENSE_URL = "licenseUrl"
19
19
  private const val PROP_PRELOAD = "preload"
20
- private const val PROP_LIVE_OFFSET = "liveOffset"
21
20
  private const val PROP_UI_ENABLED = "uiEnabled"
22
21
  private const val PROP_CAST_STRATEGY = "strategy"
23
22
  private const val PROP_RETRY_CONFIG = "retryConfiguration"
24
- private const val PROP_HLS_DATE_RANGE = "hlsDateRange"
25
- private const val PROP_USE_MEDIA3 = "useMedia3"
26
23
  private const val PROP_RETRY_MAX_RETRIES = "maxRetries"
27
24
  private const val PROP_RETRY_MIN_BACKOFF = "minimumBackoff"
28
25
  private const val PROP_RETRY_MAX_BACKOFF = "maximumBackoff"
@@ -45,12 +42,6 @@ private const val PROP_THEOLIVE_ANALYTICS_DISABLED = "analyticsDisabled"
45
42
 
46
43
  class PlayerConfigAdapter(private val configProps: ReadableMap?) {
47
44
 
48
- /**
49
- * Whether the Media3 extension is used for play-out.
50
- */
51
- var useMedia3: Boolean = false
52
- private set
53
-
54
45
  /**
55
46
  * Get general THEOplayerConfig object; these properties apply:
56
47
  * - license: The license for the player.
@@ -69,19 +60,12 @@ class PlayerConfigAdapter(private val configProps: ReadableMap?) {
69
60
  if (hasKey(PROP_RETRY_CONFIG)) {
70
61
  networkConfiguration(networkConfig())
71
62
  }
72
- if (hasKey(PROP_LIVE_OFFSET)) {
73
- liveOffset(getDouble(PROP_LIVE_OFFSET))
74
- }
75
- if (hasKey(PROP_HLS_DATE_RANGE)) {
76
- hlsDateRange(getBoolean(PROP_HLS_DATE_RANGE))
77
- }
78
- if (hasKey(PROP_USE_MEDIA3)) {
79
- useMedia3 = getBoolean(PROP_USE_MEDIA3)
80
- }
81
63
  if (hasKey(PROP_THEOLIVE_CONFIG)) {
82
64
  theoLiveConfiguration(theoLiveConfig())
83
65
  }
84
66
  pipConfiguration(PipConfiguration.Builder().build())
67
+ // Opt-out for auto-integrations for now
68
+ autoIntegrations(false)
85
69
  }
86
70
  }.build()
87
71
  }
@@ -17,6 +17,7 @@ import com.facebook.react.uimanager.ThemedReactContext
17
17
  import com.theoplayer.android.api.THEOplayerView
18
18
  import com.theoplayer.android.api.ads.dai.GoogleDaiIntegration
19
19
  import com.theoplayer.android.api.ads.dai.GoogleDaiIntegrationFactory
20
+ import com.theoplayer.android.api.ads.ima.GoogleImaConfiguration
20
21
  import com.theoplayer.android.api.ads.ima.GoogleImaIntegration
21
22
  import com.theoplayer.android.api.ads.ima.GoogleImaIntegrationFactory
22
23
  import com.theoplayer.android.api.ads.theoads.TheoAdDescription
@@ -26,8 +27,6 @@ import com.theoplayer.android.api.cast.CastIntegration
26
27
  import com.theoplayer.android.api.cast.CastIntegrationFactory
27
28
  import com.theoplayer.android.api.event.EventListener
28
29
  import com.theoplayer.android.api.event.player.*
29
- import com.theoplayer.android.api.media3.Media3PlayerIntegration
30
- import com.theoplayer.android.api.media3.Media3PlayerIntegrationFactory
31
30
  import com.theoplayer.android.api.player.Player
32
31
  import com.theoplayer.android.api.player.RenderingTarget
33
32
  import com.theoplayer.android.connector.mediasession.MediaSessionConnector
@@ -90,7 +89,6 @@ class ReactTHEOplayerContext private constructor(
90
89
  private var theoAdsIntegration: TheoAdsIntegration? = null
91
90
  var castIntegration: CastIntegration? = null
92
91
  @Suppress("UnstableApiUsage")
93
- private var media3Integration: Media3PlayerIntegration? = null
94
92
  var wasPlayingOnHostPause: Boolean = false
95
93
  private var isHostPaused: Boolean = false
96
94
 
@@ -290,7 +288,7 @@ class ReactTHEOplayerContext private constructor(
290
288
  try {
291
289
  if (BuildConfig.EXTENSION_GOOGLE_IMA) {
292
290
  imaIntegration = GoogleImaIntegrationFactory.createGoogleImaIntegration(
293
- playerView, configAdapter.imaSdkSettings()
291
+ playerView, GoogleImaConfiguration(configAdapter.imaSdkSettings())
294
292
  ).apply {
295
293
  setAdsRenderingSettings(configAdapter.adsRenderSettings())
296
294
  }.also {
@@ -303,7 +301,7 @@ class ReactTHEOplayerContext private constructor(
303
301
  try {
304
302
  if (BuildConfig.EXTENSION_GOOGLE_DAI) {
305
303
  daiIntegration = GoogleDaiIntegrationFactory.createGoogleDaiIntegration(
306
- playerView, configAdapter.imaSdkSettings()
304
+ playerView, GoogleImaConfiguration(configAdapter.imaSdkSettings())
307
305
  ).apply {
308
306
  setAdsRenderingSettings(configAdapter.adsRenderSettings())
309
307
  }.also {
@@ -335,26 +333,6 @@ class ReactTHEOplayerContext private constructor(
335
333
  } catch (e: Exception) {
336
334
  Log.w(TAG, "Failed to configure Cast integration ${e.message}")
337
335
  }
338
- try {
339
- if (BuildConfig.EXTENSION_MEDIA3) {
340
- @Suppress("UnstableApiUsage")
341
- media3Integration =
342
- Media3PlayerIntegrationFactory.createMedia3PlayerIntegration { _, source ->
343
- // selectedSource -> represents the TypedSource the player picked to play.
344
- // source -> represents the SourceDescription passed to the player.
345
- // return true -> the Media3 integration pipeline will be used to play the selected source.
346
- // return false -> the default pipeline will be used to play the selected source.
347
- //
348
- // @remark If the source contains THEOads, media3 is always enabled.
349
- configAdapter.useMedia3 ||
350
- (BuildConfig.EXTENSION_THEOADS && source.ads.any { it is TheoAdDescription })
351
- }
352
- playerView.player.addIntegration(media3Integration)
353
- }
354
- } catch (e: Exception) {
355
- Log.w(TAG, "Failed to configure Cast integration ${e.message}")
356
- }
357
-
358
336
  // Add other future integrations here.
359
337
  }
360
338
 
@@ -1,12 +1,9 @@
1
- @file:Suppress("unused")
2
-
3
1
  package com.theoplayer
4
2
 
5
3
  import com.facebook.react.uimanager.ViewGroupManager
6
4
  import com.facebook.react.uimanager.ThemedReactContext
7
5
  import com.facebook.react.uimanager.annotations.ReactProp
8
6
  import com.facebook.react.bridge.ReadableMap
9
- import com.facebook.react.common.MapBuilder
10
7
 
11
8
  private const val REACT_CLASS = "THEOplayerRCTView"
12
9
 
@@ -35,10 +32,6 @@ class ReactTHEOplayerViewManager : ViewGroupManager<ReactTHEOplayerView>() {
35
32
  }
36
33
 
37
34
  override fun getExportedCustomDirectEventTypeConstants(): Map<String, Any> {
38
- val builder = MapBuilder.builder<String, Any>()
39
- for (event in PlayerEventEmitter.Events) {
40
- builder.put(event, MapBuilder.of("registrationName", event))
41
- }
42
- return builder.build()
35
+ return PlayerEventEmitter.Events.associateWith { mapOf("registrationName" to it) }
43
36
  }
44
37
  }
@@ -9,7 +9,7 @@ import com.google.ads.interactivemedia.v3.api.UiElement
9
9
  import com.theoplayer.android.api.ads.Ad
10
10
  import com.theoplayer.android.api.ads.AdBreak
11
11
  import com.theoplayer.android.api.ads.CompanionAd
12
- import com.theoplayer.android.api.ads.GoogleImaAd
12
+ import com.theoplayer.android.api.ads.ima.GoogleImaAd
13
13
  import com.theoplayer.android.api.ads.UniversalAdId
14
14
  import com.theoplayer.android.api.event.ads.AdIntegrationKind
15
15
  import java.lang.Exception
@@ -23,6 +23,7 @@ private const val PROP_AD_BREAK = "adBreak"
23
23
  private const val PROP_AD_COMPANIONS = "companions"
24
24
  private const val PROP_AD_SKIPOFFSET = "skipOffset"
25
25
  private const val PROP_AD_CREATIVE_ID = "creativeId"
26
+ private const val PROP_AD_DESCRIPTION = "description"
26
27
  private const val PROP_AD_TRAFFICKING_PARAMETERS = "traffickingParametersString"
27
28
  private const val PROP_AD_BITRATE = "bitrate"
28
29
  private const val PROP_AD_UNIVERSAL_AD_IDS = "universalAdIds"
@@ -95,6 +96,7 @@ object AdAdapter {
95
96
  adPayload.putDouble(PROP_AD_WIDTH, ad.imaAd.vastMediaWidth.toDouble())
96
97
  adPayload.putDouble(PROP_AD_HEIGHT, ad.imaAd.vastMediaHeight.toDouble())
97
98
  adPayload.putString(PROP_AD_CONTENT_TYPE, ad.imaAd.contentType)
99
+ adPayload.putString(PROP_AD_DESCRIPTION, ad.imaAd.description)
98
100
  } catch (ignore: Exception) {
99
101
  // googleImaAd.getImaAd() is not known yet
100
102
  }
@@ -103,9 +105,9 @@ object AdAdapter {
103
105
  val idPayload = Arguments.createMap()
104
106
  idPayload.putString(
105
107
  PROP_UNIVERSAL_AD_ID_REGISTRY,
106
- universalAdId.universalAdIdRegistry
108
+ universalAdId?.universalAdIdRegistry
107
109
  )
108
- idPayload.putString(PROP_UNIVERSAL_AD_ID_VALUE, universalAdId.universalAdIdValue)
110
+ idPayload.putString(PROP_UNIVERSAL_AD_ID_VALUE, universalAdId?.universalAdIdValue)
109
111
  universalAdIdsPayload.pushMap(idPayload)
110
112
  }
111
113
  adPayload.putArray(PROP_AD_UNIVERSAL_AD_IDS, universalAdIdsPayload)
@@ -215,41 +217,32 @@ object AdAdapter {
215
217
  return null
216
218
  }
217
219
 
218
- override fun getImaAd(): com.google.ads.interactivemedia.v3.api.Ad {
219
- return parseImaAd(ad)
220
- }
220
+ override val imaAd: com.google.ads.interactivemedia.v3.api.Ad
221
+ get() = parseImaAd(ad)
221
222
 
222
- override fun getAdSystem(): String {
223
- return ad.getString(PROP_AD_SYSTEM) ?: ""
224
- }
223
+ override val adSystem: String?
224
+ get() = ad.getString(PROP_AD_SYSTEM)
225
225
 
226
- override fun getCreativeId(): String? {
227
- return ad.getString(PROP_AD_CREATIVE_ID)
228
- }
226
+ override val creativeId: String?
227
+ get() = ad.getString(PROP_AD_CREATIVE_ID)
229
228
 
230
- override fun getWrapperAdIds(): List<String> {
231
- return emptyList()
232
- }
229
+ override val wrapperAdIds: List<String?>
230
+ get() = emptyList()
233
231
 
234
- override fun getWrapperAdSystems(): List<String> {
235
- return emptyList()
236
- }
232
+ override val wrapperAdSystems: List<String?>
233
+ get() = emptyList()
237
234
 
238
- override fun getWrapperCreativeIds(): List<String> {
239
- return emptyList()
240
- }
235
+ override val wrapperCreativeIds: List<String?>
236
+ get() = emptyList()
241
237
 
242
- override fun getVastMediaBitrate(): Int {
243
- return if (ad.hasKey(PROP_AD_BITRATE)) ad.getInt(PROP_AD_BITRATE) else 0
244
- }
238
+ override val vastMediaBitrate: Int
239
+ get() = if (ad.hasKey(PROP_AD_BITRATE)) ad.getInt(PROP_AD_BITRATE) else 0
245
240
 
246
- override fun getUniversalAdIds(): List<UniversalAdId> {
247
- return emptyList()
248
- }
241
+ override val universalAdIds: List<UniversalAdId?>
242
+ get() = emptyList()
249
243
 
250
- override fun getTraffickingParameters(): String {
251
- return ad.getString(PROP_AD_TRAFFICKING_PARAMETERS) ?: ""
252
- }
244
+ override val traffickingParameters: String
245
+ get() = ad.getString(PROP_AD_TRAFFICKING_PARAMETERS) ?: ""
253
246
  }
254
247
  }
255
248
 
@@ -399,7 +392,7 @@ object AdAdapter {
399
392
  }
400
393
 
401
394
  override fun getDescription(): String {
402
- return ""
395
+ return ad?.getString(PROP_AD_DESCRIPTION) ?: ""
403
396
  }
404
397
 
405
398
  override fun getSurveyUrl(): String {
@@ -7,7 +7,7 @@ import com.facebook.react.bridge.WritableMap
7
7
  import com.google.ads.interactivemedia.v3.api.AdError
8
8
  import com.theoplayer.android.api.ads.Ad
9
9
  import com.theoplayer.android.api.ads.AdBreak
10
- import com.theoplayer.android.api.ads.GoogleImaAd
10
+ import com.theoplayer.android.api.ads.ima.GoogleImaAd
11
11
  import com.theoplayer.android.api.ads.ima.GoogleImaAdEvent
12
12
  import com.theoplayer.android.api.ads.ima.GoogleImaAdEventType
13
13
  import com.theoplayer.android.api.ads.wrapper.AdEventListener
@@ -6,6 +6,7 @@ import com.facebook.react.bridge.ReadableMap
6
6
  import com.facebook.react.bridge.WritableArray
7
7
  import com.facebook.react.bridge.WritableMap
8
8
  import com.theoplayer.android.api.cache.CacheStatus
9
+ import com.theoplayer.android.api.cache.CacheStorageType
9
10
  import com.theoplayer.android.api.cache.CachingParameters
10
11
  import com.theoplayer.android.api.cache.CachingPreferredTrackSelection
11
12
  import com.theoplayer.android.api.cache.CachingTask
@@ -26,6 +27,7 @@ private const val PROP_PARAMETERS_BANDWIDTH = "bandwidth"
26
27
  private const val PROP_PARAMETERS_PREFERRED_TRACK_SELECTION = "preferredTrackSelection"
27
28
  private const val PROP_PARAMETERS_AUDIO_TRACK_SELECTION = "audioTrackSelection"
28
29
  private const val PROP_PARAMETERS_TEXT_TRACK_SELECTION = "textTrackSelection"
30
+ private const val PROP_PARAMETERS_STORAGE_TYPE = "storageType"
29
31
  private const val PROP_DURATION = "duration"
30
32
  private const val PROP_CACHED = "cached"
31
33
  private const val PROP_SECONDS_CACHED = "secondsCached"
@@ -101,6 +103,12 @@ object CacheAdapter {
101
103
  if (parameters.hasKey(PROP_PARAMETERS_PREFERRED_TRACK_SELECTION)) {
102
104
  preferredTrackSelection(parsePreferredTrackSelection(parameters.getMap(PROP_PARAMETERS_PREFERRED_TRACK_SELECTION)))
103
105
  }
106
+ if (parameters.hasKey(PROP_PARAMETERS_STORAGE_TYPE)) {
107
+ storageType(when (parameters.getString(PROP_PARAMETERS_STORAGE_TYPE)) {
108
+ "legacy" -> CacheStorageType.LEGACY
109
+ else -> CacheStorageType.MEDIA3
110
+ })
111
+ }
104
112
  }.build()
105
113
  }
106
114
 
@@ -121,6 +129,10 @@ object CacheAdapter {
121
129
  putString(PROP_PARAMETERS_AMOUNT, parameters.amount)
122
130
  putDouble(PROP_PARAMETERS_BANDWIDTH, parameters.bandwidth.toDouble())
123
131
  putDouble(PROP_PARAMETERS_EXPIRATION_DATE, parameters.expirationDate.time.toDouble())
132
+ putString(PROP_PARAMETERS_STORAGE_TYPE, when (parameters.storageType) {
133
+ CacheStorageType.LEGACY -> "legacy"
134
+ CacheStorageType.MEDIA3 -> "media3"
135
+ })
124
136
  }
125
137
  }
126
138
  }
@@ -0,0 +1,8 @@
1
+ package com.theoplayer.cmcd
2
+
3
+ enum class CmcdTransmissionMode {
4
+ HTTP_HEADER,
5
+ QUERY_ARGUMENT,
6
+ JSON_OBJECT,
7
+ SDK_DEFAULT
8
+ }
@@ -263,4 +263,17 @@ class PlayerModule(context: ReactApplicationContext) : ReactContextBaseJavaModul
263
263
  )
264
264
  }
265
265
  }
266
+
267
+ @ReactMethod(isBlockingSynchronousMethod = true)
268
+ fun getUsableScreenDimensions(): WritableMap {
269
+ // Pass the dimensions of the top-most View in the view hierarchy.
270
+ val topView = reactApplicationContext.currentActivity?.window?.decorView?.rootView
271
+ reactApplicationContext.resources.displayMetrics.also {
272
+ val density = it.density
273
+ return Arguments.createMap().apply {
274
+ putDouble("width", (topView?.width ?: 0) / density.toDouble())
275
+ putDouble("height", (topView?.height ?: 0) / density.toDouble())
276
+ }
277
+ }
278
+ }
266
279
  }
@@ -0,0 +1,39 @@
1
+ package com.theoplayer.presentation
2
+
3
+ import android.util.Log
4
+ import android.view.ViewTreeObserver
5
+ import com.facebook.react.views.view.ReactViewGroup
6
+
7
+ private val TAG = "FSLayoutObserver"
8
+
9
+ /**
10
+ * FullScreenLayoutObserver makes sure that the React Native view does not get the layout
11
+ * defined in React-Native during fullscreen presentation mode. We want to enforce fullscreen
12
+ * position & size.
13
+ */
14
+ class FullScreenLayoutObserver {
15
+ private var globalLayoutListener: ViewTreeObserver.OnGlobalLayoutListener? = null
16
+ private var attached: ReactViewGroup? = null
17
+
18
+ fun attach(viewGroup: ReactViewGroup?) {
19
+ if (attached != null) {
20
+ Log.w(TAG, "A previously attached ViewGroup was not properly detached.")
21
+ }
22
+
23
+ viewGroup?.let {
24
+ globalLayoutListener = ViewTreeObserver.OnGlobalLayoutListener {
25
+ it.post {
26
+ it.layout(0, 0, viewGroup.width, viewGroup.height)
27
+ }
28
+ }
29
+ it.viewTreeObserver.addOnGlobalLayoutListener(globalLayoutListener)
30
+ attached = viewGroup
31
+ }
32
+ }
33
+
34
+ fun remove() {
35
+ attached?.viewTreeObserver?.removeOnGlobalLayoutListener(globalLayoutListener)
36
+ attached = null
37
+ globalLayoutListener = null
38
+ }
39
+ }
@@ -12,9 +12,6 @@ import android.graphics.Rect
12
12
  import android.graphics.drawable.Icon
13
13
  import android.os.Build
14
14
  import android.util.Rational
15
- import android.view.SurfaceView
16
- import android.view.TextureView
17
- import android.view.View
18
15
  import android.view.ViewGroup
19
16
  import androidx.annotation.RequiresApi
20
17
  import com.facebook.react.uimanager.ThemedReactContext
@@ -108,7 +105,8 @@ class PipUtils(
108
105
  }
109
106
  try {
110
107
  reactContext.currentActivity?.unregisterReceiver(broadcastReceiver)
111
- } catch (ignore: IllegalArgumentException) { /*ignore*/}
108
+ } catch (ignore: IllegalArgumentException) { /*ignore*/
109
+ }
112
110
  enabled = false
113
111
  }
114
112
 
@@ -189,17 +187,13 @@ class PipUtils(
189
187
  }
190
188
 
191
189
  private fun getContentViewRect(view: ViewGroup): Rect? {
192
- for (i in 0 until view.childCount) {
193
- val child: View = view.getChildAt(i)
194
- if (child is ViewGroup) {
195
- return getContentViewRect(child)
196
- } else if (child as? SurfaceView != null || child as? TextureView != null) {
197
- val visibleRect = Rect()
198
- child.getGlobalVisibleRect(visibleRect)
199
- return visibleRect
190
+ return view.findViewById<ViewGroup>(com.theoplayer.android.R.id.theo_content_player_container)
191
+ ?.getChildAt(0) // AspectRatioView
192
+ ?.run {
193
+ Rect().apply {
194
+ getGlobalVisibleRect(this)
195
+ }
200
196
  }
201
- }
202
- return null
203
197
  }
204
198
 
205
199
  @RequiresApi(Build.VERSION_CODES.O)