IRLTKStatusUpdate
Advanced state control with javascript and websocket event parsing
Javascript Event
IRLToolkit's remote OBS emits a custom event irltkStatusUpdate
to all browser sources.
If you are a web developer, you may subscribe to it using window.addEventListener
.
It contains lots of useful state information and is emitted every 2.5 seconds.
Example event output (JSON):
JSON
{
"ingests": [
{
"id": "xyz001",
"media_state": "OBS_MEDIA_STATE_OPENING",
"muted": false,
"name": "SRT Ingest",
"router_bitrate": 0,
"router_rtt": -1, //only shown when type is srt
"type": "srt",
"volume": 100
}
],
"low_bitrate_trigger": 1000,
"main_ingest_id": "xyz001",
"offline_bitrate_trigger": 150,
"output_status": {
"stream_status": false,
"stream_timecode": "00:00:00.000"
}
}
Example HTML to display the bitrate and RTT (if SRT) of the 2nd ingest.
HTML
<html>
<head>
<script>
let statusDiv = null;
window.addEventListener('irltkStatusUpdate', (event) => {
const ingest = event.detail.ingests[1];
const bitrate = ingest.router_bitrate;
if (statusDiv !== null) {
if (ingest.type == "srt") {
const rtt = ingest.router_rtt;
statusDiv.innerHTML = `Bitrate: ${bitrate} | RTT: ${rtt}`;
} else {
statusDiv.innerHTML = `Bitrate: ${bitrate}`;
}
}
});
</script>
</head>
<body>
<span id="status" style="color: white;font-size: 170px;"></span>
<script>
statusDiv = document.getElementById('status');
statusDiv.innerHTML = 'Loading...';
</script>
</body>
</html>
obs-websocket
Examples shown will be for Streamer.bot but other obs-websocket clients will likely work.
Request obs-websocket access for your IRLToolkit server if you haven't already.
Add an OBS Connection to Streamer.bot, use the Host URL and password found on your irl.run dashboard's System settings.
Add an OBS Event trigger
Enter IRLTKStatusUpdate
as the event to trigger on
While Streamer.bot is connected to the Remote OBS via obs-websocket it should receive events every 2.5 seconds
You can perform further logic on these values with Streamer.bot actions and sub-actions.