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?
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;
Just do this!!
<WebView VerticalOptions="FillAndExpand"
HorizontalOptions="FillAndExpand"
Source="https://www.youtube.com/embed/8azMAqsuHs0"
WidthRequest="500"
HeightRequest="500"
IsVisible="true"/>
Remember setting width and height is necessary, otherwise it will not show!
Best Regards
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With