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.91k stars 1.51k forks source link

我回调拒绝了推流,但是摄像头还是消耗流量? #483

Open luoyigit opened 2 years ago

luoyigit commented 2 years ago

nms.on('prePublish', (id, StreamPath, args) => { // console.log('[NodeEvent on prePublish]', id=${id} StreamPath=${StreamPath} args=${JSON.stringify(args)}); var stream_name=StreamPath.slice(6); dbService.IsCanPublish(stream_name,id).then(res=>{ if(!res) { let session = nms.getSession(id); session.reject(); } else{ console.log(流-${stream_name}-prePublish) } }) });