forked from mpromonet/webrtc-streamer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
joinjanusvideoroom.js
executable file
·33 lines (28 loc) · 1007 Bytes
/
joinjanusvideoroom.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
#!/usr/bin/env node
/*
* NodeJS example to send a webrtc-streamer stream to janus-gateway
*/
// decode arguments
if (process.argv.length <= 2) {
console.log("Usage: " + __filename + " <webrtc-streamer url> <videourl>");
process.exit(-1);
}
var webrtcstreamerurl = process.argv[2];
console.log("webrtcstreamerurl: " + webrtcstreamerurl);
var videourl = process.argv[3];
console.log("videourl: " + videourl);
// get configuration from webrtc-streamer using janusvideoroom.json
global.request = require("then-request");
var JanusVideoRoom = require("./html/janusvideoroom.js");
request( "GET", webrtcstreamerurl + "/janusvideoroom.json" ).done(
function (response) {
if (response.statusCode === 200) {
console.log("HTTP answer:"+ response.body);
eval("{" + response.body + "}");
var janus = new JanusVideoRoom(janusRoomConfig.url, webrtcstreamerurl);
janus.join(janusRoomConfig.roomId,videourl,"video");
} else {
console.log("HTTP code:"+ response.statusCode);
}
}
);