Totally bubblegum-and-string at the moment.
You’ll need Open Broadcaster Software and the obs-websocket plugin for
it. Set it up in Tools > WebSockets Server Settings
. Set a password
there.
You will also need websocket, which is available from GNU ELPA. You can install it with
M-x package-install RET websocket RET
.
You will probably be able to use M-x obs-websocket-connect
to
connect to your OBS server. I have no idea if it will work for anyone
but me, though. Good luck!
You can use (setq obs-websocket-password "yourpasswordhere")
in your Emacs configuration file so that it won’t prompt you for the password.
Here’s my config. It uses use-package and hydra.
(use-package websocket)
(defun my/twitch-message (text)
(interactive "MText: ")
(with-current-buffer
(get-buffer-create "Twitch message")
(erase-buffer)
(insert text)
(goto-char (point-min))))
(use-package obs-websocket
:config
(defhydra my/obs-websocket (:exit t)
"Control Open Broadcast Studio"
("c" (obs-websocket-connect) "Connect")
("d" (obs-websocket-send "SetCurrentScene" :scene-name "Desktop") "Desktop")
("e" (obs-websocket-send "SetCurrentScene" :scene-name "Emacs") "Emacs")
("i" (obs-websocket-send "SetCurrentScene" :scene-name "Intermission") "Intermission")
("v" (browse-url "https://twitch.tv/sachachua"))
("m" my/twitch-message "Message")
("t" my/twitch-message "Message")
("<f8>" my/twitch-message "Message") ;; Then I can just f8 f8
("sb" (obs-websocket-send "StartStreaming") "Stream - begin")
("se" (obs-websocket-send "StopStreaming") "Stream - end"))
(global-set-key (kbd "<f8>") #'my/obs-websocket/body)
:load-path "~/code/obs-websocket-el" :ensure nil)
Better installation instructions will eventually be written by someone, if anyone wants to actually maintain this.
Protocol reference: https://github.com/Palakis/obs-websocket/blob/4.x-current/docs/generated/protocol.md
My e-mail address is [email protected], although I tend to reply slowly.