@sigx/lynx-video 0.4.3 → 0.4.5
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/ios/VideoPlayerUI.swift +16 -10
- package/package.json +3 -3
package/ios/VideoPlayerUI.swift
CHANGED
|
@@ -27,7 +27,11 @@ import Lynx
|
|
|
27
27
|
/// Imperative methods (`seek`, `getStatus`) are tracked as a v2 follow-up
|
|
28
28
|
/// — they need the Lynx UIMethodInvoker surface that isn't wired through
|
|
29
29
|
/// sigx-lynx yet (same blocker as `WebView.goBack` / `Map.animateToRegion`).
|
|
30
|
-
|
|
30
|
+
// Class is NOT marked `@objc` — Swift forbids that on generic subclasses
|
|
31
|
+
// of an ObjC lightweight-generic type like `LynxUI<__covariant V>`. Member-
|
|
32
|
+
// level `@objc` / `@objc(name)` annotations still bridge because `LynxUI`
|
|
33
|
+
// itself is `@objc`, so `__lynx_prop_config__*` discovery still works.
|
|
34
|
+
public class VideoPlayerUI: LynxUI<UIView> {
|
|
31
35
|
|
|
32
36
|
private var player: AVPlayer?
|
|
33
37
|
private var playerLayer: AVPlayerLayer?
|
|
@@ -60,7 +64,8 @@ import Lynx
|
|
|
60
64
|
|
|
61
65
|
public override func layoutDidFinished() {
|
|
62
66
|
super.layoutDidFinished()
|
|
63
|
-
|
|
67
|
+
// `view` is a non-optional method on `LynxUI` in this SDK — call it.
|
|
68
|
+
let container = view()
|
|
64
69
|
playerLayer?.frame = container.bounds
|
|
65
70
|
posterView?.frame = container.bounds
|
|
66
71
|
controlsView?.frame = container.bounds
|
|
@@ -215,10 +220,9 @@ import Lynx
|
|
|
215
220
|
|
|
216
221
|
let layer = AVPlayerLayer(player: player)
|
|
217
222
|
layer.videoGravity = pendingResizeMode
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
}
|
|
223
|
+
let hostView = view()
|
|
224
|
+
layer.frame = hostView.bounds
|
|
225
|
+
hostView.layer.insertSublayer(layer, at: 0)
|
|
222
226
|
|
|
223
227
|
self.player = player
|
|
224
228
|
self.playerLayer = layer
|
|
@@ -330,8 +334,8 @@ import Lynx
|
|
|
330
334
|
// land PosterA on screen if its download completed second.
|
|
331
335
|
guard self.pendingPosterURL == url,
|
|
332
336
|
self.posterView == nil,
|
|
333
|
-
!self.didEmitLoad
|
|
334
|
-
|
|
337
|
+
!self.didEmitLoad else { return }
|
|
338
|
+
let container = self.view()
|
|
335
339
|
let iv = UIImageView(image: image)
|
|
336
340
|
iv.frame = container.bounds
|
|
337
341
|
iv.contentMode = .scaleAspectFit
|
|
@@ -342,7 +346,8 @@ import Lynx
|
|
|
342
346
|
}
|
|
343
347
|
|
|
344
348
|
private func attachTapToggleOverlay() {
|
|
345
|
-
guard controlsView == nil
|
|
349
|
+
guard controlsView == nil else { return }
|
|
350
|
+
let container = view()
|
|
346
351
|
let overlay = UIView(frame: container.bounds)
|
|
347
352
|
overlay.backgroundColor = UIColor.clear
|
|
348
353
|
let tap = UITapGestureRecognizer(target: self, action: #selector(togglePlayPause))
|
|
@@ -374,7 +379,8 @@ import Lynx
|
|
|
374
379
|
|
|
375
380
|
fileprivate func fireEvent(_ name: String, params: [String: Any]) {
|
|
376
381
|
let event = LynxCustomEvent(name: name, targetSign: sign, params: params)
|
|
377
|
-
|
|
382
|
+
// Swift renames the ObjC `sendCustomEvent:` selector to `send(_:)`.
|
|
383
|
+
context?.eventEmitter?.send(event)
|
|
378
384
|
}
|
|
379
385
|
}
|
|
380
386
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sigx/lynx-video",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.5",
|
|
4
4
|
"description": "Native video player component for sigx-lynx (AVPlayer on iOS, ExoPlayer on Android).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
"README.md"
|
|
23
23
|
],
|
|
24
24
|
"peerDependencies": {
|
|
25
|
-
"@sigx/lynx": "^0.4.
|
|
25
|
+
"@sigx/lynx": "^0.4.5"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@typescript/native-preview": "7.0.0-dev.20260521.1",
|
|
29
29
|
"typescript": "^6.0.3",
|
|
30
|
-
"@sigx/lynx": "^0.4.
|
|
30
|
+
"@sigx/lynx": "^0.4.5"
|
|
31
31
|
},
|
|
32
32
|
"author": "Andreas Ekdahl",
|
|
33
33
|
"license": "MIT",
|