0

I am loading a YouTube video in my app using web-view. But the full screen option is not working. How can i achieve the full screen.

My Code

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:d="http://xamarin.com/schemas/2014/forms/design"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             mc:Ignorable="d"
             x:Class="Player.MainPage">

    <StackLayout>
        <Label Text="Hello"/>
        <WebView x:Name="browser" Source="https://www.youtube.com/watch?v=fDrTbLXHKu8" HeightRequest="500"/>
    </StackLayout>
</ContentPage>

Screenshot

The youtube fullscreen is not working.

  • Have you tried to add the full screen flag ? https://stackoverflow.com/a/53337763/11104068 – Saamer Apr 12 '20 at 08:25
  • You need to achieve the full-screen mode by your self, have a look at [this sample](https://github.com/mhaggag/XFAndroidFullScreenWebView/blob/master/XFAndroidFullScreen/XFAndroidFullScreen/Controls/FullScreenEnabledWebView.cs) may help. – nevermore Apr 13 '20 at 02:53

2 Answers2

0

simply replace your stack layout with Grid,as following

<Grid>
       <WebView x:Name="browser" Source="https://www.youtube.com/watch?v=fDrTbLXHKu8" />
</Grid>
Sandeep Singh
  • 81
  • 1
  • 11
0

You need a custom renderer for your WebView. This repo will help you.
More details about this issue can be found here and here.

Just checked your code with this WebView renderer and it's showing fullscreen video after tapping expand control.