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

How read in preConnect streamKey #587

Open thedarkknight197 opened 1 year ago

thedarkknight197 commented 1 year ago

Hello how can access to streamKey in nms.on('preConnect', async (id, args: any) ?

I receive to my server only this data from OBS:

{
  app: 'live',
  type: 'nonprivate',
  supportsGoAway: true,
  flashVer: 'FMLE/3.0 (compatible; FMSc/1.0)',
  swfUrl: 'rtmp://localhost/live',
  tcUrl: 'rtmp://localhost/live'
}

in postPublish I have as url: '/live/streamKey' why i don't have streamKey access in preConnect?

nms.on('postPublish', (id, streamPath, args) => {
    const streamKey = streamPath.split('/').pop();
    createMediaFile(streamKey!);
});
basemkhirat commented 1 year ago

any updates?

thedarkknight197 commented 1 year ago

No 😔

basemkhirat commented 1 year ago

When I made custom authentication, client should not able to create the connection. Library should prevent the connection within creation. making the authentication done on prePublish make the client connected!

JoshuasStudio-official commented 2 months ago

All I did was I just made the server connect to my postgresql database then read in a array all the keys that are in that database then generate the keys from the client side aka the website and then if the key is not valid it kinda just stalls I am looking around for documentation on how to have obs or any streaming platform have custom errors besides the ones built in. image image