Is this Possible with WebSocket??

cocoPops

New Member
Hi all,


I've created a html page - first it uses YouTube API to create a Broadcast, and it gives me back a streamKey.

I then use obs-websocket to create a rtmp_custom, then finally obs.call('StartStream')

But I can never get OBS to actually stream to the created broadcast. If I go to "Manage Broadcast" > "Select Existing Broadcast"

I can see my YouTube API created broadcast in there...

But setting the streamServiceType and streamServiceSettings, OBS still pops up with the message: "No Broadcast Configured, You need to set a broadcast before you can start streaming"

Is the broadcast not set by the streamKey I give it?

Or am I missing something like obs.call('SetBroadcast'

Or is it not possible to get OBS to stream to YouTube without manually selecting the broadcast (even though it is created with the youtube API)

If it is not possible... can anyone recommend any alternative software that can do what I am trying to do? (Which is create a broadcast with the youtube API, to set the Title/Desc, and then stream to that broadcast without interaction from someone using the OBS software)

Thanks so much!
 
I don't know of an API, but a manually edited stream key is store in service.json for the current OBS profile.
(Someplace like C:\Users\{username}\AppData\Roaming\obs-studio\basic\profiles\Johns_default_key\service.json)

So a brute-force approach might be to write your new key to that file. I don't know whether OBS reads the file when you start a stream, or when you select or change a profile, so you might need to run a few experiments
 

cocoPops

New Member
Thanks John.

I actually got it working!

YouTube API to create a broadcasts, then OBS websocket with streamServiceSettings - and it automatically starts broadcasting to YouTube with no user interaction in OBS Studio.

BUT… I feel there is a bug. Because the first time you do it, it will not work.

Websocket changes the required settings in OBS.

But it does not click “Apply” the first time. It needs to be manually clicked.

But after that - you can change the stream key though websockets, and “apply” doesn’t need to be clicked again.

So I would say this is a possible bug.

Many thanks!
 
Top