flameskyofficial / FlameSky

FlameSky is an open source browser based on the Sharp Browser project. It is written in C# WinForms on Visual Studio.
http://www.flamesky.weebly.com
BSD 3-Clause "New" or "Revised" License
11 stars 12 forks source link

YouTube Fullscreen not working #11

Open realandrewjose opened 6 years ago

realandrewjose commented 6 years ago

Needs immediate developer attention. The full screen only covers the area of the component - not the screen

novastream commented 6 years ago

Try implementing a custom DisplayHandler. Here's mine, if you need help with anything please let me know.

`public sealed class PlayerDisplayHandler : IDisplayHandler { private Control parent; private Form fullScreenForm;

    void IDisplayHandler.OnAddressChanged(IWebBrowser browserControl, AddressChangedEventArgs addressChangedArgs)
    {
        // ignore
    }

    bool IDisplayHandler.OnConsoleMessage(IWebBrowser browserControl, ConsoleMessageEventArgs consoleMessageArgs)
    {
        return false;
    }

    void IDisplayHandler.OnFaviconUrlChange(IWebBrowser browserControl, IBrowser browser, IList<string> urls)
    {
        // ignore
    }

    void IDisplayHandler.OnFullscreenModeChange(IWebBrowser browserControl, IBrowser browser, bool fullscreen)
    {
        // Get the Chromium control
        ChromiumWebBrowser chromiumWebBrowser = (ChromiumWebBrowser)browserControl;

        // Invoke the UI thread if needed
        chromiumWebBrowser.InvokeOnUiThreadIfRequired(() =>
        {
            // If fullscreen is set to true
            if (fullscreen)
            {
                // Remove the chromium browser from the parent form
                parent = chromiumWebBrowser.Parent;
                parent.Controls.Remove(chromiumWebBrowser);

                // Create fullscreen borderless form
                fullScreenForm = new Form()
                {
                    FormBorderStyle = FormBorderStyle.None,
                    WindowState = FormWindowState.Maximized,
                    StartPosition = FormStartPosition.CenterParent,
                    Icon = Properties.Resources.icon,
                    TopMost = false,
                    ShowInTaskbar = false                        
                };

                // Suspend layout on resize begin
                fullScreenForm.ResizeBegin += (s, e) =>
                {
                    fullScreenForm.SuspendLayout();
                };

                // Resume layout on resize end
                fullScreenForm.ResizeEnd += (s, e) =>
                {
                    fullScreenForm.ResumeLayout(true);
                };

                // Add the chromium browser to the fullscreen form
                fullScreenForm.Controls.Add(chromiumWebBrowser);
                fullScreenForm.ShowDialog(parent.FindForm());
            }
            else
            {
                fullScreenForm.Controls.Remove(chromiumWebBrowser);

                parent.Controls.Add(chromiumWebBrowser);

                fullScreenForm.Close();
                fullScreenForm.Dispose();
                fullScreenForm = null;
            }
        });
    }

    void IDisplayHandler.OnStatusMessage(IWebBrowser browserControl, StatusMessageEventArgs statusMessageArgs)
    {
        // ignore
    }

    void IDisplayHandler.OnTitleChanged(IWebBrowser browserControl, TitleChangedEventArgs titleChangedArgs)
    {
        // ignore
    }

    bool IDisplayHandler.OnTooltipChanged(IWebBrowser browserControl, string text)
    {
        return false;
    }
}`
realandrewjose commented 6 years ago

Hi, novastream, can you add it and make a pull request. By doing this you will be really making a helpful contribution, and will be considered part of 'FlameSky Contributors' - the developer of FlameSky.

realandrewjose commented 6 years ago

And your contribution will be logged.

realandrewjose commented 6 years ago

We always credit the contributors who help contribute to FlameSky. In fact the contributors (https://github.com/flameskyofficial/FlameSky/graphs/contributors) are considered the main developers.

realandrewjose commented 6 years ago

Any volunteers, please help fix this issue. We need you for a successful webrowser

realandrewjose commented 6 years ago

@novastream Can you fix this, please and make a pull request?

novastream commented 6 years ago

Sure, just need to do a couple of work related things before I can create a pull request. I'll get back to you.

realandrewjose commented 6 years ago

Thanks @novastream !

realandrewjose commented 6 years ago

Thanks to @novastream , a major issue in FlameSky has been resolved. Now users can view videos in fullscreen!!!!!

jarno9981 commented 3 years ago

Update the cefsharp browser nuget than it will work version 83.01.1