1 Star 0 Fork 1

xtzx/webrtc-streamer

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
joinxmpproom.js 1.61 KB
一键复制 编辑 原始数据 按行查看 历史
mpromonet 提交于 2020-10-18 18:33 . replace request with fetch
#!/usr/bin/env node
/*
* NodeJS example to send a webrtc-streamer stream to jitsi
*/
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
// decode arguments
if (process.argv.length <= 4) {
console.log("Usage: " + __filename + " <webrtc-streamer url> <videourl> <xmpp url> <xmpp room>");
process.exit(-1);
}
var webrtcstreamerurl = process.argv[2];
console.log("webrtcstreamerurl: " + webrtcstreamerurl);
var videourl = process.argv[3];
console.log("videourl: " + videourl);
var xmppRoomUrl = process.argv[4];
console.log("xmppRoomUrl: " + xmppRoomUrl);
var xmppRoomId = "testroom"
if (process.argv.length >= 5) {
xmppRoomId = process.argv[5];
}
console.log("xmppRoomId: " + xmppRoomId);
var jsdom = require("jsdom");
const { JSDOM } = jsdom;
const { window } = new JSDOM("");
global.jquery = require("jquery")(window);
global.$ = (selector,context) => {return new jquery.fn.init(selector,context); };
global.window = window;
global.document = window.document;
global.DOMParser = window.document.DOMParser;
global.XMLHttpRequest = window.XMLHttpRequest;
var strophe = require("strophe.js");
global.Strophe = strophe.Strophe;
global.$iq = strophe.$iq;
//global.Strophe.log = console.log;
require("strophejs-plugin-disco");
require("strophejs-plugin-muc");
global.SDP = require("strophe.jingle/strophe.jingle.sdp.js");
global.fetch = require("node-fetch");
var XMPPVideoRoom = require("./html/xmppvideoroom.js");
var xmpp = new XMPPVideoRoom(xmppRoomUrl, webrtcstreamerurl);
var username = "user"+Math.random().toString(36).slice(2);
console.log("join " + xmppRoomId + "/" + username);
xmpp.join(xmppRoomId,videourl,username);
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/smilejx001/webrtc-streamer.git
git@gitee.com:smilejx001/webrtc-streamer.git
smilejx001
webrtc-streamer
webrtc-streamer
master

搜索帮助