代码拉取完成,页面将自动刷新
//
// Created by Mingliang Chen on 17/8/1.
// illuspas[a]gmail.com
// Copyright (c) 2018 Nodemedia. All rights reserved.
//
const Logger = require('./node_core_logger');
const NodeRtmpServer = require('./node_rtmp_server');
const NodeHttpServer = require('./node_http_server');
const NodeTransServer = require('./node_trans_server');
const NodeRelayServer = require('./node_relay_server');
const NodeIpcServer = require('./node_ipc_server');
const context = require('./node_core_ctx');
class NodeMediaServer {
constructor(config) {
this.config = config;
}
run() {
Logger.setLogType(this.config.logType);
if (this.config.rtmp) {
this.nrs = new NodeRtmpServer(this.config);
this.nrs.run();
}
if (this.config.http) {
this.nhs = new NodeHttpServer(this.config);
this.nhs.run();
}
if (this.config.trans) {
if (this.config.cluster) {
Logger.log('NodeTransServer does not work in cluster mode');
} else {
this.nts = new NodeTransServer(this.config);
this.nts.run();
}
}
if (this.config.relay) {
if (this.config.cluster) {
Logger.log('NodeRelayServer does not work in cluster mode');
} else {
this.nls = new NodeRelayServer(this.config);
this.nls.run();
}
}
if (this.config.cluster) {
this.nis = new NodeIpcServer(this.config);
this.nis.run();
}
process.on('uncaughtException', function (err) {
Logger.error('uncaughtException', err);
});
}
on(eventName, listener) {
context.nodeEvent.on(eventName, listener);
}
stop() {
if (this.nrs) {
this.nrs.stop();
}
if (this.nhs) {
this.nhs.stop();
}
if (this.nls) {
this.nls.stop();
}
if (this.nis) {
this.nis.stop();
}
}
getSession(id) {
return context.sessions.get(id);
}
}
module.exports = NodeMediaServer
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。