summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.json6
-rw-r--r--ffmpegServer.js9
-rw-r--r--liveRTMP.js4
3 files changed, 15 insertions, 4 deletions
diff --git a/config.json b/config.json
new file mode 100644
index 0000000..41b480e
--- /dev/null
+++ b/config.json
@@ -0,0 +1,6 @@
+{
+ "rtmpUrl": "rtmp://a.rtmp.youtube.com/live2/MyKey",
+ "ffmpegServer": "ws://localhost",
+ "ffmpegServerPort": 4000,
+ "auth": "mZFZN4yc"
+} \ No newline at end of file
diff --git a/ffmpegServer.js b/ffmpegServer.js
index da3d1ba..ef8c3a6 100644
--- a/ffmpegServer.js
+++ b/ffmpegServer.js
@@ -1,8 +1,11 @@
const child_process = require('child_process');
const WebSocketServer = require('ws').Server;
const http = require('http');
+const fs = require('fs');
-const server = http.createServer().listen(4000, () => {
+var config = JSON.parse(fs.readFileSync("config.json", 'utf8'));
+
+const server = http.createServer().listen(config.ffmpegServerPort, () => {
console.log('Listening...');
});
@@ -11,7 +14,7 @@ const wss = new WebSocketServer({
});
-const rtmpUrl = "rtmp://a.rtmp.youtube.com/live2/MyKey";
+const rtmpUrl = config.rtmpUrl;
wss.on('connection', function connection(ws, req) {
console.log('connection');
@@ -23,7 +26,7 @@ wss.on('connection', function connection(ws, req) {
return;
}
- if(auth[1] !== "mZFZN4yc"){
+ if(auth[1] !== config.auth){
ws.terminate();
return;
}
diff --git a/liveRTMP.js b/liveRTMP.js
index 0fcbfef..dc1da7c 100644
--- a/liveRTMP.js
+++ b/liveRTMP.js
@@ -2,8 +2,10 @@ const puppeteer = require('puppeteer');
const Xvfb = require('xvfb');
var exec = require('child_process').exec;
const fs = require('fs');
+var config = JSON.parse(fs.readFileSync("config.json", 'utf8'));
const homedir = require('os').homedir();
-const ffmpegServer = "ws://localhost:4000/auth/mZFZN4yc";
+
+const ffmpegServer = config.ffmpegServer + ":" + config.ffmpegServerPort + "/auth/" + config.auth;
var xvfb = new Xvfb({silent: true});
var width = 1280;