forked from chriswiggins/rtsp-streaming-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rtsp-server.js
48 lines (42 loc) · 979 Bytes
/
rtsp-server.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
const Rtsp = require('rtsp-server');
const Winston = require('winston');
Winston.configure({
transports: [
new (Winston.transports.Console)({
json: false,
colorize: true,
timestamp: true,
handleExceptions: false,
level: 'debug',
prettyPrint: function (obj){
return JSON.stringify(obj);
}
})
]
});
const ServerClass = require('./lib/Server');
const ClientServerClass = require('./lib/ClientServer');
const MountsClass = require('./lib/Mounts');
class RtspServer {
constructor(config){
this.Mounts = new MountsClass({
rtpPortStart: config.rtpPortStart,
rtpPortCount: config.rtpPortCount
});
this.Server = new ServerClass({
rtspPort: config.serverPort
}, this.Mounts);
this.ClientServer = new ClientServerClass({
rtspPort: config.clientPort
}, this.Mounts);
}
async start(){
try {
await this.Server.start();
await this.ClientServer.start();
} catch (e) {
throw e;
}
}
}
module.exports = RtspServer;