node-rtsp-rtmp-server
node-rtsp-rtmp-server copied to clipboard
Authenticate Streams
Hi,
Can node-rtsp-rtmp-server authenticate livestreams before allowing them? If so, how is this configured?
Authentication is not built-in, but it's possible. You need to implement setLivePathConsumer() method in server.coffee. Basically, create a unique URL for each authenticated session in your application code, then call callback null
in setLivePathConsumer() if correct URL is requested.
Hi @iizukanao, i need a feature to authenticate stream broadcaster. Lets imagine that we have url like rtsp://example.com/live/coolstream, any user can connect to it and watch the stream, but for the broadcast starting the broadcaster should use url like rtsp://example.com/live/coolstream?stream_key=xxxx. Please give me an advice where should I put some verification function for this parameter.
@dr1v3 You can do it by modifying setLivePathConsumer() in server.coffee like the following:
streamServer.setLivePathConsumer (uri, callback) ->
uriInfo = url.parse uri, true
if uriInfo.query.stream_key is 'xxxx'
return callback null # Accept access
else
return callback new Error 'Unauthorized' # Deny access
The full version is here.