-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
55 lines (48 loc) · 887 Bytes
/
index.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
49
50
51
52
53
54
55
const NodeMediaServer = require("node-media-server");
const httpConfig = {
port: 8000,
allow_origin: "*",
mediaroot: "./media",
};
const rtmpConfig = {
port: 1935,
chunk_size: 60000,
gop_cache: true,
ping: 10,
ping_timeout: 60,
};
const transformationConfig = {
ffmpeg: "./ffmpeg",
tasks: [
{
app: "live",
hls: true,
hlsFlags: "[hls_time=2:hls_list_size=3:hls_flags=delete_segments]",
hlsKeep: false,
},
],
MediaRoot: "./media",
};
const relayConfig = {
ffmpeg: './ffmpeg',
tasks: [
{
app: 'live',
mode: 'push',
edge: 'rtmp://nms2:1936',
},
{
app: 'live',
mode: 'push',
edge: 'rtmp://nms3:1937',
}
]
}
const config = {
http: httpConfig,
rtmp: rtmpConfig,
relay: relayConfig,
trans: transformationConfig,
};
const nms = new NodeMediaServer(config);
nms.run();