@bluebillywig/react-native-bb-player 8.45.20 → 8.45.22
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/README.md +28 -0
- package/ios/BBShortsView.swift +37 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -377,6 +377,34 @@ export function ChromecastPlayer() {
|
|
|
377
377
|
|
|
378
378
|
> **Note:** Chromecast functionality is available on both iOS and Android platforms.
|
|
379
379
|
|
|
380
|
+
## Example App
|
|
381
|
+
|
|
382
|
+
The included example app (`example/`) demonstrates all SDK features. It's available on TestFlight (iOS) and as an APK download on each [GitHub release](https://github.com/bluebillywig/react-native-bb-player/releases).
|
|
383
|
+
|
|
384
|
+
### Screens
|
|
385
|
+
|
|
386
|
+
| Screen | Description |
|
|
387
|
+
|--------|-------------|
|
|
388
|
+
| **Simple Player** | Minimal player for performance testing |
|
|
389
|
+
| **API Reference** | Interactive demo of all player methods: play, pause, seek, volume, fullscreen |
|
|
390
|
+
| **Shorts** | Vertical video with swipe navigation, supports full and shelf display modes |
|
|
391
|
+
| **Outstream Ads** | Standalone ad player with collapse/expand for article placements |
|
|
392
|
+
| **Modal Player** | Native full-screen modal overlay with swipe-to-close (iOS) |
|
|
393
|
+
|
|
394
|
+
### Running Locally
|
|
395
|
+
|
|
396
|
+
```bash
|
|
397
|
+
# Install dependencies
|
|
398
|
+
npm ci && cd example && npm ci
|
|
399
|
+
|
|
400
|
+
# iOS
|
|
401
|
+
cd ios && pod install && cd ..
|
|
402
|
+
npx react-native run-ios
|
|
403
|
+
|
|
404
|
+
# Android
|
|
405
|
+
npx react-native run-android
|
|
406
|
+
```
|
|
407
|
+
|
|
380
408
|
## API Reference
|
|
381
409
|
|
|
382
410
|
### Component Props
|
package/ios/BBShortsView.swift
CHANGED
|
@@ -40,6 +40,7 @@ private enum LogLevel {
|
|
|
40
40
|
*/
|
|
41
41
|
class BBShortsView: UIView, BBNativeShortsViewDelegate {
|
|
42
42
|
private var shortsView: BBNativeShortsView?
|
|
43
|
+
private var navController: UINavigationController?
|
|
43
44
|
private var hasSetup: Bool = false
|
|
44
45
|
|
|
45
46
|
// MARK: - Props (set from React Native)
|
|
@@ -136,15 +137,38 @@ class BBShortsView: UIView, BBNativeShortsViewDelegate {
|
|
|
136
137
|
return
|
|
137
138
|
}
|
|
138
139
|
|
|
140
|
+
// Wrap in a UINavigationController so the native SDK can present
|
|
141
|
+
// shelf-mode modals (openShortsPlayerAsModal uses navigationController?.present).
|
|
142
|
+
// The native SDK adds BBNativeShortsViewController as a child of the VC we pass.
|
|
143
|
+
// That child then uses its navigationController to present modals.
|
|
144
|
+
let containerVC = UIViewController()
|
|
145
|
+
containerVC.view.backgroundColor = .clear
|
|
146
|
+
let nav = UINavigationController(rootViewController: containerVC)
|
|
147
|
+
nav.isNavigationBarHidden = true
|
|
148
|
+
nav.view.frame = bounds
|
|
149
|
+
nav.view.backgroundColor = .clear
|
|
150
|
+
viewController.addChild(nav)
|
|
151
|
+
addSubview(nav.view)
|
|
152
|
+
nav.view.translatesAutoresizingMaskIntoConstraints = false
|
|
153
|
+
NSLayoutConstraint.activate([
|
|
154
|
+
nav.view.topAnchor.constraint(equalTo: topAnchor),
|
|
155
|
+
nav.view.leadingAnchor.constraint(equalTo: leadingAnchor),
|
|
156
|
+
nav.view.trailingAnchor.constraint(equalTo: trailingAnchor),
|
|
157
|
+
nav.view.bottomAnchor.constraint(equalTo: bottomAnchor),
|
|
158
|
+
])
|
|
159
|
+
nav.didMove(toParent: viewController)
|
|
160
|
+
self.navController = nav
|
|
161
|
+
|
|
139
162
|
// Convert options to Swift dictionary
|
|
140
163
|
var optionsDict: [String: Any]? = nil
|
|
141
164
|
if let dict = options as? [String: Any], !dict.isEmpty {
|
|
142
165
|
optionsDict = dict
|
|
143
166
|
}
|
|
144
167
|
|
|
145
|
-
// Create the shorts view using the
|
|
168
|
+
// Create the shorts view using the container VC inside the nav controller
|
|
169
|
+
// so the native SDK's shelf tap can present modals via navigationController
|
|
146
170
|
shortsView = BBNativeShorts.createShortsView(
|
|
147
|
-
uiViewController:
|
|
171
|
+
uiViewController: containerVC,
|
|
148
172
|
frame: bounds,
|
|
149
173
|
jsonUrl: jsonUrl,
|
|
150
174
|
options: optionsDict
|
|
@@ -158,14 +182,15 @@ class BBShortsView: UIView, BBNativeShortsViewDelegate {
|
|
|
158
182
|
|
|
159
183
|
shorts.delegate = self
|
|
160
184
|
|
|
161
|
-
// Add
|
|
162
|
-
|
|
185
|
+
// Add shorts view inside the container VC's view so it sits within the
|
|
186
|
+
// navigation controller hierarchy (required for shelf modal presentation)
|
|
187
|
+
containerVC.view.addSubview(shorts)
|
|
163
188
|
shorts.translatesAutoresizingMaskIntoConstraints = false
|
|
164
189
|
NSLayoutConstraint.activate([
|
|
165
|
-
shorts.topAnchor.constraint(equalTo: topAnchor),
|
|
166
|
-
shorts.leadingAnchor.constraint(equalTo: leadingAnchor),
|
|
167
|
-
shorts.trailingAnchor.constraint(equalTo: trailingAnchor),
|
|
168
|
-
shorts.bottomAnchor.constraint(equalTo: bottomAnchor)
|
|
190
|
+
shorts.topAnchor.constraint(equalTo: containerVC.view.topAnchor),
|
|
191
|
+
shorts.leadingAnchor.constraint(equalTo: containerVC.view.leadingAnchor),
|
|
192
|
+
shorts.trailingAnchor.constraint(equalTo: containerVC.view.trailingAnchor),
|
|
193
|
+
shorts.bottomAnchor.constraint(equalTo: containerVC.view.bottomAnchor)
|
|
169
194
|
])
|
|
170
195
|
|
|
171
196
|
log("BBShortsView.setupShorts() completed")
|
|
@@ -176,6 +201,10 @@ class BBShortsView: UIView, BBNativeShortsViewDelegate {
|
|
|
176
201
|
shortsView?.destroy()
|
|
177
202
|
shortsView?.removeFromSuperview()
|
|
178
203
|
shortsView = nil
|
|
204
|
+
navController?.willMove(toParent: nil)
|
|
205
|
+
navController?.view.removeFromSuperview()
|
|
206
|
+
navController?.removeFromParent()
|
|
207
|
+
navController = nil
|
|
179
208
|
hasSetup = false
|
|
180
209
|
}
|
|
181
210
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bluebillywig/react-native-bb-player",
|
|
3
|
-
"version": "8.45.
|
|
3
|
+
"version": "8.45.22",
|
|
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",
|