Created
February 5, 2024 23:56
-
-
Save thebirk/39d0c65cddeb45382145086962561cb2 to your computer and use it in GitHub Desktop.
OBS Websocket browser proof of concept
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.addEventListener("contextmenu", async function(e) { | |
const message = e.target.closest('.chat-line__message'); | |
if (!message) { | |
return; | |
} | |
e.preventDefault(); | |
const obs = new OBSWebSocket(); | |
await obs.connect("ws://127.0.0.1:4455", "4tP1Yw7d5FxnnCjI"); | |
await obs.call("SetInputSettings", { | |
inputName: "ChatHighlight", | |
overlay: true, | |
inputSettings: { | |
url: "data:text/html,<style>html,body{background:white;}</style>" + message.innerHTML, | |
}, | |
}); | |
await obs.disconnect(); | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "OBS Chat Highlight", | |
"description": "Pin a message to a OBS browser source", | |
"version": "1.0", | |
"manifest_version": 3, | |
"content_scripts": [ | |
{ "matches": ["*://*.twitch.tv/*"], "js": ["obs-ws.min.js", "content.js"] } | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment