Single Youtube Video Embedding in Xamarin Forms but Not Youtube list

不羁的心 提交于 2020-04-08 18:19:16

问题


I want to integrate a Youtube Video in a Xamarin.forms Application.

Currently i have googled and found the following links:

https://www.thewissen.io/embedding-youtube-feed-xamarin-forms/

XAMARIN - add video from youtube

but they deal with only Youtube lists , but not a single Youtube video.

I would like a single Video which isn't played in a WebView

How can i tackle this?


回答1:


HtmlWebViewSource personHtmlSource = new HtmlWebViewSource();
personHtmlSource.SetBinding(HtmlWebViewSource.HtmlProperty, "HTMLDesc");
personHtmlSource.Html = @"<html><body>  <div style=' position: relative; padding-bottom: 56.25%; padding-top: 25px;'> <iframe style='position: absolute; top: 0; left: 0; width: 100%; height: 100%;'  src='https://www.youtube.com/embed/bVdfj7HXuXE' frameborder='0' allowfullscreen></iframe></div> </body></html>";
var browser = new WebView();
browser.Source = personHtmlSource;
Content = browser;


来源:https://stackoverflow.com/questions/45280034/single-youtube-video-embedding-in-xamarin-forms-but-not-youtube-list

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!