@simba-dev/react-native-media-player 3.3.5 → 3.3.6

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
@@ -1,4 +1,49 @@
1
1
 
2
+ ## [3.3.6] - 2026-11-06
3
+
4
+ ### Fixed
5
+
6
+ - **A REFUSED Picture-in-Picture entry left the app with NO controls at all.** The entry path hides
7
+ your chrome before it asks the OS for the window. If the OS then **refused** the entry, the
8
+ chrome was never brought back: `restoreConsumerChrome()` was called from exactly one place —
9
+ `onPictureInPictureModeChanged(false)` — and a refused entry never produces a Picture-in-Picture
10
+ mode change, because the app never entered Picture-in-Picture.
11
+
12
+ Measured on emulator-5554 (API 37) on 2026-11-06, on the npm 3.3.5 build, with the platform
13
+ appop `PICTURE_IN_PICTURE` denied so the OS refuses the entry:
14
+
15
+ ```
16
+ 18:14:49.334 hideConsumerChrome: hid the chrome view with nativeID 'simba-expanded-chrome' visibility=8
17
+ 18:14:49.348 the OS refused the PiP entry
18
+ ```
19
+
20
+ `restoreConsumerChrome` **never ran**. The app came back to the player with no header, no scrub
21
+ row and no transport row — just the video, with nothing to control it with. Tapping the video did
22
+ not bring it back, and the only recovery was killing the app.
23
+
24
+ **The fix:** the refusal branch brings the chrome back itself, before it returns. It calls the
25
+ **one** owner — `restoreConsumerChrome()` — which forgets the hidden view as it restores it, so
26
+ the refusal path and the Picture-in-Picture-exit path can both call it and the chrome is restored
27
+ **exactly once**: whichever path gets there first restores it, and the other finds nothing to do
28
+ and does nothing. A guard that returns *before* the hide (the API level, the auto-enter policy,
29
+ already-in-Picture-in-Picture, no media loaded) restores nothing, because nothing was hidden.
30
+
31
+ The README said the chrome is brought back "when Picture-in-Picture ends". That was **false** for
32
+ a refused entry, and the README is the documentation every consumer installs — so it now says
33
+ "when Picture-in-Picture ends **or when the OS refuses the entry**".
34
+
35
+ ### Not claimed
36
+
37
+ - This release does **not** claim to fix the chrome that is still in the Picture-in-Picture window
38
+ on a successful entry. That is **B-050**, and its cause is measured: the hide and the entry run
39
+ in the **same main-thread message**, so no traversal can run between them, so the chrome-less
40
+ frame is never drawn, and the Picture-in-Picture window keeps a **frozen snapshot** of the app's
41
+ last drawn UI layer while its video layer stays live. The 3.3.5 CHANGELOG's "Not claimed" section
42
+ says so in full, and nothing in this release changes it.
43
+
44
+ - The JavaScript-button entry path is unchanged: the consumer unmounts its own chrome in React
45
+ there, so the library never hides it natively and there is nothing to restore.
46
+
2
47
  ## [3.3.5] - 2026-11-06
3
48
 
4
49
  ### Fixed
package/README.md CHANGED
@@ -387,8 +387,9 @@ path. The same library call serves both, so there is one entry and one owner. Wh
387
387
  hook matters is in [Why it is native](#why-it-is-native-and-why-your-activity-hands-over-the-activity).
388
388
 
389
389
  The library then hides your chrome, asks the OS for the window, and brings your chrome back when
390
- Picture-in-Picture ends. It returns whether the OS **accepted** the entry, and `false` when the
391
- entry was refused, so you can log it:
390
+ Picture-in-Picture ends **— or when the OS refuses the entry**, which produces no Picture-in-Picture
391
+ mode change to restore it from. It returns whether the OS **accepted** the entry, and `false` when
392
+ the entry was refused, so you can log it:
392
393
 
393
394
  ```kotlin
394
395
  val entered = com.simba.player.mpv.MpvBridgeModule.notifyUserLeaveHint(this)
@@ -647,6 +647,24 @@ class MpvBridgeModule(reactContext: ReactApplicationContext) :
647
647
  val entered = enterPictureInPicture(activity, state = state)
648
648
  if (!entered) {
649
649
  Log.w(TAG, "companion.notifyUserLeaveHint: the OS refused the PiP entry")
650
+ // The chrome was hidden above, and a REFUSED entry never
651
+ // produces a PiP mode change: the app never entered PiP, so
652
+ // `onPictureInPictureModeChanged(false)` never runs and the
653
+ // restore it owns never happens.
654
+ //
655
+ // The consumer came back to the player with NO header, no
656
+ // scrub row and no transport row at all, and the only
657
+ // recovery was killing the app. Measured on emulator-5554
658
+ // (API 37) on 2026-11-06: the OS refused the entry and
659
+ // `restoreConsumerChrome` NEVER ran.
660
+ //
661
+ // So the refusal brings the chrome back ITSELF - and it
662
+ // calls the ONE owner, `restoreConsumerChrome()`, which
663
+ // forgets the hidden view as it restores it. That is what
664
+ // makes this call and the PiP-exit call safe to have
665
+ // BOTH: the second one finds nothing to restore and does
666
+ // nothing, so the chrome is restored exactly once.
667
+ restoreConsumerChrome()
650
668
  return false
651
669
  }
652
670
  Log.i(TAG, "companion.notifyUserLeaveHint: entered PiP")
@@ -835,7 +853,21 @@ class MpvBridgeModule(reactContext: ReactApplicationContext) :
835
853
  /**
836
854
  * Bring the hidden chrome back, and forget it.
837
855
  *
838
- * Called when PiP ends (`onPictureInPictureModeChanged(false)`).
856
+ * ## The ONE owner of the restore
857
+ *
858
+ * Two paths call it, and both go through here:
859
+ * - PiP ends - `onPictureInPictureModeChanged(false)`;
860
+ * - the OS REFUSED the entry - `notifyUserLeaveHint`, which
861
+ * never produces a PiP mode change at all, because the app
862
+ * never entered PiP.
863
+ *
864
+ * It forgets the hidden view as it restores it, so a second call
865
+ * finds nothing to do: whichever path gets there first restores
866
+ * the chrome, and the other one does nothing. The chrome is
867
+ * restored exactly once, and never zero times.
868
+ *
869
+ * A `null` view is not a failure: nothing was hidden, so there is
870
+ * nothing to restore.
839
871
  */
840
872
  private fun restoreConsumerChrome() {
841
873
  val view = pipHiddenChromeView ?: return
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simba-dev/react-native-media-player",
3
- "version": "3.3.5",
3
+ "version": "3.3.6",
4
4
  "description": "React Native video & audio player powered by libmpv — Picture-in-Picture, MediaSession, foreground service, and a customizable TypeScript UI. Built for Android. Designed as a drop-in replacement for react-native-video / react-native-track-player / expo-av. See CHANGELOG.md for per-version notes.",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",