Skip to main content
Skip table of contents

How to Debug Javascript in VidiCore Using Eclipse

While VidiCore can manage a lot situations straight of the box, most users will sooner or later have to customise parts of their workflow, and do custom integrations. With VidiCore you can use Javascript to extend operations in for example job tasks, transcode presets or naming scripts. The export template functionality is also an example of where Javascript is needed. When you extend beyond the most simple scripts you will probably need to debug your system, and add automatic regression testing. 

Setting up Eclipse to debug Javascript in VidiCore has been available since version 4.0.3. It's straightforward and covered well in the API documentation. Just make sure that you enable the "Remote JavaScript configuration" option in Eclipse.

When you want to debug scripts on shape tags you should use the test script endpoint on shapes GET /shape-tag/(tag-name)/item/(item-id)/shape/(shape-id), which executes the script against a specific item/shape and return the resulting transcode preset, which can then be verified. This method can also be used to set up regression tests/automatic tests for your transcode presets.

The JavaScript debugging also works with transcode preset scripts. Set debugJavaScript to true, then transcode using your preset. The transcode job will block once the script is executing and you can connect using the debugger. Use GET /javascript/session to list the active debugging sessions, which helps you find the right session and port to attach to.

What about all the generic code I have in several places

Ok, now you have written a bunch of Javascript snippets, and you realise that you have the same code in several places, e.g., you might use the same re-naming script on several different storages. We have a solution for that as well. You can register generic Javascript code in a type of global library. The code in the global library will be executed before the specific code. Best is to keep the code in the library are functions only. The generic Javascript is created using configuration properties of the form javascript-{extension} , where  extension is any suffix. 

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.