diff --git a/README.md b/README.md index 7ba0aee5..fdb381bc 100644 --- a/README.md +++ b/README.md @@ -307,6 +307,14 @@ nms.on('donePlay', (id, StreamPath, args) => { ```js ...... nms.run(); + +nms.check('viewerConnect', async (args) => { // Same double as PreConnect + console.log('[NodeCheck on viewerConnect]', `args=${JSON.stringify(args)}`); + connect = await function(args) { return ? }; + + return connect ? true : false; +}); + nms.check('preConnect', async (args) => { console.log('[NodeCheck on preConnect]', `args=${JSON.stringify(args)}`); connect = await function(args) { return ? }; diff --git a/node_flv_session.js b/node_flv_session.js index 1e843d72..967954e3 100644 --- a/node_flv_session.js +++ b/node_flv_session.js @@ -66,6 +66,7 @@ class NodeFlvSession { this.isStarting = true; Logger.log(`[${this.TAG} connect] id=${this.id} ip=${this.ip} args=${JSON.stringify(urlInfo.query)}`); context.nodeEvent.emit("preConnect", this.id, this.connectCmdObj); + if (!this.isStarting) { this.stop(); return; diff --git a/node_http_server.js b/node_http_server.js index 3b0ced26..2c29f1c3 100644 --- a/node_http_server.js +++ b/node_http_server.js @@ -169,9 +169,9 @@ class NodeHttpServer { let socket = session instanceof NodeFlvSession || session instanceof NodeHlsSession ? session.req.socket : session.socket; context.stat.inbytes += socket.bytesRead; context.stat.outbytes += socket.bytesWritten; - if (session.req) { - context.hlsSessions.delete(session.req.params.key); - } + // if (session.req) { + // context.hlsSessions.delete(session.req.params.key); + // } } }); } diff --git a/node_media_server.js b/node_media_server.js index fc1f6a20..7a5c0c81 100644 --- a/node_media_server.js +++ b/node_media_server.js @@ -20,13 +20,7 @@ class NodeMediaServer { } async run() { - await Logger.setLogFile({ - path: this.config.logging.file_path || '../logs', - output: this.config.logging.file_output || 'NONE' - }); - - Logger.setLogType(this.config.logging.shell_output || this.config.logType || 'NORMAL'); - + Logger.setLogType(this.config.logType); Logger.log(`Node Media Server v${Package.version}`); if (this.config.rtmp) { diff --git a/node_rtmp_session.js b/node_rtmp_session.js index 9412efd3..a9a9cfc1 100644 --- a/node_rtmp_session.js +++ b/node_rtmp_session.js @@ -1032,7 +1032,8 @@ class NodeRtmpSession { if (typeof invokeMessage.streamName !== "string") { return; } - this.publishStreamPath = "/" + this.appname + "/" + invokeMessage.streamName.split("?")[0]; + // this.publishStreamPath = "/" + this.appname + "/" + invokeMessage.streamName.split("?")[0]; + this.publishStreamPath = this.appname; this.publishArgs = QueryString.parse(invokeMessage.streamName.split("?")[1]); this.publishStreamId = this.parserPacket.header.stream_id; context.nodeEvent.emit("prePublish", this.id, this.publishStreamPath, this.publishArgs);