Git Product home page Git Product logo

Comments (12)

sepehr1014 avatar sepehr1014 commented on June 12, 2024

Hi, a simple workaround would be to set your window state to none and hide everything once in full screen mode. But that doesn't seem right to me.

from vlc.dotnet.

LinoBarreca avatar LinoBarreca commented on June 12, 2024

I'm trying to implement it adding the functions to Vlc.DotNet.Core.Interops and relative property into Vlc.DotNet.Core.VideoManagement :)

I will let you know if I succeed :)

from vlc.dotnet.

LinoBarreca avatar LinoBarreca commented on June 12, 2024

OK. It can be done this way (if zeBobo5 merges it in the code it needs a bit of clean up but it works perfectly)

in vlcControl.cs I added:

        public void GoFullScreen()
        {
            var S = Screen.FromHandle(Handle); //to find the screen the control in on
            var fi = S.GetType().GetField("hmonitor", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
            IntPtr screenhandle = (IntPtr)fi.GetValue(S); //to get the screen handle
            myVlcMediaPlayer.VideoHostControlHandle = screenhandle; //set video as NOT embedded (or full screen doesn't work)
            myVlcMediaPlayer.Video.FullScreen = true; //added property.
        }

in IVideoManagement.cs I added:
bool FullScreen { set; } //could have get too if needed.

in VideoManagement.cs I added:

        public bool FullScreen
        {
            set
            {
                myManager.SetFullScreen(myMediaPlayer, value); //set full screen mode
            }
        }

Added file \Vlc.DotNet.Core.Interops\VlcManager.SetFullScreen.cs containing:

using System;
using Vlc.DotNet.Core.Interops.Signatures;

namespace Vlc.DotNet.Core.Interops
{
    public sealed partial class VlcManager
    {
        public void SetFullScreen(VlcMediaPlayerInstance mediaPlayerInstance, bool fullScreen)
        {
            if (mediaPlayerInstance == IntPtr.Zero)
                throw new ArgumentException("Media player instance is not initialized.");
            GetInteropDelegate<SetFullScreen>().Invoke(mediaPlayerInstance, fullScreen ? 1 : 0);
        }
    }
}

Added file \Vlc.DotNet.Core.Interops\Signatures\libvlc_media_player.h\libvlc_set_fullscreen.cs containing:

using System;
using System.Runtime.InteropServices;

namespace Vlc.DotNet.Core.Interops.Signatures
{
    /// <summary>
    /// Set fullscreen.
    /// </summary>
    [LibVlcFunction("libvlc_set_fullscreen")]
    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
    internal delegate void SetFullScreen(IntPtr mediaPlayerInstance, int value);
}

and that's it.

How to use it:
open sample.
add a "Fullscreen" button.
on button click event handler just call
myVlcControl.GoFullScreen();

HOPE THIS WILL HELP SOMEONE 👍 :)

from vlc.dotnet.

sepehr1014 avatar sepehr1014 commented on June 12, 2024

Nice work! How about a "revert to normal mode"? Maybe implement a property "IsFullScreen" ...

from vlc.dotnet.

LinoBarreca avatar LinoBarreca commented on June 12, 2024

yeah sepehr1014, that was just a very quick (1 hour) and dirty (but proper) fix for the problem.
A lot of work can be done to polish it, for example you could add

        public void RevertToWindow()
        {
            myVlcMediaPlayer.Video.FullScreen = false;
            myVlcMediaPlayer.VideoHostControlHandle = Handle; //set video as embedded into control hwnd again
        }

or implement, in the same way, the support for libvlc_get_fullscreen (to provide a getter for public bool FullScreen) and libvlc_toggle_fullscreen ....imagination is up to you :)

from vlc.dotnet.

NickStrupat avatar NickStrupat commented on June 12, 2024

Did this get merged?

from vlc.dotnet.

FireTiger23 avatar FireTiger23 commented on June 12, 2024

@LinoBarreca do not work~

from vlc.dotnet.

isedwards avatar isedwards commented on June 12, 2024

@ZeBobo5 - it looks like the code that @LinoBarreca wrote above to add a fullscreen option to Vlc.DotNet was never submitted as a pull request (and then the issue was closed and forgotten).

Are either of you able to get this into the codebase, or do you want some help putting it into a PR?

from vlc.dotnet.

wesoos avatar wesoos commented on June 12, 2024

@jeremyVignelles Hi, did this ever get into the code base?

from vlc.dotnet.

jeremyVignelles avatar jeremyVignelles commented on June 12, 2024

Hi, never heard of it in Vlc.DotNet, so I guess not. is that something you want to be merged? what would be the difference with setting your own window as fullscreen.
PR are welcome, but be careful, the warning in the documentation says that the child window needs to be reparented.

from vlc.dotnet.

github-wujianwen avatar github-wujianwen commented on June 12, 2024

fullscreen() in winform does not work

from vlc.dotnet.

jeremyVignelles avatar jeremyVignelles commented on June 12, 2024

As said here, the binding for the libvlc fullscreen function was added, but it needs reparenting the window, and it's not easy to work with. why not putting your WinForms control in fullscreen as you would normally do instead?

from vlc.dotnet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.