2020-07-20 11:41:15 +02:00
|
|
|
"use strict";
|
|
|
|
|
|
2020-06-22 11:49:07 +02:00
|
|
|
const fs = require('fs');
|
|
|
|
|
const dest = fs.createWriteStream('./output');
|
|
|
|
|
const { SRTReadStream } = require('../index.js');
|
|
|
|
|
|
2020-07-03 14:26:40 +02:00
|
|
|
setInterval(() => {
|
|
|
|
|
console.log("Hey, I am still alive!");
|
|
|
|
|
}, 2000);
|
|
|
|
|
|
2020-06-22 13:03:08 +02:00
|
|
|
if (process.argv[2] === "listener") {
|
|
|
|
|
const srt = new SRTReadStream('0.0.0.0', 1234);
|
|
|
|
|
srt.listen(readStream => {
|
|
|
|
|
readStream.pipe(dest);
|
|
|
|
|
});
|
2020-06-24 12:55:23 +02:00
|
|
|
console.log("async listen");
|
2020-06-22 13:03:08 +02:00
|
|
|
} else {
|
|
|
|
|
const srt = new SRTReadStream('127.0.0.1', 1234);
|
|
|
|
|
srt.connect(readStream => {
|
|
|
|
|
readStream.pipe(dest);
|
|
|
|
|
});
|
2020-07-20 11:41:15 +02:00
|
|
|
}
|