NOALBS / nginx-obs-automatic-low-bitrate-switching

Simple app to automatically switch scenes in OBS based on the current bitrate fetched from the NGINX stats page.
http://noalbs.com
MIT License
365 stars 77 forks source link

Is it possible to send a chat message in the same code block that detects instability? #32

Closed darthclide closed 4 years ago

darthclide commented 4 years ago

I would like to modify the code block that activates the "low bitrate" or "RIP" scenes to send a message in Twitch chat letting me know.

I want to avoid adding a timer for checking the !bitrate response since you already have optimized the code to detect these events elsewhere. But if it is impossible to interact with IRC in that code block, could you tell me where the commands are created so I can do this brute force method?

b3ck commented 4 years ago

If you type "!notify on" in twitch chat after NOALBS is running it will notify in twitch chat of the scene changes. This should be enabled by default. Unless you turned it off in the config file.

darthclide commented 4 years ago

Hmmm, I assume this will only trigger when the stream actually starts? I was manually clicking the scenes to see if it would trigger a chat message and nothing happened. This made me wonder if this "notify" was simply a popup on the computer, not a message in chat. onlySwitchWhenStreaming is set to false

b3ck commented 4 years ago

Having the "notify on" will announce in twitch chat when a scene changes due to the following reasons: low bitrate, loss of source, regain of source, or when you switch a scene from the chat manually, ex; !ss LIVE or !ss PRIVACY etc..

darthclide commented 4 years ago

I do not see this !ss command in the description, but when you say "loss of source" you mean if the connection goes completely dead right? And can you confirm this is tied up in the code checking bitrate and that the reason my tests offline showed no messages in chat is because I am not streaming?

b3ck commented 4 years ago

I'm sorry the !ss command is a alias I added for !switch (see screenshot below). Screenshot_20200628-082958_Chrome

Correct, and yes it was because you were not streaming, you can enable it to "operate" when not streaming in the config; (see screenshot below) Screenshot_20200628-083352_Chrome

Just change it false, start/restart NOALBS and it will run as if you were streaming.

darthclide commented 4 years ago

I meant I tested it while streaming to the RTMP server. No chat messages came in. enableAutoSwitchNotification is set to true.

b3ck commented 4 years ago

The option in the config is for when OBS is streaming, if set to true it will only "operate" when streaming in OBS to twitch. If set to false it will do it whenever.

darthclide commented 4 years ago

So I have it set to false. Why are there no Twitch chat messages coming through when the scene switches?

715209 commented 4 years ago

You will only see twitch chat messages when you are streaming from OBS and not manually switching scenes.

b3ck commented 4 years ago

Manually meaning switching the scenes inside OBS vs in chat using the !switch command.

darthclide commented 4 years ago

Ah okay. I was getting conflicted on what you meant, and I just did a test stream to Twitch from my computer, and it is correctly putting messages into chat like I want. Maybe you could change it in a future update? Because if you are in the same config file and you tell it "yes, I want auto switching to work even without streaming" at the same time as "yes, I want Twitch chat notifications", you would assume these chat messages will work even without sending any data to Twitch ingest servers.

Perhaps at the same time you do this, you could include a way for us to modify what the message response is? Thanks for the help!

715209 commented 4 years ago

This was done to not send messages in chat after you stopped streaming or when you are just changing things in OBS.

Also you can already change the message here: https://github.com/715209/nginx-obs-automatic-low-bitrate-switching/blob/86ac29d04895e43151d5bc8c4ad4ebdca0564beb/locales/en.json#L11

darthclide commented 4 years ago

Ah, so here is the output. May I ask where the logic is so I can create my own commands as well?

715209 commented 4 years ago

You can create your own commands in src/components/Chat.js

darthclide commented 4 years ago

Thank you! I didn't think to check the src because I assumed this was a "do not touch" folder.

b3ck commented 4 years ago

Always explore the source, you never know what you'll find or learn 😁👍