react-native-theoplayer 8.12.0 → 8.13.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,6 +5,26 @@ 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
+ ## [8.13.1] - 25-01-27
9
+
10
+ ### Fixed
11
+
12
+ - Fixed an issue on iOS where fullscreen-inline transitions would cause a UIViewControllerHierarchyInconsistency when the current view's viewcController has sibling viewControllers that manage views that don't descend of the moving view.
13
+
14
+ ## [8.13.0] - 25-01-15
15
+
16
+ ### Added
17
+
18
+ - Added support for New Architecture's through the Interop Layer. More info on the [React Native developer pages](https://reactnative.dev/architecture/landing-page).
19
+
20
+ ### Fixed
21
+
22
+ - Fixed an issue on Web where picture-in-picture presentation mode would sometimes fail.
23
+
24
+ ### Changed
25
+
26
+ - Upgraded the example app to use react-native-tvos@0.76.5-0.
27
+
8
28
  ## [8.12.0] - 25-01-09
9
29
 
10
30
  ### Fixed
@@ -25,6 +25,14 @@ static def versionString(version) {
25
25
  return "${version == '+' ? 'latest' : version}"
26
26
  }
27
27
 
28
+ def isNewArchitectureEnabled() {
29
+ // To opt-in for the New Architecture, you can either:
30
+ // - Set `newArchEnabled` to true inside the `gradle.properties` file
31
+ // - Invoke gradle with `-newArchEnabled=true`
32
+ // - Set an environment variable `ORG_GRADLE_PROJECT_newArchEnabled=true`
33
+ return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
34
+ }
35
+
28
36
  // Extensions
29
37
  def enabledGoogleIMA = safeExtGet("THEOplayer_extensionGoogleIMA", 'false').toBoolean()
30
38
  def enabledGoogleDAI = safeExtGet("THEOplayer_extensionGoogleDAI", 'false').toBoolean()
@@ -69,6 +77,8 @@ android {
69
77
  buildConfigField "boolean", "EXTENSION_MEDIASESSION", "${enabledMediaSession}"
70
78
  buildConfigField "boolean", "EXTENSION_MEDIA3", "${enabledMedia3}"
71
79
 
80
+ buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
81
+
72
82
  consumerProguardFiles 'proguard-rules.pro'
73
83
  }
74
84
 
@@ -8,7 +8,7 @@ import com.facebook.react.bridge.ReactApplicationContext
8
8
  import com.facebook.react.bridge.WritableMap
9
9
  import com.facebook.react.bridge.WritableNativeMap
10
10
  import com.facebook.react.uimanager.UIManagerHelper
11
- import com.facebook.react.uimanager.common.ViewUtil
11
+ import com.facebook.react.uimanager.common.UIManagerType
12
12
  import com.theoplayer.ads.AdEventAdapter
13
13
  import com.theoplayer.ads.AdEventAdapter.AdEventEmitter
14
14
  import com.theoplayer.android.api.THEOplayerGlobal
@@ -47,7 +47,6 @@ import com.theoplayer.track.*
47
47
  import com.theoplayer.util.PayloadBuilder
48
48
  import kotlin.math.floor
49
49
 
50
-
51
50
  private val TAG = PlayerEventEmitter::class.java.name
52
51
 
53
52
  private const val EVENT_PLAYER_READY = "onNativePlayerReady"
@@ -613,8 +612,13 @@ class PlayerEventEmitter internal constructor(
613
612
  } catch (ignore: RuntimeException) {
614
613
  }
615
614
  }
616
- val uiManager = UIManagerHelper.getUIManager(reactContext, ViewUtil.getUIManagerType(viewId))
617
- uiManager?.receiveEvent(UIManagerHelper.getSurfaceId(reactContext), viewId, type, event)
615
+ UIManagerHelper.getUIManager(
616
+ reactContext,
617
+ if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
618
+ UIManagerType.FABRIC
619
+ } else {
620
+ UIManagerType.DEFAULT
621
+ })?.receiveEvent(UIManagerHelper.getSurfaceId(playerView), viewId, type, event)
618
622
  }
619
623
 
620
624
  private fun attachListeners(player: Player) {
@@ -26,6 +26,7 @@ class ReactTHEOplayerView(private val reactContext: ThemedReactContext) :
26
26
  var presentationManager: PresentationManager? = null
27
27
  var playerContext: ReactTHEOplayerContext? = null
28
28
  private var isInitialized: Boolean = false
29
+ private var config: PlayerConfigAdapter? = null
29
30
 
30
31
  val adsApi: AdsApiWrapper
31
32
 
@@ -40,7 +41,7 @@ class ReactTHEOplayerView(private val reactContext: ThemedReactContext) :
40
41
  adsApi = AdsApiWrapper()
41
42
  }
42
43
 
