Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
throw new Error("Missing IP address\nUsage: node index.js ");
//Get ip
const ip = process.argv[2];
//Create UDP server endpoint
const endpoint = MediaServer.createEndpoint(ip);
const base = 'www';
const options = {
key: fs.readFileSync ('server.key'),
cert: fs.readFileSync ('server.cert')
};
//Enable debug
MediaServer.enableDebug(true);
MediaServer.enableUltraDebug(true);
//Restrict port range
MediaServer.setPortRange(10000,20000);
// maps file extention to MIME typere
const map = {
'.ico': 'image/x-icon',
'.html': 'text/html',
'.js': 'text/javascript',
'.json': 'application/json',
'.css': 'text/css',
'.png': 'image/png',
'.jpg': 'image/jpeg',
'.wav': 'audio/wav',
'.mp3': 'audio/mpeg',
throw new Error("Missing IP address\nUsage: node index.js ");
//Get ip
const ip = process.argv[2];
//Create UDP server endpoint
const endpoint = MediaServer.createEndpoint(ip);
const base = 'www';
const options = {
key: fs.readFileSync ('server.key'),
cert: fs.readFileSync ('server.cert')
};
//Enable debug
MediaServer.enableDebug(false);
MediaServer.enableUltraDebug(false);
//Restrict port range
MediaServer.setPortRange(10000,20000);
// maps file extention to MIME typere
const map = {
'.ico': 'image/x-icon',
'.html': 'text/html',
'.js': 'text/javascript',
'.json': 'application/json',
'.css': 'text/css',
'.png': 'image/png',
'.jpg': 'image/jpeg',
'.wav': 'audio/wav',
'.mp3': 'audio/mpeg',
const SDPInfo = SemanticSDP.SDPInfo;
const PORT = 8084;
//HTTP&WS stuff
const https = require ('https');
const url = require ('url');
const fs = require ('fs');
const path = require ('path');
const WebSocketServer = require ('websocket').server;
//Get the Medooze Media Server interface
const MediaServer = require("medooze-media-server");
//Enable debug
MediaServer.enableDebug(false);
MediaServer.enableUltraDebug(false);
//Check
if (process.argv.length!=3)
throw new Error("Missing IP address\nUsage: node index.js "+process.argv.length);
//Get ip
const ip = process.argv[2];
//The list of sport castings
const rooms = new Map();
const base = 'www';
const options = {
key: fs.readFileSync ('server.key'),
cert: fs.readFileSync ('server.cert')
httpPort,
httpsPort,
staticDir,
serverAddress
} = rawConfig
const key = await readFile(keyPath)
const cert = await readFile(certPath)
const endpoint = MediaServer.createEndpoint(serverAddress)
const simulcastSessionTable = new Map()
const broadcastSessionTable = new Map()
if (debug) {
MediaServer.enableDebug(true)
}
return {
key,
cert,
endpoint,
httpPort,
httpsPort,
staticDir,
serverAddress,
simulcastSessionTable,
broadcastSessionTable
}
}
constructor(publicIp)
{
this.endpoint = medoozeMediaServer.createEndpoint(publicIp);
medoozeMediaServer.enableDebug(true);
medoozeMediaServer.enableUltraDebug(true);
this.streams = new Map();
}
constructor(params?: any) {
//create expressjs application
super()
this.params = params
if (params.endpoint) {
config.endpoint = params.endpoint
}
if (params.capabilities){
config.capabilities = params.capabilities
}
MedoozeMediaServer.enableLog(config.log)
MedoozeMediaServer.enableDebug(config.debug)
MedoozeMediaServer.enableUltraDebug(config.ultraDebug)
MedoozeMediaServer.setPortRange(config.minMediaPort, config.maxMediaPort)
this.app = express()
//configure application
this.config()
//add routes
this.routes()
}