We have YouTube trailers that we want to run on our Xamarin Forms (PCL) project.
We have try'd everything but somehow there is not a good Youtube player out there :(
So now we are loading the Youtube trailers in a WebView so that it runs on the Android + iOS.
This is how we load the trailers in our WebView component:
var apiRequest = "https://www.youtube.com/embed/GYmm9qNwd_s?html5=1&autoplay=1&loop=1&rel=0&showinfo=0&controls=1";
var webView = new WebView();
webView.Source = apiRequest;
webView.MinimumWidthRequest = 200;
webView.MinimumHeightRequest = 200;
webView.HorizontalOptions = LayoutOptions.FillAndExpand;
webView.VerticalOptions = LayoutOptions.FillAndExpand;
var stackLayout = new StackLayout();
stackLayout.Children.Add(webView);
stackLayout.HorizontalOptions = LayoutOptions.FillAndExpand;
stackLayout.VerticalOptions = LayoutOptions.FillAndExpand;
grid.Children.Add(stackLayout);
this.Content = grid;
But somehow the Trailer is running on iOS and Android but the Autoplay is not working and the related movies still show up!
So my question is :
- Is there a way to set the Autoplay on the Xamarin Forms platforms?
- Why does the autoplay function won't work?