obsproject / obs-websocket

Remote-control of OBS Studio through WebSocket
GNU General Public License v2.0
3.8k stars 701 forks source link

Feature Request: How to check if statusbar is red - if stream is bad or has a bad connection #1118

Closed lassos closed 1 year ago

lassos commented 1 year ago

Feature Request Type

RPC Request

Feature Request Type (Other)

No response

Requested Feature

i have one question. is it also possible to check if the status bar is red ? sometimes we do not get a reconnect event but stream is going down from green to red for 10-20 seconds without disconnecting. is there a way to check this ?

so we can check with

OBS_WEBSOCKET_OUTPUT_STARTING OBS_WEBSOCKET_OUTPUT_STARTED
OBS_WEBSOCKET_OUTPUT_RECONNECTING OBS_WEBSOCKET_OUTPUT_RECONNECTED OBS_WEBSOCKET_OUTPUT_STOPPING OBS_WEBSOCKET_OUTPUT_STOPPED

events. but how to get a possibility to trigger an event if the stream is going to red status. or is it possible to get or read the information about statusbar -> green/red

maybe anyonce has a hint for me .

Requested Feature Usage Scenario

if stream is not disconnected but going slow sometimes it is disconnected from website. so if there would be a notification about red status i could trigger connection to a better server and if i even know status was red (that forced a desconnect from streaming websites) i could trigger a reconnect to this website

bryce-seifert commented 1 year ago

obs-websocket provides the outputCongestion via GetStreamStatus.

You can use this to determine the color, based on the formula used by the OBS UI to generate the status bar

lassos commented 1 year ago

woooooooooooooooooooow

i am waiting since weeks of this great answer. thaaaaaaaaaaaaaaaaaaaaaanks soooooo much

lassos commented 1 year ago

can someonce explain this line of code:

else if (fabsf(avgCongestion - 1.0f) < EPSILON) {

i think the is the red status but what means EPSILON ?

bryce-seifert commented 1 year ago

From a search, epsilon is:

the difference between 1.0 and the next value representable by the floating-point type T

In general, I'm not sure how close you want your implementation to be to the OBS UI, but values closer to 1.0 are going to be red, and 0.0 green. So you can simplify the function a bit if you don't need exact precision.

lassos commented 1 year ago

ok, it is working. i will check congestion every 60 seconds. but maybe it would be possible to add an event in future releases if status goes from to green to red like StreamStateChangedEvent

tt2468 commented 1 year ago

Closing as it appears that this issue has been answered as best as possible.