Websocket: Start/Stop Stream

asqwhy

New Member
We use Websocket extensively to manage our 8 scenes for live broadcasts. We can do almost everything except for start/stop stream, because we first have to go to Manage Stream to select the previously configured stream on YouTube for broadcast.

Is there a way to tell StartStream in websocket to use a specific YouTube ID like that at the end of this URL: https://youtube.com/live/Z5XcFUYOEnw ?

Also, is this the only documentation? Or is there a more complete documentation available for Websocket API?
 
Couple of possibilities you might look at:
1) We have YouTube stream keys set up for various sorts of events. When streams are scheduled in YouTube Studio, we specify the appropriate key. For each key, we have created an OBS profile configured to use that key. A script in OBS, or a separate app using websocket, can command OBS to change profile, thus changing the key.

2) Within the folder for each profile (on Windows, something like C:\Users\{username]\AppData\Roaming\obs-studio\basic\profiles\{profilename}) the stream protocol and key are stored in service.json. You could have your app write this file with the appropriate key before it starts the stream. Caution: I don't know whether OBS reads this file when you start a stream, or if it is read when you select a profile. If the latter, you would need to write serivce.json and then change to that profile.

Note: your Z5XcFUYOEnw specifies a particular instance of stream. The YouTube keys I have described above have four groups of four letters and numbers: xyzw-1234-abcd-9876. We schedule our streams in advance, set the key, and harvest the URL for the stream to distribute to our members.
 

asqwhy

New Member
Couple of possibilities you might look at:
1) We have YouTube stream keys set up for various sorts of events. When streams are scheduled in YouTube Studio, we specify the appropriate key. For each key, we have created an OBS profile configured to use that key. A script in OBS, or a separate app using websocket, can command OBS to change profile, thus changing the key.

2) Within the folder for each profile (on Windows, something like C:\Users\{username]\AppData\Roaming\obs-studio\basic\profiles\{profilename}) the stream protocol and key are stored in service.json. You could have your app write this file with the appropriate key before it starts the stream. Caution: I don't know whether OBS reads this file when you start a stream, or if it is read when you select a profile. If the latter, you would need to write serivce.json and then change to that profile.

Note: your Z5XcFUYOEnw specifies a particular instance of stream. The YouTube keys I have described above have four groups of four letters and numbers: xyzw-1234-abcd-9876. We schedule our streams in advance, set the key, and harvest the URL for the stream to distribute to our members.
Thanks, John. I undersatnd that use case, and can see why that works for you.

In our case, we have thumbnails, live stream start dates/times, a description, and other stream/video attributes that are configured in YouTube through an App I wrote that uses YT's API. Our team has been trained to go to
OBS->Controls Panel->Manage Broadcast->Select Existing Broadcast, and then select the preconfigured YouTube broadcast for that service which was created by the App. The YT API returns the live stream ID (the example I sent) during the preconfiguration process.

What I am seeking is an ability to tell OBS to use that YT live stream ID through Websocket or other means so that they no longer need to go to the Manage Broadcasts dialog.
 

scott75

New Member
I know it's been a while, but I've done something that seems like it might be what you're after...

I use the YT API to manage the stream, as it seems you do as well. OBS is not connected to a YT account, so the only way it can stream is using a stream key. I harvest the stream key during the API process of creating the stream and then update the OBS config (all happens in one Python script). This gives the ability to go live without ever having to adjust any of the YT configuration in OBS itself.

My goal is to be able to fully automate streamed events. I have this working with TouchPortal; however, it's honestly not a great experience, so I'm looking for another alternative (possibly a custom WebSocket app?)...but haven't gotten that effort underway yet.
 

asqwhy

New Member
Thanks, Scott. Would you mind sharing the code that you've implemented? I'm happy to share mine too.
 
Top