Node-Media-Server icon indicating copy to clipboard operation
Node-Media-Server copied to clipboard

Can we auth stream from Publisher?

Open channchetra opened this issue 6 years ago • 6 comments

I'm using this server but I want to allow only publisher who has auth can public streaming to server

channchetra avatar Sep 17 '18 11:09 channchetra

Yes you can do it with the auth feature ;)

Tell me if you need help understanding how it works !

TheAntinormal avatar Jan 04 '19 21:01 TheAntinormal

Yes you can do it with the auth feature ;)

Tell me if you need help understanding how it works !

@SAMYEL06 Yes really need that please help

channchetra avatar Jan 08 '19 06:01 channchetra

Yes. I need help with similar thing. The auth config key seems to be working for play but not for publish. It's authorized anyways.

androidneha avatar Feb 01 '19 13:02 androidneha

I need some help with too please.

NickGrant89 avatar Jun 10 '19 14:06 NickGrant89

Yes. I need help with similar thing. The auth config key seems to be working for play but not for publish. It's authorized anyways.

I has the same issue. Need more help too please :(

phucps89 avatar Aug 25 '21 10:08 phucps89

Hi All,

You need Use MD5 hash function first see this package

https://www.npmjs.com/package/node-media-server

in server side config

for example : if secret: 'nodemedia2021MYkey' <====

const config = { rtmp: { port: 1935, chunk_size: 60000, gop_cache: true, ping: 30, ping_timeout: 60 }, http: { port: 8000, allow_origin: '*' }, auth: { play: true, publish: true, secret: 'nodemedia2021MYkey' } } for call or publish you need calculate timestamp and hash value base on that

function toTimestamp(strDate){ var datum = Date.parse(strDate); return datum/1000; }

toTimestamp('08/13/2021 23:31:30')
then You get ===> 1628861490

The combination HashValue is:

stream = /live/stream Timestamp = 1628861490 secret = 'nodemedia2021MYkey'

HashValue = md5("/live/stream-1628861490-nodemedia2021MYkey”) HashValue = 80c1d1ad2e0c2ab63eebb50eed64201a

now you can call

rtmp://192.168.0.10/live/stream?sign=1628861490-80c1d1ad2e0c2ab63eebb50eed64201a

akaco avatar Aug 25 '21 23:08 akaco