File tree Expand file tree Collapse file tree
AndroidSwiftUICore/Sources/AndroidSwiftUICore/Primitives Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ //
2+ // VideoPlayer.swift
3+ // AndroidSwiftUICore
4+ //
5+ // A video player with system playback controls. The node carries the media
6+ // URL; the Android interpreter hosts a platform player view, and the desktop
7+ // rig shows a placeholder.
8+ //
9+
10+ import Foundation
11+
12+ /// A playable media item. Mirrors the AVKit spelling; only URL-backed
13+ /// playback is modeled.
14+ public struct AVPlayer : Sendable {
15+ public var url : URL
16+ public init ( url: URL ) { self . url = url }
17+ }
18+
19+ public struct VideoPlayer : View {
20+
21+ internal let player : AVPlayer
22+
23+ public init ( player: AVPlayer ) {
24+ self . player = player
25+ }
26+
27+ public typealias Body = Never
28+ }
29+
30+ extension VideoPlayer : PrimitiveView {
31+ public func _render( in context: ResolveContext ) -> RenderNode {
32+ RenderNode (
33+ type: " VideoPlayer " ,
34+ id: context. path,
35+ props: [ " url " : . string( player. url. absoluteString) ]
36+ )
37+ }
38+ }
You can’t perform that action at this time.
0 commit comments