Allows you manage audio/video codecs e.g. vp8, vp9, h264, opus, isac, G722 etc
<script src="/dev/CodecsHandler.js"></script> <script> // in your HTML file connection.processSdp = function(sdp) { // Disable NACK to test IDR recovery sdp = CodecsHandler.disableNACK(sdp); return sdp; }; </script>
parameter | description |
---|---|
CodecsHandler.disableNACK | Disable video NACK |
CodecsHandler.removeVPX | Remove both vp8 and vp9 codecs |
CodecsHandler.prioritize | Prioritize any "existing" codec e.g. ask Chrome to use vp8 instead of vp9 etc. |
CodecsHandler.removeNonG722 | Remove all audio codecs except G722 |
CodecsHandler.preferVP9 | Ask Chrome to use vp9 all the time |
CodecsHandler.setApplicationSpecificBandwidth |
Set "AS=kbps" 1) first parameter is "sdp" string 2) second parameter is "bandwidth" object {audio: 50, video: 100} 3) last parameter is "isScreen" boolean; which forces 300kbps minimum video bitrates |
CodecsHandler.setVideoBitrates |
1) first parameter is "sdp" string 2) last parameter is {min: bitrates, max: bitrates} |
CodecsHandler.setOpusAttributes |
1) first parameter is "sdp" string 2) last parameter accepts all following: { 'stereo': 1, 'sprop-stereo': 1, 'maxaveragebitrate': connection.bandwidth.audio * 1000 * 8, 'maxplaybackrate': connection.bandwidth.audio * 1000 * 8, 'cbr': 1, 'useinbandfec': 1, 'usedtx': 1, 'maxptime': 3 } |
<script src="/dev/CodecsHandler.js"></script> <script> // in your HTML file if(connection.DetectRTC.browser.name === 'Firefox') { connection.getAllParticipants().forEach(function(p) { var peer = connection.peers[p].peer; CodecsHandler.prioritize('audio/opus', peer); }); } </script>
connection.codecs.video = 'H264';
connection.codecs.video = 'VP8';
connection.codecs.video = 'VP9';
connection.codecs.audio = 'G722';
connection.codecs.audio = 'opus';
<script src="https://rtcmulticonnection.herokuapp.com/dist/RTCMultiConnection.min.js"></script> <script src="https://rtcmulticonnection.herokuapp.com/socket.io/socket.io.js"></script> <script> var connection = new RTCMultiConnection(); // this line is VERY_important connection.socketURL = 'https://rtcmulticonnection.herokuapp.com:443/'; // if you want audio+video conferencing connection.session = { audio: true, video: true }; connection.openOrJoin('your-room-id'); </script> <script src="/dev/CodecsHandler.js"></script> <script> // in your HTML file connection.processSdp = function(sdp) { // Disable NACK to test IDR recovery sdp = CodecsHandler.disableNACK(sdp); return sdp; }; </script>