Eagle 3D Streaming

How to Add Multiple App and Config Support in No-Iframe Implementation

GitHub Link: https://github.com/e3ds/full-html-control/tree/html/ejs-multiApp

First, use the following command to clone the repository branch:

git clone -b html/multiApp --single-branch https://github.com/e3ds/full-html-control

 

To dynamically set the app name and config, we need to modify the tokenServer.js

app.get("/:appName/:configurationName", function (req, res) { const appName = req.params.appName; //dynamically receiving app name from url const configurationName = req.params.configurationName; //dynamically receiving config name from url GenerateStreamingSessionToken(res,false, appName, configurationName) } );

Here, we are dynamically receiving appName and configurationName from the URL params. Then we pass the appName and configurationName as parameters to the GenerateStreamingSessionToken function.

 

Inside the GenerateStreamingSessionToken function, we update streamingAppInfo variable’s appName and configurationName properties.

function GenerateStreamingSessionToken(res,indexCP_dist=false, appName, configurationName) { streamingAppInfo.core.appName = appName; streamingAppInfo.core.configurationName = configurationName; const axios = require("axios"); axios.post( "https://token.eaglepixelstreaming.com/api/v1/token/create", { "object" : streamingAppInfo, "expiry": tokenExpiryDuration, "client" : clientUserName }, { headers: {"Authorization": "Auth "+apiKey } } ) .then((response) => { //console.dir(response); console.log("response.token :" +response.data.token); if(response.data.error) console.log("response.error :" +response.data.error); var obj={ token: response.data.token, clientUserName: clientUserName, } console.log("obj passing to ejs view :" + JSON.stringify(obj) ); res.render("player", obj); }) .catch(err => { console.error(err); console.log(err); }); }

Eagle 3D Streaming