Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] OpenSourceProjector #119

Open
frogeater opened this issue Nov 14, 2022 · 1 comment
Open

[BUG] OpenSourceProjector #119

frogeater opened this issue Nov 14, 2022 · 1 comment

Comments

@frogeater
Copy link

frogeater commented Nov 14, 2022

Issue Type

Bug

OBS 28.1.2, 30.0.0
Windows 10 22H2

Describe the bug
The OpenSourceProjector is not able to open a FullScreen projector.

To Reproduce
Just try to open a FullScreen projector on any source.
For instance : obsws.OpenSourceProjector( "Scene 2", 1 )
The command opens a window centered on main screen.
Look at long example below.

Expected behavior
Open a FullScreen monitor on expected screen.

UPDATE : bug fixed on my side. Look at next comment.

Long description
I am using obs-websocket-dotnet from powershell 7.
It is working perfectly for most things :). Many thanks to all contributors.
I have an issue with OpenSourceProjector method.

$obsWS.GetMonitorList() returns following list

Height : 1080
Width : 1920
Name : \.\DISPLAY2(0)
Index : 0
PositionX : 0
PositionY : 0

Height : 1080
Width : 1920
Name : \.\DISPLAY1(1)
Index : 1
PositionX : 1228
PositionY : 1080

Height : 1080
Width : 1920
Name : \.\DISPLAY3(2)
Index : 2
PositionX : -1920
PositionY : 0

I want to display "Scène 2" in full screen on monitor index 1

$obsws.OpenSourceProjector ("Scène 2", 1) displays the "Scène 2" in windowed mode on monitor 2 ! ! !
OpenSourceProjector produces the same result (window on monitor 2) regardless of the requested monitor.

Then I supposed that projector geometry is mandatory and I tried

$obsws.opensourceprojector("Scène 2", "jhkjhhjh", 1) which generates an error.
MethodInvocationException: Exception calling "OpenSourceProjector" with "3" argument(s): "ErrorCode: 404, Comment: monitorIndex and projectorGeometry are mutually exclusive."

… which is consistent with the documentation in protocol.md.

@frogeater frogeater changed the title [BUG] [BUG] OpenSourceProjector Nov 14, 2022
@frogeater
Copy link
Author

frogeater commented Dec 26, 2023

I am not a software developer and I do not know how to use GitHub safely.
However I made changes in a local copy of the source and the OpenSourceProjector is now working like a charm.
If a better developper wants to build and push a change request, the following lines are the changes I made in OBSWebsocket_Requests.cs starting at line 2118

`

    /// <summary>
    /// Opens a projector for a source.
    /// Note: This request serves to provide feature parity with 4.x. It is very likely to be changed/deprecated in a future release.
    /// </summary>
    /// <param name="sourceName">Name of the source to open a projector for</param>
    /// <param name="monitorIndex">Monitor index, use GetMonitorList to obtain index. -1 to open in windowed mode</param>
    /// <param name="projectorGeometry">Size/Position data for a windowed projector, in Qt Base64 encoded format.</param>
    public void OpenSourceProjector(string sourceName, int monitorIndex = -1, string projectorGeometry = null)
    {
        if (monitorIndex == -1)
        {
            var request = new JObject
            {
                { nameof(sourceName), sourceName },
                { nameof(monitorIndex), monitorIndex },
                { nameof(projectorGeometry), projectorGeometry }
            };
            SendRequest(nameof(OpenSourceProjector), request);
        }
        else
        {
            var request = new JObject
            {
                { nameof(sourceName), sourceName },
                { nameof(monitorIndex), monitorIndex }
            };
            SendRequest(nameof(OpenSourceProjector), request);
        }
    }

    /// <summary>
    /// Opens a projector for a specific output video mix in full screen.
    /// Note: This request serves to provide feature parity with 4.x. It is very likely to be changed/deprecated in a future release.
    /// </summary>
    /// <param name="videoMixType">Mix types: OBS_WEBSOCKET_VIDEO_MIX_TYPE_PREVIEW, OBS_WEBSOCKET_VIDEO_MIX_TYPE_PROGRAM, OBS_WEBSOCKET_VIDEO_MIX_TYPE_MULTIVIEW</param>
    /// <param name="monitorIndex">Monitor index, use GetMonitorList to obtain index. -1 to open in windowed mode</param>
    /// <param name="projectorGeometry">Size/Position data for a windowed projector, in Qt Base64 encoded format.</param>
    public void OpenVideoMixProjector(string videoMixType, int monitorIndex = -1, string projectorGeometry = null)
    {
        if (monitorIndex == -1)
        {
            var request = new JObject
            {
                { nameof(videoMixType), videoMixType },
                { nameof(monitorIndex), monitorIndex },
                { nameof(projectorGeometry), projectorGeometry }
            };
            SendRequest(nameof(OpenVideoMixProjector), request);
        }
        else
        {
            var request = new JObject
            {
                { nameof(videoMixType), videoMixType },
                { nameof(monitorIndex), monitorIndex }
            };
            SendRequest(nameof(OpenVideoMixProjector), request);
        }
    }

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant