The integration with OBS allows Touch Portal to listen to events. In this step will will listen to the event that tells us when OBS is streaming or not.
From the actions category list select the On Streaming State event and add them like the image above. These will be added in the On-Event tab. These two events will trigger everytime in OBS when a stream is started or stopped. When a stream starts, Touch Portal gets this event and will change the text of the button to "Live" and set the background to red. When the streaming stops, the text of this button will be set to "NOT Live" and the color of the button will become grey.
Try it out in OBS, just start a stream and see the button on your device updating the background color and title as described above. This button does not yet start or stop the actual stream yet, we will cover that in the next step.
Go to the On-Press tab for this next bit as we are going to add the behaviour when you press the button. Because this button will either start or stop the stream depending on the state of the streaming, we need logic to determine what the state of streaming is at the moment you press this button. So we start by adding an IF statement action and an ELSE action. In the IF action we compare the OBS Streaming state is with the stopped state. This means that when we press the button, the if statement is evaluated. If the streaming state is "stopped" then it will execute the flow of actions beneath it. If not, it will execute the flow of actions below the ELSE action.
Now add the Set Streaming State action set to Start below the IF statement and the Stop below the ELSE, just as the image above shows.
Now when you press this button, it will start a stream if it is not already on. If it is already streaming, it will stop the stream. Try it out a few times. You will also notice that the events are working and will change your button each time your streaming state changes.
You can use this guide also for the Recording state. Just remember to change the actions to the recording equivalent.
You will now have a button that allows you to start or stop streaming and also updates if you do this from OBS.