Can't access JS API Callbacks in Custom Browser

aaronaustin

New Member
I'm reposting this in the correct forum now. Sorry for the duplicate.

I'm trying to access the callbacks in a custom browser dock. So far I've got a simple HTML file. I set up a script with an eventListener per the example in the docs.

JavaScript:
         window.addEventListener('obsSceneChanged', function (event) {
            var t = document.createTextNode(event.detail.name)
            document.body.appendChild(t)
        })

However, nothing is happening on scene change. I tried to see what methods were available in the api:
JSON:
        function getObjectTest() {
            var test = JSON.stringify(window.obsstudio);
            var display = document.getElementById("display");
            display.innerHTML = test;
        }

This only shows the inital object: {"pluginVersion":"2.9.1"}. I was under the assumption that OBS injected the API into the browser dock and then it would be available. I'm interested in getting the active scene name for display in the UI. Any help or examples of this working are greatly appreciated. Thanks!


 

aaronaustin

New Member
Unfortunately the Custom Browser Docks do not currently support the OBS JS API. It's something I'm slowly working on trying to fix.
Thanks so much! I thought I was going crazy. where is the API available?

I’m actually just trying to display the name of the current active program scene in the UI. I can’t figure out how to access an element in the UI to display it.
 

WizardCM

Forum Moderator
Community Helper
Currently it's only available in Browser Sources. When Browser Docks were introduced, the API was not tested and we didn't realise it didn't work until recently.
 

NoeAL

Member
Unfortunately the Custom Browser Docks do not currently support the OBS JS API. It's something I'm slowly working on trying to fix.
Hi! Is there a way to get the scene list using the OBS JS API? Or will there be some way to do it in the future?
Thanks in advance.
 

Keith Chadwick

New Member
Currently it's only available in Browser Sources. When Browser Docks were introduced, the API was not tested and we didn't realise it didn't work until recently.

Hey, was wondering if there has been any movement on implementing the obsstudio object methods in docked web pages?
 
Top