illuspas / Node-Media-Server

A Node.js implementation of RTMP/HTTP-FLV/WS-FLV/HLS/DASH/MP4 Media Server
https://www.npmjs.com/package/node-media-server
MIT License
5.89k stars 1.51k forks source link

Is anyone having a problem connecting to the rtmp server #566

Open berto6544-collab opened 1 year ago

berto6544-collab commented 1 year ago

For 3 months I've been having a problem connecting to the RTMP server through my phone and OBS. Is anyone else having this same problem?

const nodeMediaServerConfig = { rtmp: { port: 53253, chunk_size: 60000, gop_cache: true, ping: 30, ping_timeout: 60 }, http: { port: 54253, mediaroot: '../public_html/public/assets/img/livestream', allow_origin: '*' }, https: { port: 54254, key:'./privatekey.pem', mediaroot: '../public_html/public/assets/img/livestream', cert:'./cert.pem'

}

};

const nms = new NodeMediaServer(nodeMediaServerConfig); nms.run();

nms.on('preConnect', (id, args) => { console.log('[NodeEvent on preConnect]', id=${id} args=${JSON.stringify(args)}); });

nms.on('postConnect', (id, args) => { console.log('[NodeEvent on postConnect]', id=${id} args=${JSON.stringify(args)}); });

nms.on('doneConnect', (id, args) => { console.log('[NodeEvent on doneConnect]', id=${id} args=${JSON.stringify(args)}); });

nms.on('prePublish',(id, StreamPath, args) => { console.log( '[NodeEvent on prePublish]', id=${id} StreamPath=${StreamPath} args=${JSON.stringify(args)} );

var streammKey = StreamPath.replace("/live/","")

var streamId = Math.random().toString(36).substring(2, 15);

});

nms.on('postPublish', (id, StreamPath, args) => { console.log( '[NodeEvent on postPublish]', id=${id} StreamPath=${StreamPath} args=${JSON.stringify(args)} );

var streammKey = StreamPath.replace("/live/","")

});

nms.on('donePublish', (id, StreamPath, args) => { console.log( '[NodeEvent on donePublish]', id=${id} StreamPath=${StreamPath} args=${JSON.stringify(args)} );

var streammKey = StreamPath.replace("/live/","")

});

nms.on('prePlay', (id, StreamPath, args) => { console.log( '[NodeEvent on prePlay]', id=${id} StreamPath=${StreamPath} args=${JSON.stringify(args)} ); });

nms.on('postPlay', (id, StreamPath, args) => { console.log( '[NodeEvent on postPlay]', id=${id} StreamPath=${StreamPath} args=${JSON.stringify(args)} ); });

nms.on('donePlay', (id, StreamPath, args) => { console.log( '[NodeEvent on donePlay]', id=${id} StreamPath=${StreamPath} args=${JSON.stringify(args)} ); });

this is my code but it seems that its not working.

shawnnolanjr commented 1 year ago

I can view it fine on http, but NOT on https