here is the code:
struct LiveView: View {
@State var allowsInlineMediaPlayback: Bool = false
var body: some View {
VStack {
VideoView(videoID:"vimeo.com/event/000000/embed")
}
}
}
struct VideoView: UIViewRepresentable {
let videoID: String
func makeUIView(context: Context) -> WKWebView {
let configuration = WKWebViewConfiguration()
configuration.allowsInlineMediaPlayback = true
let WKWebView = WKWebView(frame: .zero, configuration: configuration)
return WKWebView
}
func updateUIView(_ uiView: WKWebView, context: Context) {
guard let youtubeURL = URL(string: "https://\(videoID)") else
{return}
uiView.load(URLRequest (url: youtubeURL))
}
}
Is their a better way to accomplish feeding a live event link into a playerview instead of needing a WKWebView?