TVVLCKit Implementation SwiftUI
all you have to do is add a ZStack layer on-top of the VLC player and add your info and interactions there,
i have a written a full working code example with TVVLCKit and SwiftUI fro Apple-Tv on github that demonstrate how to add play pause and thumbmail control, a metadata info panel (as a place holder you can fill there what ever you want)
https://github.com/shaybc/VLCTester
hope this help more
How to show my AVPlayer in a VStack with SwiftUI
Thanks to Bogdan for the quick answer and for the like to the tutorial!
Here is the code, converted to NSView so it could work for macOS apps...
Here is the struct PlayerView
:
struct PlayerView: NSViewRepresentable {
func updateNSView(_ nsView: NSView, context: NSViewRepresentableContext<PlayerView>) {
}
func makeNSView(context: Context) -> NSView {
return PlayerNSView(frame: .zero)
}
}
Here is the class, "the meat" like Bogdan said:
class PlayerNSView: NSView{
private let playerLayer = AVPlayerLayer()
override init(frame:CGRect){
super.init(frame: frame)
let urlVideo = URL(string: "https://bitdash-a.akamaihd.net/content/sintel/hls/playlist.m3u8")!
let player = AVPlayer(url: urlVideo)
player.play()
playerLayer.player = player
if layer == nil{
layer = CALayer()
}
layer?.addSublayer(playerLayer)
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func layout() {
super.layout()
playerLayer.frame = bounds
}
}
Finally you can use PlayerView()
to add the AVPlayer in the struct ContentView
.
Related Topics
Reversing the Order of a String Value
How to Detect a 'Click' Gesture in Swiftui Tvos
How to Get Date and Time to Show a Clock in Uilabel
Open a Viewcontroller from Remote Notification
Reading an Inputstream into a Data Object
Uitableview - Multiple Selection and Single Selection
Swift 3 Get Start Index (As Int) of Substring
Insertion-Order Dictionary (Like Java's Linkedhashmap) in Swift
Swiftui .Rotationeffect() Framing and Offsetting
Does Kotlin Has Extension Class to Interface Like Swift
Uisplitviewcontroller Displaymodebuttonitem()
How to Connect Localhost (With Invalid Certificate) Using Alamofire
Subclass Nsapplication in Swift
Is There Any Way of Locking an Object in Swift Like in C#
Swift Error: Missing Argument Label 'Name:' in Call