Copy link to clipboard
Copied
I'm trying to start a nodejs server alongside my panel. According to the tutorial on https://medium.com/adobetech/how-to-build-a-node-js-server-in-a-panel-ba1d63ea67e2 I should be able to accomplish this via using an invisible html page that loads the nodejs server.
I've tried this, but I can't get it to load, and I don't get a lot of feedback on this, so I'm thinking it fails on the actual loading of the extension with CSInterface.
manifest.xml: contains both the main extension as well as the server extension. Nodejs and mixed content enabled on both
<?xml version="1.0" encoding="UTF-8"?>
<ExtensionManifest Version="9.0" ExtensionBundleId="com.Limecraft.Panel" ExtensionBundleVersion="1.0.0"
ExtensionBundleName="LimecraftPanel" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ExtensionList>
<Extension Id="com.LimecraftPanel.extension" Version="1.0" />
<Extension Id="com.LimecraftPanel.server" Version="1.0" />
</ExtensionList>
<ExecutionEnvironment>
<HostList>
<Host Name="PPRO" Version="13.0" />
</HostList>
<LocaleList>
<Locale Code="All" />
</LocaleList>
<RequiredRuntimeList>
<RequiredRuntime Name="CSXS" Version="9.0" />
</RequiredRuntimeList>
</ExecutionEnvironment>
<DispatchInfoList>
<Extension Id="com.LimecraftPanel.extension">
<DispatchInfo >
<Resources>
<MainPath>./client/html/index.html</MainPath>
<ScriptPath>./jsx/index.jsx</ScriptPath>
<CEFCommandLine>
<Parameter>--allow-file-access</Parameter>
<Parameter>--allow-file-access-from-files</Parameter>
<Parameter>--enable-nodejs</Parameter>
<Parameter>--mixed-context</Parameter>
</CEFCommandLine>
</Resources>
<Lifecycle>
<AutoVisible>true</AutoVisible>
</Lifecycle>
<UI>
<Type>Panel</Type>
<Menu>Limecraft Flow</Menu>
<Geometry>
<Size>
<Height>600</Height>
<Width>600</Width>
</Size>
</Geometry>
</UI>
</DispatchInfo>
</Extension>
<Extension Id="com.LimecraftPanel.server">
<DispatchInfo >
<Resources>
<MainPath>./client/html/localServer.html</MainPath>
<CEFCommandLine>
<Parameter>--allow-file-access</Parameter>
<Parameter>--allow-file-access-from-files</Parameter>
<Parameter>--enable-nodejs</Parameter>
<Parameter>--mixed-context</Parameter>
</CEFCommandLine>
</Resources>
<Lifecycle>
<AutoVisible>false</AutoVisible>
</Lifecycle>
<UI>
<Type>Custom</Type>
<Icons />
</UI>
</DispatchInfo>
</Extension>
</DispatchInfoList>
</ExtensionManifest>
index.html: The main page of the app. This one works as normal. It loads the CSInterface.js & jquery, and should open the server extension as written in the manifest, but I'm pretty sure it's this step that doesn't work. Not getting any feedback whatsoever here.
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Limecraft Flow - Login</title>
<script src="../../lib/CSInterface.js"></script>
<!-- <script src="./js/app.js"></script>-->
<script src="../../lib/jquery-1.9.1.js"></script>
<script>
//Open server extension
console.log("opening server extension")
console.log(__dirname + '\\client\\html\\testnode.js');
var csInterface = new CSInterface();
csInterface.requestOpenExtension("com.LimecraftPanel.server");
</script>
localServer.html : Should get loaded via the CSInterface script, but no logs get triggered, and most likely doesn't get loaded at all.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<!-- <script src="testnode.js"></script> --> <!-- Tried loading it like this, but also no feedback, so pretty sure this file doesn't get loaded. -->
<script>
/*As you can see in the <MainPath> tag of the manifest.xml above, when a CEP method is called in your JavaScript file,
another HTML markup will be loaded from ./client/localServer.html.
Note that we addedlocalServer.html` when we updated the directory structure.
You might wonder why you have to write another HTML file for the server extension.
The purpose of this HTML file is to start your server and stay hidden.*/
/* This script uses cep_node to start the Node.js server located at '/server/main.js' */
console.log("=============================");
console.log("SETTING UP LOCAL SERVER");
var localServer = cep_node.require(__dirname + '\\client\\html\\testnode.js')();
</script>
<title>node server app</title>
</head>
<body>
</body>
</html>
testnode.js : The testcode for the server, this one works both via terminal command as well as via loading it directly via <script> tag in the main app, meaning it most likely just doesn't get loaded along with the LocalServer.html
const http = require('http');
const hostname = '127.0.0.1';
const port = 3000;
const server = http.createServer((req, res) => {
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain');
res.end('Hello World\n');
});
server.listen(port, hostname, () => {
console.log(`Server running at http://${hostname}:${port}/`);
});
the localserver doesn't get loaded via any means,leading me to believe that this is some problem with CSInterface or a fault in my manifest.xml code, but I see nothing I'm doing wrong here. Am I missing something?
1 Correct answer
So, I've managed to find a solution. The problem was that in the manifest.xml beneath the Type-tag the Geometry-tag needs to be specified, even if it's not used because it is invisible. This caused it to never even start up in the first place.
So: This doesn't work at all
<UI>
<Type>Custom</Type>
<Icons />
</UI>
With the geometry tags filled in, it does.
<Type>Custom</Type>
<Geometry>
<Size>
<Height>600</Height>
<Width>600</Width>
</Size>
</Geometry>
</UI>
Copy link to clipboard
Copied
This has nothing to do with Premiere Pro's APIs, but I've asked some CEP/JavaScript folks to have a look...
Copy link to clipboard
Copied
Sorry about that, seems like I didn't look too well at the correct board before I posted.
Copy link to clipboard
Copied
You shouldn't be sorry; I'm not sure there _is_ a great place to post such questions! Help is on the way.
Copy link to clipboard
Copied
It does look like the server panel is not even loading. Maybe try using different version of of ExtensionManifest.
<ExtensionManifest Version="7.0" ExtensionBundleId="com.cquencelabs.cquence" ExtensionBundleVersion="1.0.0" | |
ExtensionBundleName="Rename" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> |
<RequiredRuntimeList> | |
<RequiredRuntime Name="CSXS" Version="7.0" /> | |
</RequiredRuntimeList> | |
Copy link to clipboard
Copied
Also,
you can include the server extension inside your .debug file and see why the extension is not loading. something like this:
.debug
```
<?xml version='1.0' encoding='UTF-8'?>
<ExtensionList>
<Extension Id="my.main.extension">
<HostList>
<Host Name="PHXS" Port="8088" />
<Host Name="IDSN" Port="8087" />
<Host Name="AICY" Port="8086" />
<Host Name="ILST" Port="8085" />
<Host Name="PPRO" Port="8084" />
<Host Name="AEFT" Port="8083" />
<Host Name="PRLD" Port="8082" />
<Host Name="FLPR" Port="8081" />
<Host Name="DRWV" Port="8080" />
</HostList>
</Extension>
<Extension Id="my.server.extension">
<HostList>
<Host Name="PHXS" Port="8188" />
<Host Name="IDSN" Port="8187" />
<Host Name="AICY" Port="8186" />
<Host Name="ILST" Port="8185" />
<Host Name="PPRO" Port="8184" />
<Host Name="AEFT" Port="8183" />
<Host Name="PRLD" Port="8182" />
<Host Name="FLPR" Port="8181" />
<Host Name="DRWV" Port="8180" />
</HostList>
</Extension>
</ExtensionList>
```
Copy link to clipboard
Copied
So, I've managed to find a solution. The problem was that in the manifest.xml beneath the Type-tag the Geometry-tag needs to be specified, even if it's not used because it is invisible. This caused it to never even start up in the first place.
So: This doesn't work at all
<UI>
<Type>Custom</Type>
<Icons />
</UI>
With the geometry tags filled in, it does.
<Type>Custom</Type>
<Geometry>
<Size>
<Height>600</Height>
<Width>600</Width>
</Size>
</Geometry>
</UI>
Copy link to clipboard
Copied
I'd just like to say that this worked for me, too. Is there any manifest linting tool available that could help spot these errors?
It was a lot of hours of tweaking different things wondering why this wasn't working until I found this answer so thank you very much!
I too was following the guide on Medium, perhaps its worth leaving a comment on there for the author to fix it?
Copy link to clipboard
Copied
Sure!

