2

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?

JKennedy
  • 18,150
  • 17
  • 114
  • 198
  • @user1 , any clue ? –  Jul 24 '17 at 14:26
  • I would look at [Rox.VideoPlayer nuget](https://www.nuget.org/packages/Rox.Xamarin.Video/) or [Xamarin Video Player](https://components.xamarin.com/view/video-player) they both seem to allow you to stream from youtube. Although the second link costs $50. But the first one is free – JKennedy Jul 24 '17 at 14:32
  • i saw the second link already , i wanted this for free , anyway let me look at the first one thanks –  Jul 24 '17 at 14:34
  • The first one doesn't support youtube , if you know how it works with youtube , help please –  Jul 24 '17 at 14:38
  • Did you find A good solution for this? – Emil Feb 19 '18 at 23:21

2 Answers2

4
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;
Sasikumar Murugesan
  • 4,412
  • 10
  • 51
  • 74
1

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

MarchalPT
  • 1,268
  • 9
  • 28