node-webrtc / node-webrtc-examples

MediaStream and RTCDataChannel examples using node-webrtc
508 stars 161 forks source link

Where i can apply bitrate? #20

Open savsofts opened 4 years ago

savsofts commented 4 years ago

How i can control maximum streaming bandwidth? I tried to apply sdp.replace method in index.js file ( node-webrtc-examples/lib/client/index.js ) but no effect..

savsofts commented 4 years ago

I also tried to add following code in webrtcconnection.js file (node-webrtc-examples/lib/server/connections/ )

` const offer = await peerConnection.createOffer(); offer.sdp=setBitrate(offer.sdp);

function setBitrate(sdp){ sdp = sdp .replace(/a=mid:audio\r\n/g, 'a=mid:audio\r\nb=AS:64\r\n'); sdp = sdp .replace(/a=mid:video\r\n/g, 'a=mid:video\r\nb=AS:256\r\n'); return sdp; } `