+
95
-

回答


1.原始推流或播放地址:

rtmp:///hostname:port/live/stream

加密后的 URL 形式:

rtmp://hostname:port/appname/stream?sign=expires-HashValue
http://hostname:port/appname/stream.flv?sign=expires-HashValue
ws://hostname:port/appname/stream.flv?sign=expires-HashValue

2.配置验证秘钥为: 'nodemedia2017privatekey',同时打开播放和发布的鉴权开关
const config = {
rtmp: {
port: 1935,
chunk_size: 60000,
gop_cache: true,
ping: 60,
ping_timeout: 30
},
http: {
port: 8000,
allow_origin: '*'
},
auth: {
play: true,
publish: true,
secret: 'nodemedia2017privatekey'
}
}


3.请求过期时间为: 2017/8/23 11:25:21 ,则请求过期时间戳为:

1503458721

4.md5计算结合“完整流地址-失效时间-密钥”的字符串:

HashValue = md5("/live/stream-1503458721-nodemedia2017privatekey”)
HashValue = 80c1d1ad2e0c2ab63eebb50eed64201a

5.最终请求地址为

rtmp://hostname:port/live/stream?sign=1503458721-80c1d1ad2e0c2ab63eebb50eed64201a

注意:'sign' 关键字不能修改为其他的

网友回复

我知道答案,我要回答