As the title already gives away, it’s possible to control OBS (in fact, almost everything in OBS) by changing slides in OpenLP. The way this works is by having a custom stage running in the background containing a JavaScript that sends WebSocket signals to OBS. But let’s go step by step.<br><h1>You will need:</h1>
OBS and OpenLP (but I assume, you already have those, otherwise you wouldn’t be here)
the OBS Websocket Plugin
the OBS Custom Stage View (attached to this post)<br>
the OBS Websocket JavaScript API
<h1>How to install the files</h1><h2>OBS Websocket Plugin</h2>
Just follow the instructions on the GitHub, specifically on the Releases page. (Search for “Install instructions”.)
<h2>OBS Custom Stage View</h2>
Create a custom stage view named “obs”, as described in the OpenLP manual. Put the files attached to this post (“stage.css”, “stage.html” and “stage.js”) inside of the folder.<br>
<h2>OBS Websocket JavaScript API<br></h2>
Download the file “obs-websocket.js” from the GitHub – just look for the link “Download”. Put this file in the custom stage folder, too. Your OpenLP data folder should look something like this:
<br>
<img alt="" src="https://forums.openlp.org/uploads/editor/l3/mh1q2xgqe0fw.png" width="434" height="390"><br>
<h1>How to setup OpenLP</h1>
To activate the “Remote” plugin in OpenLP, check the OpenLP manual. To see, if it worked, open a service and put a song into Live Mode. Now try the default stage view at http://localhost:4316/stage. It should look like the one in the manual.
Then, check the custom stage view we just installed. It is located at http://localhost:4316/stage/obs. It should look like this, a large white background with the lyrics at the bottom:
<img alt="" src="https://forums.openlp.org/uploads/editor/pi/y12ot4aef87r.png" title="Image: https://forums.openlp.org/uploads/editor/pi/y12ot4aef87r.png" width="543" height="408"><br>
<h1>How to setup OBS<br></h1><h2>Activate WebSocket</h2>
If the installation worked as it should, there is now a “WebSockets Server Settings” item in the “Tools” menu of OBS. There, activate the server, let the port stay at 4444, and don’t put in a password just now. It can be helpful to activate “Enable system tray alerts” for the moment, so you will get a notification, whenever the JavaScript is connecting to the WebSocket. Later, you can turn that off again.
<h2>Create a scene</h2>
You will probably have an OBS scene where the lyrics are displayed. For the OpenLP control to work, you have to have such a scene. Inside of it, you need to create a “Browser” item. Here are the settings for this item (they are in German, but you’ll probably get it anyway):<br>
<img alt="" src="https://forums.openlp.org/uploads/editor/qy/5z7ft44xadxm.png" width="543" height="804"><br>
Local file: It’s not a local file.
URL: the same we had tested earlier
Width/Height: Just put in the dimensions you’re streaming in.
User defined FPS: yes
Reroute audio: There’s no audio.
FPS: I choose 5, because the Javascript updates every 500ms, so I think I don’t need to update the browser item all too often.
User defined CSS: Delete everything here, we’re taking care of that ourselves.
Deactivate when source is invisible: Now this is important! You will want to have the browser item active, even when it is not visible, and even when you’re in another scene that does not display lyrics. Our JavaScript is running inside this browser item, so if we deactivate it, the script is deactivated, too.
Refresh browser when scene gets active: Actually, I’m not sure about this one. I figured it’s probably good to have the browser refresh itself every now and then.
Note: As I said, the JavaScript is running inside of the browser item. There could be problems if you have multiple scenes with lyrics inside of them. If all of them use the same browser item, and all are active all the time, you will end up with multiple action triggers everytime you switch slides in OpenLP. This could have unintended consequences. A solution would be to have one custom stage view with the OBS JavaScript in one scene (and running in the background all the time), and have a second custom stage view without the OBS JavaScript in all the other scenes.
<h1>Try it out!</h1>
In theory it should already work. If you go to OpenLP and add to your service an item called, e.g. “scenechange:altar”, then the moment you activate it, OBS should switch to the scene called “altar”.
<br>
Well, this thing is getting rather long, so I will have to put the explanation of all this below.<br>