I searched a quite a long time for the answer but didn't get much helpful advice, here is my code:
struct testdate: View { var body: some View { YTWrapper(videoID: "jQtP1dD6jQ0") .frame(width: 300, height: 200, alignment: center) } } struct YTWrapper : UIViewRepresentable { var videoID : String func makeUIView(context: Context) -> YTPlayerView { let playerView = YTPlayerView() playerView.load(withVideoId: videoID,playerVars: ["playInline" : 1]) return playerView } func updateUIView(_ uiView: YTPlayerView, context: Context) { } }
I get an error info: Compiling failed: cannot convert value of type 'OSLogMessage' to expected dictionary key type 'AnyHashable'
, if I delete playerVars: ["playInline" : 1]
, then it is ok but always enters a full screen when playing. What I need is to make it plays inline
没有评论:
发表评论