diff --git a/.env.template b/.env.template index 27527da6..40ce64b9 100644 --- a/.env.template +++ b/.env.template @@ -62,10 +62,11 @@ RTMP_FROM_FILE=true # Enable local file streaming RTMP_FROM_URL=true # Enable URL streaming RTMP_FROM_STREAM=true # Enable live stream (camera, microphone, screen, window) RTMP_MAX_STREAMS=1 # Max simultaneous RTMP streams +RTMP_USE_NODE_MEDIA_SERVER=true # Use Node Media Server mirotalk-nms Docker image RTMP_SERVER=rtmp://localhost:1935 # RTMP server URL RTMP_APP_NAME=mirotalk # RTMP application name RTMP_STREAM_KEY= # RTMP stream key (optional) -RTMP_SECRET=mirotalkRtmpSecret # RTMP API secret +RTMP_SECRET=mirotalkRtmpSecret # RTMP API secret (Must match node-media-server config.js) RTMP_API_SECRET=mirotalkRtmpApiSecret # RTMP internal secret RTMP_EXPIRATION_HOURS=4 # RTMP URL validity duration (hours) RTMP_FFMPEG_PATH= # RTMP Custom path to FFmpeg binary (auto-detected if empty) diff --git a/app/src/Room.js b/app/src/Room.js index 724413e5..d2a1ac83 100644 --- a/app/src/Room.js +++ b/app/src/Room.js @@ -271,6 +271,7 @@ module.exports = class Room { // #################################################### getRTMPUrl(host, port) { + const rtmpUseNodeMediaServer = this.rtmp.useNodeMediaServer ?? true; const rtmpServer = this.rtmp.server != '' ? this.rtmp.server : false; const rtmpAppName = this.rtmp.appName != '' ? this.rtmp.appName : 'live'; const rtmpStreamKey = this.rtmp.streamKey != '' ? this.rtmp.streamKey : uuidv4(); @@ -279,7 +280,7 @@ module.exports = class Room { const rtmpServerURL = rtmpServer ? rtmpServer : `rtmp://${host}:${port}`; const rtmpServerPath = '/' + rtmpAppName + '/' + rtmpStreamKey; - const rtmpUrl = rtmpServerSecret + const rtmpUrl = rtmpUseNodeMediaServer ? this.generateRTMPUrl(rtmpServerURL, rtmpServerPath, rtmpServerSecret, expirationHours) : rtmpServerURL + rtmpServerPath; diff --git a/app/src/Server.js b/app/src/Server.js index 6e8c5980..a94b3640 100644 --- a/app/src/Server.js +++ b/app/src/Server.js @@ -64,7 +64,7 @@ dev dependencies: { * @license For commercial or closed source, contact us at license.mirotalk@gmail.com or purchase directly via CodeCanyon * @license CodeCanyon: https://codecanyon.net/item/mirotalk-sfu-webrtc-realtime-video-conferences/40769970 * @author Miroslav Pejic - miroslav.pejic.85@gmail.com - * @version 1.8.01 + * @version 1.8.02 * */ @@ -982,6 +982,7 @@ function startServer() { ? 'localhost' : req.headers.host?.split(':')[0] || 'localhost'; + const rtmpUseNodeMediaServer = rtmpCfg.useNodeMediaServer ?? true; const rtmpServer = rtmpCfg.server != '' ? rtmpCfg.server : false; const rtmpServerAppName = rtmpCfg.appName != '' ? rtmpCfg.appName : 'live'; const rtmpStreamKey = rtmpCfg.streamKey != '' ? rtmpCfg.streamKey : uuidv4(); @@ -990,12 +991,13 @@ function startServer() { const rtmpServerURL = rtmpServer ? rtmpServer : `rtmp://${domainName}:1935`; const rtmpServerPath = '/' + rtmpServerAppName + '/' + rtmpStreamKey; - const rtmp = rtmpServerSecret + const rtmp = rtmpUseNodeMediaServer ? generateRTMPUrl(rtmpServerURL, rtmpServerPath, rtmpServerSecret, expirationHours) : rtmpServerURL + rtmpServerPath; log.info('initRTMP', { headers: req.headers, + rtmpUseNodeMediaServer: rtmpUseNodeMediaServer, rtmpServer, rtmpServerSecret, rtmpServerURL, @@ -1326,8 +1328,8 @@ function startServer() { server_version: mediasoup?.version, client_version: mediasoupClient?.version, }, - rtmp_enabled: rtmpCfg?.enabled ? rtmpCfg : false, - videoAI_enabled: config.integrations?.videoAI?.enabled ? config.integrations.videoAI : false, + rtmp: rtmpCfg?.enabled ? rtmpCfg : false, + videoAI: config.integrations?.videoAI?.enabled ? config.integrations.videoAI : false, server_recording: config?.media?.recording?.enabled ? config.media.recording : false, }, diff --git a/app/src/config.template.js b/app/src/config.template.js index 88ab43da..fc7c049e 100644 --- a/app/src/config.template.js +++ b/app/src/config.template.js @@ -190,20 +190,30 @@ module.exports = { * - fromUrl: URL streaming [true/false] (default: true) * - fromStream: Live stream input [true/false] (default: true) * - maxStreams: Max simultaneous streams (default: 1) + * - useNodeMediaServer: Use node-media-server (mirotalk-nms) instead of ngnix-rtmp (mirotalk-rtmp) [true/false] (default true) * - server: RTMP server URL - * - appName: Application name for RTMP + * - appName: Application name for RTMP (if using mirotalk-rtmp add it in the nginx.conf if is not present) * - streamKey: Optional authentication key * - secret: Must match node-media-server config.js * - apiSecret: WebRTC → RTMP API secret * - expirationHours: Stream URL expiry in hours (default: 4) - * - dir: Directory for video files - * - ffmpegPatch: FFmpeg binary path + * - dir: Directory for video files (default app/rtmp) + * - ffmpegPatch: FFmpeg binary path (autodetected) + * - platform: current platform (autodetected) * - * RTMP Server Management: + * RTMP Node Media Server Management: * ------------------------ - * - Start: npm run nms-start - * - Stop: npm run nms-stop - * - Logs: npm run nms-logs + * - Image: mirotalk/nms:latest + * - Start: npm run nms-start + * - Stop: npm run nms-stop + * - Logs: npm run nms-logs + * + * RTMP Nginx Server Management: + * ------------------------ + * - Image: mirotalk/rtmp:latest + * - Start: npm run rtmp-start + * - Stop: npm run rtmp-stop + * - Logs: npm run rtmp-logs * * Important: * ------------------------ @@ -221,6 +231,7 @@ module.exports = { fromUrl: process.env.RTMP_FROM_URL !== 'false', fromStream: process.env.RTMP_FROM_STREAM !== 'false', maxStreams: parseInt(process.env.RTMP_MAX_STREAMS) || 1, + useNodeMediaServer: process.env.RTMP_USE_NODE_MEDIA_SERVER !== 'false', server: process.env.RTMP_SERVER || 'rtmp://localhost:1935', appName: process.env.RTMP_APP_NAME || 'mirotalk', streamKey: process.env.RTMP_STREAM_KEY || '', diff --git a/package.json b/package.json index 1c653056..fb0904cc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mirotalksfu", - "version": "1.8.01", + "version": "1.8.02", "description": "WebRTC SFU browser-based video calls", "main": "Server.js", "scripts": { diff --git a/public/js/Brand.js b/public/js/Brand.js index 60283b92..25db6111 100644 --- a/public/js/Brand.js +++ b/public/js/Brand.js @@ -64,7 +64,7 @@ let BRAND = { }, about: { imageUrl: '../images/mirotalk-logo.gif', - title: 'WebRTC SFU v1.8.01', + title: 'WebRTC SFU v1.8.02', html: `