43
- fun initialize(configProps: ReadableMap?) {
44
+ fun initialize(config: PlayerConfigAdapter) {
44
45
  if (BuildConfig.LOG_VIEW_EVENTS) {
45
46
  Log.d(TAG, "Initialize view")
46
47
  }
@@ -48,10 +49,15 @@ class ReactTHEOplayerView(private val reactContext: ThemedReactContext) :
48
49
  Log.w(TAG, "Already initialized view")
49
50
  return
50
51
  }
52
+ this.config = config
53
+ if (!isAttachedToWindow) {
54
+ // The view is not attached to the window yet, postpone the initialization.
55
+ return
56
+ }
51
57
  isInitialized = true
52
58
  playerContext = ReactTHEOplayerContext.create(
53
59
  reactContext,
54
- PlayerConfigAdapter(configProps)
60
+ config
55
61
  )
56
62
  playerContext?.apply {
57
63
  adsApi.initialize(player, imaIntegration, daiIntegration)
@@ -59,17 +65,22 @@ class ReactTHEOplayerView(private val reactContext: ThemedReactContext) :
59
65
  playerView.layoutParams = layoutParams
60
66
  (playerView.parent as? ViewGroup)?.removeView(playerView)
61
67
  addView(playerView, 0, layoutParams)
62
-
63
68
  presentationManager = PresentationManager(
64
69
  this,
65
70
  reactContext,
66
71
  eventEmitter
67
72
  )
68
-
69
73
  eventEmitter.preparePlayer(player)
70
74
  }
71
75
  }
72
76
 
