Youtube page in WebView (Xamarin.forms)

DylanLiuDylanLiu USUniversity ✭✭

Since the iOS 9 update, I get this error "An error occurred. Please try again later", when I click on the play button of a youtube video in a web view. Screenshot included in the attachment.

My code:

class WebViewPage : ContentPage
{
public WebViewPage(string url)
{
Title = "Webpage";

        WebView webView = new WebView
        {
            Source = new UrlWebViewSource
            {
                Url = "https://www.youtube.com/watch?v=98tsk3xkuf4" 
                //Url = url
            },
            VerticalOptions = LayoutOptions.FillAndExpand
        };

        // Accomodate iPhone status bar.
        this.Padding = new Thickness(10, Device.OnPlatform(20, 0, 0), 10, 5);

        // Build the page.
        this.Content = new StackLayout
        {
            Children =
            {
                //header,
                webView
            }
        };
    }
}

And yes, I'm aware of the change about App Transport Security:
I even tried to make an exception for youtube.com in info.plist:

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSExceptionDomains</key>
    <dict>
        <key>www.youtube.com</key>
        <dict>
            <key>NSIncludesSubdomains</key>
            <true/>
            <key>NSExceptionAllowsInsecureHTTPLoads</key>
            <true/>
        </dict>
    </dict>
</dict>
Sign In or Register to comment.