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

initial support for protocol version 5 #64

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

yusefnapora
Copy link

Hi! I hit #61 and noticed that the goobs library just released an update with protocol v5 compatibility. I figured I'd hack a little bit and try to get things building with the new version.

This PR seems to work, but there are a few things that I just commented out since I couldn't figure out the "new world" way of doing things:

  • I disabled the label command, since I couldn't find anything similar to the Freetype2 stuff in the current version
  • recordingStatus no longer prints the filename being recorded to, since that doesn't seem to be in the new API response
  • virtualCameraStatus no longer prints the timecode for the same reason

I left TODO comments to mark the unfinished bits. I may not have time to polish this up to a state where it can be merged, so feel free to use as inspiration, push new commits and / or close the PR. Since this is a breaking change it probably deserves a version bump & some kind of warning to people with old versions of obs-websocket.

Cheers :)

@andreykaipov
Copy link

andreykaipov commented Aug 13, 2022

Hello! The text label stuff is under the Inputs category now.

func UpdateText(source, text string) error {
	if _, err := client.Inputs.SetInputSettings(&inputs.SetInputSettingsParams{
		InputName:     source,
		InputSettings: map[string]interface{}{"text": text},
	}); err != nil {
		return err
	}
	
	return nil
}

There's no dedicated properties struct for input settings anymore, since all the inputs share the same request now, so we have to use a map[string]interface{} here. The bright side is updating input settings is now a patch by default (see the Overlay field), so no need to grab the existing settings and copy them to the new one anymore.

Technically the above is all that's needed, but it might be good to check if it's actually a text input we're updating. Otherwise the request will work just fine but won't do anything (e.g. setting text on a media input).

	resp, err := client.Inputs.GetInputSettings(&inputs.GetInputSettingsParams{
		InputName: source,
	})
	if err != nil {
		return err
	}

        // check if text_ft2_source_v2 or text_gdiplus_v2
	kind := resp.InputKind
	if !strings.HasPrefix(kind, "text_") {
		return fmt.Errorf("input %s is of %s", source, kind)
	}

@muesli
Copy link
Owner

muesli commented Aug 27, 2022

Nice work, @yusefnapora!

I'll have to see if it makes sense to reorganize a few of the commands to better match the protocol, or if we rather stick with the old organization of cli commands.

@matzegebbe
Copy link

Thank you very much! With this I can now use OBS-CLI with OBS28 again. This also gave me the idea a --version support, which protocol is supported then just.

@SwooshyCueb
Copy link

I tested this last night, and was unable to manipulate sceneitems (sources) inside groups.
This is something that is possible with current obs-cli with v4 websockets.

@v3eil
Copy link

v3eil commented Sep 28, 2022

Update soon?

@muesli
Copy link
Owner

muesli commented Sep 28, 2022

There are still a few issues where the new v5 API doesn't support old functionality, which makes me hesitant to update. I was hoping this would resolve itself before the next obs-cli update, so I don't have to introduce breaking behavior.

@v3eil
Copy link

v3eil commented Sep 29, 2022

There are still a few issues where the new v5 API doesn't support old functionality, which makes me hesitant to update. I was hoping this would resolve itself before the next obs-cli update, so I don't have to introduce breaking behavior.

Okay. Keep up the good work!

@coolaj86
Copy link

Could we get an alpha pre-release?

@muesli
Copy link
Owner

muesli commented Oct 19, 2022

Could we get an alpha pre-release?

Since there are still a few unimplemented commands (labels, e.g.), I'm not sure the current state warrants a pre-release. You can always build this yourself with a simple go build or go install.

@grigio
Copy link

grigio commented Jun 13, 2023

I started obs-cmd with a minimal obs-websocket 5 support
https://github.com/grigio/obs-cmd

@Co3co
Copy link

Co3co commented Oct 20, 2023

Was this abandoned?

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

Successfully merging this pull request may close these issues.

9 participants