@bluebillywig/react-native-bb-player 8.47.7 → 8.47.8

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.
@@ -266,6 +266,14 @@ class BBPlayerView(private val reactContext: ThemedReactContext) : FrameLayout(r
266
266
  setExoPlayerResizeMode(playerView)
267
267
  }, 500)
268
268
 
269
+ // Detect any existing cast session (e.g. from a previously destroyed player/modal).
270
+ // Mirrors what the native demo app does in Activity.onResume().
271
+ try {
272
+ playerView.resumeCastSession()
273
+ } catch (e: Exception) {
274
+ debugLog("BBPlayerView") { "resumeCastSession failed (non-fatal): ${e.message}" }
275
+ }
276
+
269
277
  playerSetup = true
270
278
  debugLog("BBPlayerView") { "Player setup complete with URL: $jsonUrl" }
271
279
  }
@@ -48,6 +48,8 @@ class BBPlayerView: UIView, BBNativePlayerViewDelegate {
48
48
  private var isInFullscreen: Bool = false
49
49
  // Independent Google Cast button for showing the cast picker
50
50
  private var independentCastButton: GCKUICastButton?
51
+ // Current embed URL, updated on each bb_embed_loaded (i.e., each loadWith* call)
52
+ private var currentEmbedUrl: String?
51
53
  // Store parent view controller reference for SDK
52
54
  private weak var parentViewController: UIViewController?
53
55
  // Cached tag for deinit (nonisolated(unsafe) because deinit is nonisolated in Swift 6)
@@ -244,6 +246,10 @@ class BBPlayerView: UIView, BBNativePlayerViewDelegate {
244
246
  }
245
247
 
246
248
  func didSetupWithJsonUrl(url: String?) {
249
+ if let url = url, !url.isEmpty {
250
+ currentEmbedUrl = url
251
+ log("didSetupWithJsonUrl: \(url)")
252
+ }
247
253
  onDidSetupWithJsonUrl?(["payload": url as Any])
248
254
  }
249
255
 
@@ -671,7 +677,8 @@ class BBPlayerView: UIView, BBNativePlayerViewDelegate {
671
677
  NSLog("BBPlayerView.loadWithContentIdAndType ERROR - playerView not initialized")
672
678
  return
673
679
  }
674
- NSLog("BBPlayerView.loadWithContentIdAndType called - id: %@, type: %@, autoPlay: %d", contentId, contentType, autoPlay)
680
+ let isCasting = playerView?.player.isCasting ?? false
681
+ NSLog("BBPlayerView.loadWithContentIdAndType called - id: %@, type: %@, autoPlay: %d, isCasting: %d", contentId, contentType, autoPlay, isCasting)
675
682
  let context = parseContext(contextJson)
676
683
  switch contentType.lowercased() {
677
684
  case "mediacliplist", "l":
@@ -778,8 +785,14 @@ class BBPlayerView: UIView, BBNativePlayerViewDelegate {
778
785
  // Set the GCK playerId so the native player's sessionStarted handler
779
786
  // recognises this player instance and auto-loads media onto the cast device.
780
787
  // Mirrors what BottomSheetCastViewController.activateChromeCastSelection() does internally.
781
- if !jsonUrl.isEmpty {
782
- UserDefaults.standard.set(jsonUrl, forKey: "com.bluebillywig.bbnativeplayerkit.GCKPlayerId")
788
+ // Use currentEmbedUrl (updated on each clip load) over the static jsonUrl prop.
789
+ let playerId = currentEmbedUrl ?? (jsonUrl.isEmpty ? nil : jsonUrl)
790
+ if let playerId = playerId {
791
+ log("showCastPicker setting GCKPlayerId: \(playerId)")
792
+ UserDefaults.standard.set(playerId, forKey: "com.bluebillywig.bbnativeplayerkit.GCKPlayerId")
793
+ } else {
794
+ log("WARNING - showCastPicker: no playerId available, clearing stale GCKPlayerId", level: .warning)
795
+ UserDefaults.standard.removeObject(forKey: "com.bluebillywig.bbnativeplayerkit.GCKPlayerId")
783
796
  }
784
797
 
785
798
  if independentCastButton == nil {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bluebillywig/react-native-bb-player",
3
- "version": "8.47.7",
3
+ "version": "8.47.8",
4
4
  "description": "Blue Billywig Native Video Player for React Native - iOS AVPlayer and Android ExoPlayer integration",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",