diff options
| author | Jibon Costa <jiboncosta57@gmail.com> | 2020-03-29 22:00:01 +0600 |
|---|---|---|
| committer | Jibon Costa <jiboncosta57@gmail.com> | 2020-03-29 22:00:01 +0600 |
| commit | 753e98125ba93504c72effa6a74e92851a48787b (patch) | |
| tree | a7056c357c6cd702bef538f4fdc8efdb935c835f | |
| parent | 55850d77277a336523530b8c14692faa275c8544 (diff) | |
| download | bbb-recorder-753e98125ba93504c72effa6a74e92851a48787b.tar.gz bbb-recorder-753e98125ba93504c72effa6a74e92851a48787b.zip | |
separate config file added
| -rw-r--r-- | config.json | 6 | ||||
| -rw-r--r-- | ffmpegServer.js | 9 | ||||
| -rw-r--r-- | liveRTMP.js | 4 |
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; |