77
+ override fun onAttachedToWindow() {
78
+ super.onAttachedToWindow()
79
+ if (!isInitialized) {
80
+ config?.let { initialize(it) }
81
+ }
82
+ }
83
+
73
84
  override fun setId(id: Int) {
74
85
  super.setId(id)
75
86
  eventEmitter.setViewId(id)
@@ -31,7 +31,7 @@ class ReactTHEOplayerViewManager : ViewGroupManager<ReactTHEOplayerView>() {
31
31
 
32
32
  @ReactProp(name = PROP_CONFIG)
33
33
  fun setConfig(videoView: ReactTHEOplayerView, config: ReadableMap?) {
34
- videoView.initialize(config)
34
+ videoView.initialize(PlayerConfigAdapter(config))
35
35
  }
36
36
 
37
37
  override fun getExportedCustomDirectEventTypeConstants(): Map<String, Any> {
@@ -16,6 +16,7 @@ import androidx.core.view.WindowInsetsCompat
16
16
  import androidx.core.view.WindowInsetsControllerCompat
17
17
  import androidx.lifecycle.Lifecycle
18
18
  import com.facebook.react.ReactRootView
19
+ import com.facebook.react.runtime.ReactSurfaceView
19
20
  import com.facebook.react.uimanager.ThemedReactContext
20
21
  import com.facebook.react.views.view.ReactViewGroup
21
22
  import com.theoplayer.BuildConfig
@@ -211,7 +212,7 @@ class PresentationManager(
211
212
  // Get the player's ReactViewGroup parent, which contains THEOplayerView and its children (typically the UI).
212
213
  val reactPlayerGroup: ReactViewGroup? = getClosestParentOfType(this.viewCtx.playerView)
213
214
 
214
- // Get ReactNative's root node or the render hiearchy
215
+ // Get ReactNative's root node or the render hierarchy
215
216
  val root: ReactRootView? = getClosestParentOfType(reactPlayerGroup)
216
217
 
217
218
  if (fullscreen) {
@@ -223,7 +224,11 @@ class PresentationManager(
223
224
  if (!BuildConfig.REPARENT_ON_FULLSCREEN) {
224
225
  return
225
226
  }
226
- playerGroupParentNode = (reactPlayerGroup?.parent as ReactViewGroup?)?.also { parent ->
227
+ playerGroupParentNode = if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
228
+ reactPlayerGroup?.parent as? ReactSurfaceView?
229
+ } else {
230
+ reactPlayerGroup?.parent as? ReactViewGroup?
231
+ }?.also { parent ->
227
232
  playerGroupChildIndex = parent.indexOfChild(reactPlayerGroup)
228
233
  // Re-parent the playerViewGroup to the root node
229
234
  parent.removeView(reactPlayerGroup)
@@ -3,31 +3,28 @@ package com.theoplayer.util
3
3
  import android.util.Log
4
4
  import android.view.View
5
5
  import com.facebook.react.bridge.ReactApplicationContext
6
- import com.facebook.react.uimanager.UIManagerModule
6
+ import com.facebook.react.uimanager.UIManagerHelper
7
7
 
8
8
  private const val TAG = "ViewResolver"
9
9
  private const val INVALID_TAG = -1
10
10
 
11
11
  @Suppress("UNCHECKED_CAST")
12
12
  class ViewResolver(private val reactContext: ReactApplicationContext) {
13
- private var uiManager: UIManagerModule? = null
14
-
15
13
  fun <T: View> resolveViewByTag(tag: Int, onResolved: (view: T?) -> Unit) {
16
14
  if (tag == INVALID_TAG) {
17
15
  // Don't bother trying to resolve an invalid tag.
18
16
  onResolved(null)
19
17
  }
20
- if (uiManager == null) {
21
- uiManager = reactContext.getNativeModule(UIManagerModule::class.java)
22
- }
23
- uiManager?.addUIBlock {
24
- try {
25
- onResolved(it.resolveView(tag) as? T?)
26
- } catch (e: Exception) {
27
- // The View instance could not be resolved: log but do not forward exception.
28
- Log.e(TAG, "Failed to resolve View tag $tag: $e")
29
- onResolved(null)
18
+ try {
19
+ reactContext.runOnUiQueueThread {
20
+ UIManagerHelper.getUIManagerForReactTag(reactContext, tag)?.let {
21
+ onResolved(it.resolveView(tag) as? T?)
22
+ }
30
23
  }
24
+ } catch (e: Exception) {
25
+ // The ReactTHEOplayerView instance could not be resolved: log but do not forward exception.
26
+ Log.e(TAG, "Failed to resolve ReactTHEOplayerView tag $tag: $e")
27
+ onResolved(null)
31
28
  }
32
29
  }
33
30
  }
@@ -79,6 +79,11 @@ extension THEOplayerRCTAdsAPI {
79
79
  resolve(false)
80
80
  }
81
81
 
82
+ @objc(daiSetSnapback:enabled:)
83
+ func daiSetSnapback(_ node: NSNumber, enabled: Bool) -> Void {
84
+ if DEBUG_ADS_API { print(ERROR_MESSAGE_ADS_UNSUPPORTED_FEATURE) }
85
+ }
86
+
82
87
  @objc(daiContentTimeForStreamTime:time:resolver:rejecter:)
83
88
  func daiContentTimeForStreamTime(_ node: NSNumber, timeValue: NSNumber, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) -> Void {
84
89
  if DEBUG_ADS_API { print(ERROR_MESSAGE_ADS_UNSUPPORTED_FEATURE) }
@@ -11,7 +11,6 @@ public class THEOplayerRCTPresentationModeManager {
11
11
  var presentationModeContext = THEOplayerRCTPresentationModeContext()
12
12
  private var presentationMode: THEOplayerSDK.PresentationMode = .inline
13
13
  private var rnInlineMode: THEOplayerSDK.PresentationMode = .inline // while native player is inline, RN player can be inline or fullsceen
14
- private var movingChildVCs: [UIViewController] = [] // list of playerView's child VCs that need to be reparented while moving the playerView
15
14
 
16
15
 
17
16
  private weak var containerView: UIView? // view containing the playerView and it's siblings (e.g. UI)
@@ -27,7 +26,6 @@ public class THEOplayerRCTPresentationModeManager {
27
26
  func destroy() {
28
27
  // dettach listeners
29
28
  self.dettachListeners()
30
- self.clearMovingVCs()
31
29
  }
32
30
 
33
31
  // MARK: - player setup / breakdown
@@ -40,21 +38,22 @@ public class THEOplayerRCTPresentationModeManager {
40
38
  }
41
39
 
42
40
  // MARK: - logic
43
- private func storeMovingVCs(for view: UIView) {
41
+ private func movingVCs(for view: UIView) -> [UIViewController] {
42
+ var viewControllers: [UIViewController] = []
44
43
  if let viewController = view.findViewController() {
45
44
  viewController.children.forEach { childVC in
46
- self.movingChildVCs.append(childVC)
45
+ if childVC.view.isDescendant(of: view) {
46
+ viewControllers.append(childVC)
47
+ }
47
48
  }
48
49
  }
49
- }
50
-
51
- private func clearMovingVCs() {
52
- self.movingChildVCs = []
50
+ return viewControllers
53
51
  }
54
52
 
55
53
  private func moveView(_ movingView: UIView, to targetView: UIView) {
56
54
  // detach the moving viewControllers from their parent
57
- self.movingChildVCs.forEach { movedVC in
55
+ let movingViewControllers = self.movingVCs(for: movingView)
56
+ movingViewControllers.forEach { movedVC in
58
57
  movedVC.removeFromParent()
59
58
  }
60
59
 
@@ -65,7 +64,7 @@ public class THEOplayerRCTPresentationModeManager {
65
64
 
66
65
  // attach the moving viewControllers to their new parent
67
66
  if let targetViewController = targetView.findViewController() {
68
- self.movingChildVCs.forEach { movedVC in
67
+ movingViewControllers.forEach { movedVC in
69
68
  targetViewController.addChild(movedVC)
70
69
  movedVC.didMove(toParent: targetViewController)
71
70
  }
@@ -73,13 +72,12 @@ public class THEOplayerRCTPresentationModeManager {
73
72
  }
74
73
 
75
74
  private func enterFullscreen() {
76
- self.containerView = self.view?.findParentViewOfType(RCTView.self)
77
- self.inlineParentView = self.containerView?.findParentViewOfType(RCTView.self)
75
+ self.containerView = self.view?.findParentViewOfType(["RCTView", "RCTViewComponentView"])
76
+ self.inlineParentView = self.containerView?.superview
78
77
 
79
78
  // move the player
80
79
  if let containerView = self.containerView,
81
- let fullscreenParentView = self.view?.findParentViewOfType(RCTRootContentView.self) {
82
- self.storeMovingVCs(for: containerView)
80
+ let fullscreenParentView = self.view?.findParentViewOfType(["RCTRootContentView", "RCTRootComponentView"]) {
83
81
  self.moveView(containerView, to: fullscreenParentView)
84
82
 
85
83
  // start hiding home indicator
@@ -96,14 +94,13 @@ public class THEOplayerRCTPresentationModeManager {
96
94
  if let containerView = self.containerView,
97
95
  let inlineParentView = self.inlineParentView {
98
96
  self.moveView(containerView, to: inlineParentView)
99
- self.clearMovingVCs()
100
97
  }
101
98
  self.rnInlineMode = .inline
102
99
  }
103
100
 
104
101
  private func setHomeIndicatorHidden(_ hidden: Bool) {
105
102
  #if os(iOS)
106
- if let fullscreenParentView = self.view?.findParentViewOfType(RCTRootContentView.self),
103
+ if let fullscreenParentView = self.view?.findParentViewOfType(["RCTRootContentView", "RCTRootComponentView"]),
107
104
  let customRootViewController = fullscreenParentView.findViewController() as? HomeIndicatorViewController {
108
105
  customRootViewController.prefersAutoHidden = hidden
109
106
  customRootViewController.setNeedsUpdateOfHomeIndicatorAutoHidden()
@@ -216,11 +213,14 @@ public class THEOplayerRCTPresentationModeManager {
216
213
 
217
214
  // UIView extension to look for parent views
218
215
  extension UIView {
219
- func findParentViewOfType<T: UIView>(_ viewType: T.Type) -> T? {
216
+ func findParentViewOfType(_ viewTypeNames: [String]) -> UIView? {
220
217
  var currentView: UIView? = self
221
218
  while let view = currentView {
222
- if let parentView = view.superview as? T {
223
- return parentView
219
+ if let parentView = view.superview {
220
+ let instanceTypeName = String(describing: type(of: parentView))
221
+ if viewTypeNames.contains(instanceTypeName) {
222
+ return parentView
223
+ }
224
224
  }
225
225
  currentView = view.superview
226
226
  }
@@ -14,6 +14,7 @@ class WebPresentationModeManager {
14
14
  constructor(player, eventForwarder) {
15
15
  this._player = player;
16
16
  this._eventForwarder = eventForwarder;
17
+ this._player.presentation.addEventListener('presentationmodechange', this.updatePresentationMode);
17
18
  }
18
19
  get presentationMode() {
19
20
  return this._presentationMode;
@@ -34,7 +35,7 @@ class WebPresentationModeManager {
34
35
  }
35
36
  }
36
37
  } else if (presentationMode === _reactNativeTheoplayer.PresentationMode.pip) {
37
- void this._element?.requestPictureInPicture?.();
38
+ this._player.presentation.requestMode('native-picture-in-picture');
38
39
  } else {
39
40
  if (this._presentationMode === _reactNativeTheoplayer.PresentationMode.fullscreen) {
40
41
  const promise = document[_FullscreenAPI.fullscreenAPI.exitFullscreen_]();
@@ -51,7 +52,7 @@ class WebPresentationModeManager {
51
52
  if (presentationMode === _reactNativeTheoplayer.PresentationMode.fullscreen) {
52
53
  this._element?.webkitEnterFullscreen?.();
53
54
  } else if (presentationMode === _reactNativeTheoplayer.PresentationMode.pip) {
54
- this._element?.webkitSetPresentationMode?.(_reactNativeTheoplayer.PresentationMode.pip);
55
+ this._player.presentation.requestMode('native-picture-in-picture');
55
56
  } else {
56
57
  this._element?.webkitSetPresentationMode?.(_reactNativeTheoplayer.PresentationMode.inline);
57
58
  }
@@ -68,15 +69,6 @@ class WebPresentationModeManager {
68
69
  }
69
70
  }
70
71
  }
71
- // listen for pip updates on element
72
- if (this._element !== undefined) {
73
- this._element.onenterpictureinpicture = () => {
74
- this.updatePresentationMode();
75
- };
76
- this._element.onleavepictureinpicture = () => {
77
- this.updatePresentationMode();
78
- };
79
- }
80
72
  // listen for fullscreen updates on document
81
73
  if (_FullscreenAPI.fullscreenAPI !== undefined) {
82
74
  document.addEventListener(_FullscreenAPI.fullscreenAPI.fullscreenchange_, this.updatePresentationMode);
@@ -88,7 +80,7 @@ class WebPresentationModeManager {
88
80
  let newPresentationMode = _reactNativeTheoplayer.PresentationMode.inline;
89
81
  if (_FullscreenAPI.fullscreenAPI !== undefined && document[_FullscreenAPI.fullscreenAPI.fullscreenElement_] !== null) {
90
82
  newPresentationMode = _reactNativeTheoplayer.PresentationMode.fullscreen;
91
- } else if (document.pictureInPictureElement !== null) {
83
+ } else if (this._player.presentation.currentMode === 'native-picture-in-picture') {
92
84
  newPresentationMode = _reactNativeTheoplayer.PresentationMode.pip;
93
85
  }
94
86
 
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNativeTheoplayer","require","_PlayerEvents","_FullscreenAPI","_CommonUtils","WebPresentationModeManager","_presentationMode","PresentationMode","inline","_element","undefined","constructor","player","eventForwarder","_player","_eventForwarder","presentationMode","prepareForPresentationModeChanges","fullscreenAPI","fullscreen","appElement","document","getElementById","promise","requestFullscreen_","then","noOp","pip","requestPictureInPicture","exitFullscreen_","exitPictureInPicture","webkitEnterFullscreen","webkitSetPresentationMode","elements","element","children","Array","from","tagName","videoElement","src","srcObject","onenterpictureinpicture","updatePresentationMode","onleavepictureinpicture","addEventListener","fullscreenchange_","fullscreenerror_","newPresentationMode","fullscreenElement_","pictureInPictureElement","previousPresentationMode","dispatchEvent","DefaultPresentationModeChangeEvent","exports"],"sourceRoot":"../../../../../src","sources":["internal/adapter/web/WebPresentationModeManager.ts"],"mappings":";;;;;;AACA,IAAAA,sBAAA,GAAAC,OAAA;AAEA,IAAAC,aAAA,GAAAD,OAAA;AAEA,IAAAE,cAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAEO,MAAMI,0BAA0B,CAAC;EAE9BC,iBAAiB,GAAqBC,uCAAgB,CAACC,MAAM;EAC7DC,QAAQ,GAAiCC,SAAS;EAG1DC,WAAWA,CAACC,MAAwB,EAAEC,cAAsD,EAAE;IAC5F,IAAI,CAACC,OAAO,GAAGF,MAAM;IACrB,IAAI,CAACG,eA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AAI,CAACH,sBAAsB,CAAC;MACvFtB,QAAQ,CAACwB,gBAAgB,CAAC3B,4BAAa,CAAC6B,gBAAgB,EAAE,IAAI,CAACJ,sBAAsB,CAAC;IACxF;EACF;EAEQA,sBAAsB,GAAGA,CAAA,KAAM;IACrC;IACA,IAAIK,mBAAqC,GAAGzC,uCAAgB,CAACC,MAAM;IACnE,IAAIU,4BAAa,KAAKR,SAAS,IAAIW,QAAQ,CAACH,4BAAa,CAAC+B,kBAAkB,CAAC,KAAK,IAAI,EAAE;MACtFD,mBAAmB,GAAGzC,uCAAgB,CAACY,UAAU;IACnD,CAAC,MAAM,IAAIE,QAAQ,CAAC6B,uBAAuB,KAAK,IAAI,EAAE;MACpDF,mBAAmB,GAAGzC,uCAAgB,CAACoB,GAAG;IAC5C;;IAEA;IACA,MAAMwB,wBAAwB,GAAG,IAAI,CAAC7C,iBAAiB;IACvD,IAAI0C,mBAAmB,KAAKG,wBAAwB,EAAE;MACpD,IAAI,CAAC7C,iBAAiB,GAAG0C,mBAAmB;MAC5C,IAAI,CAACjC,eAAe,CAACqC,aAAa,CAAC,IAAIC,gDAAkC,CAAC,IAAI,CAAC/C,iBAAiB,EAAE6C,wBAAwB,CAAC,CAAC;IAC9H;EACF,CAAC;AACH;AAACG,OAAA,CAAAjD,0BAAA,GAAAA,0BAAA","ignoreList":[]}
1
+ {"version":3,"names":["_reactNativeTheoplayer","require","_PlayerEvents","_FullscreenAPI","_CommonUtils","WebPresentationModeManager","_presentationMode","PresentationMode","inline","_element","undefined","constructor","player","eventForwarder","_player","_eventForwarder","presentation","addEventListener","updatePresentationMode","presentationMode","prepareForPresentationModeChanges","fullscreenAPI","fullscreen","appElement","document","getElementById","promise","requestFullscreen_","then","noOp","pip","requestMode","exitFullscreen_","exitPictureInPicture","webkitEnterFullscreen","webkitSetPresentationMode","elements","element","children","Array","from","tagName","videoElement","src","srcObject","fullscreenchange_","fullscreenerror_","newPresentationMode","fullscreenElement_","currentMode","previousPresentationMode","dispatchEvent","DefaultPresentationModeChangeEvent","exports"],"sourceRoot":"../../../../../src","sources":["internal/adapter/web/WebPresentationModeManager.ts"],"mappings":";;;;;;AACA,IAAAA,sBAAA,GAAAC,OAAA;AAEA,IAAAC,aAAA,GAAAD,OAAA;AAEA,IAAAE,cAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAEO,MAAMI,0BAA0B,CAAC;EAE9BC,iBAAiB,GAAqBC,uCAAgB,CAACC,MAAM;EAC7DC,QAAQ,GAAiCC,SAAS;EAG1DC,WAAWA,CAACC,MAAwB,EAAEC,cAAsD,EAAE;IAC5F,IAAI,CAACC,OAAO,GAAGF,MAAM;IACrB,IAAI,CAACG,eAAe,GAAGF,cAAc;IACrC,IAAI,CAACC,OAAO,CAACE,YAAY,CAACC,gBAAgB,CAAC,wBAAwB,EAAE,IAAI,CAACC,sBAAsB,CAAC;EACnG;EAEA,IAAIC,gBAAgBA,CAAA,EAAqB;IACvC,OAAO,IAAI,CAACb,iBAAiB;EAC/B;EAEA,IAAIa,gBAAgBA,CAACA,gBAAkC,EAAE;IACvD,IAAIA,gBAAgB,KAAK,IAAI,CAACb,iBAAiB,EAAE;MAC/C;IACF;IAEA,IAAI,CAACc,iCAAiC,CAAC,CAAC;IAExC,IAAIC,4BAAa,KAAKX,SAAS,EAAE;MAC/B;MACA,IAAIS,gBAAgB,KAAKZ,uCAAgB,CAACe,UAAU,EAAE;QACpD,MAAMC,UAAU,GAAGC,QAAQ,CAACC,cAAc,CAAC,KAAK,CAAC,IAAID,QAAQ,CAACC,cAAc,CAAC,MAAM,CAAC;QACpF,IAAIF,UAAU,KAAK,IAAI,EAAE;UACvB,MAAMG,OAAO,GAAGH,UAAU,CAACF,4BAAa,CAACM,kBAAkB,CAAC,CAAC,CAAC;UAC9D,IAAID,OAAO,IAAIA,OAAO,CAACE,IAAI,EAAE;YAC3BF,OAAO,CAACE,IAAI,CAACC,iBAAI,EAAEA,iBAAI,CAAC;UAC1B;QACF;MACF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 +8,7 @@ export class WebPresentationModeManager {
8
8
  constructor(player, eventForwarder) {
9
9
  this._player = player;
10
10
  this._eventForwarder = eventForwarder;
11
+ this._player.presentation.addEventListener('presentationmodechange', this.updatePresentationMode);
11
12
  }
12
13
  get presentationMode() {
13
14
  return this._presentationMode;
@@ -28,7 +29,7 @@ export class WebPresentationModeManager {
28
29
  }
29
30
  }
30
31
  } else if (presentationMode === PresentationMode.pip) {
31
- void this._element?.requestPictureInPicture?.();
32
+ this._player.presentation.requestMode('native-picture-in-picture');
32
33
  } else {
33
34
  if (this._presentationMode === PresentationMode.fullscreen) {
34
35
  const promise = document[fullscreenAPI.exitFullscreen_]();
@@ -45,7 +46,7 @@ export class WebPresentationModeManager {
45
46
  if (presentationMode === PresentationMode.fullscreen) {
46
47
  this._element?.webkitEnterFullscreen?.();
47
48
  } else if (presentationMode === PresentationMode.pip) {
48
- this._element?.webkitSetPresentationMode?.(PresentationMode.pip);
49
+ this._player.presentation.requestMode('native-picture-in-picture');
49
50
  } else {
50
51
  this._element?.webkitSetPresentationMode?.(PresentationMode.inline);
51
52
  }
@@ -62,15 +63,6 @@ export class WebPresentationModeManager {
62
63
  }
63
64
  }
64
65
  }
65
- // listen for pip updates on element
66
- if (this._element !== undefined) {
67
- this._element.onenterpictureinpicture = () => {
68
- this.updatePresentationMode();
69
- };
70
- this._element.onleavepictureinpicture = () => {
71
- this.updatePresentationMode();
72
- };
73
- }
74
66
  // listen for fullscreen updates on document
75
67
  if (fullscreenAPI !== undefined) {
76
68
  document.addEventListener(fullscreenAPI.fullscreenchange_, this.updatePresentationMode);
@@ -82,7 +74,7 @@ export class WebPresentationModeManager {
82
74
  let newPresentationMode = PresentationMode.inline;
83
75
  if (fullscreenAPI !== undefined && document[fullscreenAPI.fullscreenElement_] !== null) {
84
76
  newPresentationMode = PresentationMode.fullscreen;
85
- } else if (document.pictureInPictureElement !== null) {
77
+ } else if (this._player.presentation.currentMode === 'native-picture-in-picture') {
86
78
  newPresentationMode = PresentationMode.pip;
87
79
  }
88
80
 
@@ -1 +1 @@
1
- {"version":3,"names":["PresentationMode","DefaultPresentationModeChangeEvent","fullscreenAPI","noOp","WebPresentationModeManager","_presentationMode","inline","_element","undefined","constructor","player","eventForwarder","_player","_eventForwarder","presentationMode","prepareForPresentationModeChanges","fullscreen","appElement","document","getElementById","promise","requestFullscreen_","then","pip","requestPictureInPicture","exitFullscreen_","exitPictureInPicture","webkitEnterFullscreen","webkitSetPresentationMode","elements","element","children","Array","from","tagName","videoElement","src","srcObject","onenterpictureinpicture","updatePresentationMode","onleavepictureinpicture","addEventListener","fullscreenchange_","fullscreenerror_","newPresentationMode","fullscreenElement_","pictureInPictureElement","previousPresentationMode","dispatchEvent"],"sourceRoot":"../../../../../src","sources":["internal/adapter/web/WebPresentationModeManager.ts"],"mappings":"AACA,SAASA,gBAAgB,QAAQ,yBAAyB;AAE1D,SAASC,kCAAkC,QAAQ,uBAAuB;AAE1E,SAASC,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,IAAI,QAAQ,yBAAyB;AAE9C,OAAO,MAAMC,0BAA0B,CAAC;EAE9BC,iBAAiB,GAAqBL,gBAAgB,CAACM,MAAM;EAC7DC,QAAQ,GAAiCC,SAAS;EAG1DC,WAAWA,CAACC,MAAwB,EAAEC,cAAsD,EAAE;IAC5F,IAAI,CAACC,OAAO,GAAGF,MAAM;IACrB,IAAI,CAACG,eAAe,GAAGF,cAAc;EACvC;EAEA,IAAIG,gBAAgBA,CAAA,EAAqB;IACvC,OAAO,IAAI,CAACT,iBAAiB;EAC/B;EAEA,IAAIS,gBAAgBA,CAACA,gBAAkC,EAAE;IACvD,IAAIA,gBAAgB,KAAK,IAAI,CAACT,iBAAiB,EAAE;MAC/C;IACF;IAEA,IAAI,CAACU,iCAAiC,CAAC,CAAC;IAExC,IAAIb,aAAa,KAAKM,SAAS,EAAE;MAC/B;MACA,IAAIM,gBAAgB,KAAKd,gBAAgB,CAACgB,UAAU,EAAE;QACpD,MAAMC,UAAU,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;IACnD,CAAC,MAAM,IAAIE,QAAQ,CAAC4B,uBAAuB,KAAK,IAAI,EAAE;MACpDF,mBAAmB,GAAG5C,gBAAgB,CAACuB,GAAG;IAC5C;;IAEA;IACA,MAAMwB,wBAAwB,GAAG,IAAI,CAAC1C,iBAAiB;IACvD,IAAIuC,mBAAmB,KAAKG,wBAAwB,EAAE;MACpD,IAAI,CAAC1C,iBAAiB,GAAGuC,mBAAmB;MAC5C,IAAI,CAAC/B,eAAe,CAACmC,aAAa,CAAC,IAAI/C,kCAAkC,CAAC,IAAI,CAACI,iBAAiB,EAAE0C,wBAAwB,CAAC,CAAC;IAC9H;EACF,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"names":["PresentationMode","DefaultPresentationModeChangeEvent","fullscreenAPI","noOp","WebPresentationModeManager","_presentationMode","inline","_element","undefined","constructor","player","eventForwarder","_player","_eventForwarder","presentation","addEventListener","updatePresentationMode","presentationMode","prepareForPresentationModeChanges","fullscreen","appElement","document","getElementById","promise","requestFullscreen_","then","pip","requestMode","exitFullscreen_","exitPictureInPicture","webkitEnterFullscreen","webkitSetPresentationMode","elements","element","children","Array","from","tagName","videoElement","src","srcObject","fullscreenchange_","fullscreenerror_","newPresentationMode","fullscreenElement_","currentMode","previousPresentationMode","dispatchEvent"],"sourceRoot":"../../../../../src","sources":["internal/adapter/web/WebPresentationModeManager.ts"],"mappings":"AACA,SAASA,gBAAgB,QAAQ,yBAAyB;AAE1D,SAASC,kCAAkC,QAAQ,uBAAuB;AAE1E,SAASC,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,IAAI,QAAQ,yBAAyB;AAE9C,OAAO,MAAMC,0BAA0B,CAAC;EAE9BC,iBAAiB,GAAqBL,gBAAgB,CAACM,MAAM;EAC7DC,QAAQ,GAAiCC,SAAS;EAG1DC,WAAWA,CAACC,MAAwB,EAAEC,cAAsD,EAAE;IAC5F,IAAI,CAACC,OAAO,GAAGF,MAAM;IACrB,IAAI,CAACG,eAAe,GAAGF,cAA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mBAAqC,GAAG3C,gBAAgB,CAACM,MAAM;IACnE,IAAIJ,aAAa,KAAKM,SAAS,IAAIa,QAAQ,CAACnB,aAAa,CAAC0C,kBAAkB,CAAC,KAAK,IAAI,EAAE;MACtFD,mBAAmB,GAAG3C,gBAAgB,CAACmB,UAAU;IACnD,CAAC,MAAM,IAAI,IAAI,CAACP,OAAO,CAACE,YAAY,CAAC+B,WAAW,KAAK,2BAA2B,EAAE;MAChFF,mBAAmB,GAAG3C,gBAAgB,CAAC0B,GAAG;IAC5C;;IAEA;IACA,MAAMoB,wBAAwB,GAAG,IAAI,CAACzC,iBAAiB;IACvD,IAAIsC,mBAAmB,KAAKG,wBAAwB,EAAE;MACpD,IAAI,CAACzC,iBAAiB,GAAGsC,mBAAmB;MAC5C,IAAI,CAAC9B,eAAe,CAACkC,aAAa,CAAC,IAAI9C,kCAAkC,CAAC,IAAI,CAACI,iBAAiB,EAAEyC,wBAAwB,CAAC,CAAC;IAC9H;EACF,CAAC;AACH","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":"8.12.0","buildDate":"2025-01-09T15:09:23.405Z"}
1
+ {"version":"8.13.1","buildDate":"2025-01-27T12:46:49.795Z"}
@@ -1 +1 @@
1
- {"version":3,"file":"WebPresentationModeManager.d.ts","sourceRoot":"","sources":["../../../../../src/internal/adapter/web/WebPresentationModeManager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAI9E,qBAAa,0BAA0B;IACrC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAmB;IAC3C,OAAO,CAAC,iBAAiB,CAA6C;IACtE,OAAO,CAAC,QAAQ,CAA2C;IAC3D,OAAO,CAAC,eAAe,CAAyC;gBAEpD,MAAM,EAAE,gBAAgB,EAAE,cAAc,EAAE,sBAAsB,CAAC,cAAc,CAAC;IAK5F,IAAI,gBAAgB,IAAI,gBAAgB,CAEvC;IAED,IAAI,gBAAgB,CAAC,gBAAgB,EAAE,gBAAgB,EAwCtD;IAED,OAAO,CAAC,iCAAiC;IA2BzC,OAAO,CAAC,sBAAsB,CAe5B;CACH"}
1
+ {"version":3,"file":"WebPresentationModeManager.d.ts","sourceRoot":"","sources":["../../../../../src/internal/adapter/web/WebPresentationModeManager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAI9E,qBAAa,0BAA0B;IACrC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAmB;IAC3C,OAAO,CAAC,iBAAiB,CAA6C;IACtE,OAAO,CAAC,QAAQ,CAA2C;IAC3D,OAAO,CAAC,eAAe,CAAyC;gBAEpD,MAAM,EAAE,gBAAgB,EAAE,cAAc,EAAE,sBAAsB,CAAC,cAAc,CAAC;IAM5F,IAAI,gBAAgB,IAAI,gBAAgB,CAEvC;IAED,IAAI,gBAAgB,CAAC,gBAAgB,EAAE,gBAAgB,EAwCtD;IAED,OAAO,CAAC,iCAAiC;IAkBzC,OAAO,CAAC,sBAAsB,CAe5B;CACH"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-theoplayer",
3
- "version": "8.12.0",
3
+ "version": "8.13.1",
4
4
  "description": "A THEOplayer video component for react-native.",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -57,7 +57,7 @@
57
57
  },
58
58
  "devDependencies": {
59
59
  "@eslint/js": "^9.13.0",
60
- "@react-native/eslint-config": "^0.75.4",
60
+ "@react-native/eslint-config": "^0.76.5",
61
61
  "@types/react": "^18.3.12",
62
62
  "eslint": "^8.57.1",
63
63
  "eslint-config-prettier": "^9.1.0",
@@ -66,9 +66,9 @@
66
66
  "pod-install": "^0.1.39",
67
67
  "prettier": "^3.3.3",
68
68
  "react": "^18.3.1",
69
- "react-native": "^0.75.4",
69
+ "react-native": "^0.76.5",
70
70
  "react-native-builder-bob": "^0.23.2",
71
- "theoplayer": "^8.3.0",
71
+ "theoplayer": "^8.9.0",
72
72
  "typedoc": "^0.25.13",
73
73
  "typedoc-plugin-external-resolver": "^1.0.3",
74
74
  "typedoc-plugin-mdn-links": "^3.3.4",
@@ -15,6 +15,7 @@ export class WebPresentationModeManager {
15
15
  constructor(player: ChromelessPlayer, eventForwarder: DefaultEventDispatcher<PlayerEventMap>) {
16
16
  this._player = player;
17
17
  this._eventForwarder = eventForwarder;
18
+ this._player.presentation.addEventListener('presentationmodechange', this.updatePresentationMode);
18
19
  }
19
20
 
20
21
  get presentationMode(): PresentationMode {
@@ -39,7 +40,7 @@ export class WebPresentationModeManager {
39
40
  }
40
41
  }
41
42
  } else if (presentationMode === PresentationMode.pip) {
42
- void this._element?.requestPictureInPicture?.();
43
+ this._player.presentation.requestMode('native-picture-in-picture');
43
44
  } else {
44
45
  if (this._presentationMode === PresentationMode.fullscreen) {
45
46
  const promise = document[fullscreenAPI.exitFullscreen_]();
@@ -56,7 +57,7 @@ export class WebPresentationModeManager {
56
57
  if (presentationMode === PresentationMode.fullscreen) {
57
58
  this._element?.webkitEnterFullscreen?.();
58
59
  } else if (presentationMode === PresentationMode.pip) {
59
- this._element?.webkitSetPresentationMode?.(PresentationMode.pip);
60
+ this._player.presentation.requestMode('native-picture-in-picture');
60
61
  } else {
61
62
  this._element?.webkitSetPresentationMode?.(PresentationMode.inline);
62
63
  }
@@ -74,15 +75,6 @@ export class WebPresentationModeManager {
74
75
  }
75
76
  }
76
77
  }
77
- // listen for pip updates on element
78
- if (this._element !== undefined) {
79
- this._element.onenterpictureinpicture = () => {
80
- this.updatePresentationMode();
81
- };
82
- this._element.onleavepictureinpicture = () => {
83
- this.updatePresentationMode();
84
- };
85
- }
86
78
  // listen for fullscreen updates on document
87
79
  if (fullscreenAPI !== undefined) {
88
80
  document.addEventListener(fullscreenAPI.fullscreenchange_, this.updatePresentationMode);
@@ -95,7 +87,7 @@ export class WebPresentationModeManager {
95
87
  let newPresentationMode: PresentationMode = PresentationMode.inline;
96
88
  if (fullscreenAPI !== undefined && document[fullscreenAPI.fullscreenElement_] !== null) {
97
89
  newPresentationMode = PresentationMode.fullscreen;
98
- } else if (document.pictureInPictureElement !== null) {
90
+ } else if (this._player.presentation.currentMode === 'native-picture-in-picture') {
99
91
  newPresentationMode = PresentationMode.pip;
100
92
  }
101
93
 
package/src/manifest.json CHANGED
@@ -1 +1 @@
1
- {"version":"8.12.0","buildDate":"2025-01-09T15:09:23.405Z"}
1
+ {"version":"8.13.1","buildDate":"2025-01-27T12:46:49.795Z"}