tinodo / obsclient

A Complete .NET Client for OBS Studio 28 and up.
MIT License
10 stars 2 forks source link

OBSStudioClient.ObsClient.SetInputSettings has some invalid arguments #9

Closed AndreZila01 closed 4 months ago

AndreZila01 commented 4 months ago

Hey,

i'm new on OBS Websocket 5.0.0 and i would like use "SetSourceSettings", but on recent version of websocket the request are replaced by "SetInputSettings", but when i make the request i recived this message error: "Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: 'The best overloaded method match for 'OBSStudioClient.ObsClient.SetInputSettings(string, System.Collections.Generic.Dictionary<string,object>, bool)' has some invalid arguments'.

image

Code:

var settinsgs = await client.SetInputSettings("Image12", JsonConvert.DeserializeObject<dynamic>("{file: '/home/admin123/Pictures/Pokemon-Legends-Arceus-Profile-Picture.webp'}"), false);//SendRequestAndWaitAsync()

I would like know, what i'm doing wrong. Thanks

tinodo commented 4 months ago

Looking at the error, it's most like not your fault. :-) I will check out what's wrong!

Thanks for the notice!

tinodo commented 4 months ago

Actually, it might not be bug.

SetInputSettings as three parameters; inputName The name of the input to change the settings for. inputSettings A Dictionary<string, object> of settings to change. overlay An indication whether to apply the settings on top of the existing ones or reset them to defaults and then apply the new settings.

Your inputSettings is a dynamic object;

JsonConvert.DeserializeObject<dynamic>("{file: '/home/admin123/Pictures/Pokemon-Legends-Arceus-Profile-Picture.webp'}"

Try changing it to the proper dictionary. If you are using a recent version of .NET:

var settinsgs = await client.SetInputSettings("Image12", new() { { "file", "/home/admin123/Pictures/Pokemon-Legends-Arceus-Profile-Picture.webp" } }, false);

Let me know if that worked!

AndreZila01 commented 4 months ago

It's working. Thanks!! <3