how set width and height youtube video when we have open video and then full screen or portrait mode RRS feed

  • Question

  • User387362 posted

    plz tell me

    Wednesday, August 21, 2019 12:26 PM

All replies

  • User369978 posted

    If i understand correctly , do you mean you want to set width and height in landscape mode but full screen in portrait mode ?

    BTW , what's the videoplayer are you using now ? Custom video player implement by yourself or some third-party package ?

    Wednesday, August 21, 2019 3:51 PM
  • User387362 posted

    Colex sir, which nuget package for playing video in xamrin form

    Thursday, August 22, 2019 6:28 AM
  • User387362 posted

    Now I am use webview and embedded YouTube link

    Thursday, August 22, 2019 6:30 AM
  • User387362 posted

    I have set width 300 and height 600 but when we rotate mobile then this time not change width and height any solution???any nuget package for YouTube embedded?or how to open YouTube video full screen

    Thursday, August 22, 2019 6:37 AM
  • User387362 posted

    private void PlayVideo(LiveMatch liveMatch) {

                HtmlWebViewSource htmlWebViewSource = new HtmlWebViewSource();
                htmlWebViewSource.Html = BuildFinalHtml(liveMatch.Link, width:300, height:700 );
                webView.Source = htmlWebViewSource;
        private string BuildFinalHtml(string embedUrl, double width, double height)
            //var width = Application.Current.MainPage.Width;
            //var height = Application.Current.MainPage.Height;
            var iframeURL = string.Format("<iframe style=\"position:fixed; top: 50%; left: 50%;" +
          " width:"+" {1}px; height: {2}px; margin-left: {3}px; margin-top: {4}px;\"" +" src =\"{0}\" frameborder=\"0\" " + "allow=\"accelerometer;" +
          " autoplay; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>",
                embedUrl, width, height, -width / 2, -height / 2);
            string finalUrl = string.Format("<html><body>{0}</body></html>", iframeURL);
            return finalUrl;
    Thursday, August 22, 2019 9:18 AM
  • User369978 posted

    Try this :https://docs.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/custom-renderer/video-player/web-videos.

    Thursday, August 22, 2019 11:09 AM
  • User387362 posted

    sir this is video player it cant take youtube video embeded link ,it access only resourse. i want to -----when i open my project list of youtube links any link click open youtube lint this app and full screen

    Monday, August 26, 2019 6:22 AM
  • User387362 posted

    now use webview but it not able to full screen and portrate mode and landscape mode

    Monday, August 26, 2019 6:23 AM
  • User369978 posted

    If you are developing on android platform , check the solution :https://stackoverflow.com/a/50103945/8187800 .

    Use custom renderer for webview ,and set custom WebChromeClient on Webview , detailed code refer : https://github.com/mhaggag/XFAndroidFullScreenWebView

    Wednesday, August 28, 2019 8:26 AM