is there a way to programatically create a new source item? #155
Unanswered
endingwithali
asked this question in
Q&A
Replies: 1 comment
-
If you mean to add to the "Sources" list within OBS, you instead need to use inputs. Using your example of creating an image source to add to a scene, and assuming that you have already connected the goobs client, you can achieve this with the following: client, _ := goobs.New("localhost:4455", goobs.WithPassword("hunter2"))
// Get the currently active scene
scene, _ := client.Scenes.GetCurrentProgramScene()
// Compose the new input
iParams := inputs.
NewCreateInputParams().
WithSceneName(scene.CurrentProgramSceneName).
WithInputKind("image_source").
WithInputName("New Image").
WithInputSettings(map[string]interface{}{
"file": "/path/to/your/image/file",
})
// Send the input over to OBS
iRes, err := client.Inputs.CreateInput(iParams)
if err != nil {
panic(err)
} You should now see "New Image" in your OBS sources list. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
im trying to programmatically create a new source based off a image i programmatically generate. I see that apparently in older versions of goobs there was a createsource method in the sources client, but that method doesnt exist anymore.
so, given a file location, how can i create a new image source?
TIA <3
Beta Was this translation helpful? Give feedback.
All reactions