const url = "wss://"+window.location.hostname+":"+window.location.port; let videoResolution = true; //Get our url const href = new URL (window.location.href); if (href.searchParams.has ("video")) switch (href.searchParams.get ("video").toLowerCase ()) { case "1080p": videoResolution = { width: {min: 1920, max: 1920}, height: {min: 1080, max: 1080}, }; break; case "720p": videoResolution = { width: {min: 1280, max: 1280}, height: {min: 720, max: 720}, }; break; case "576p": videoResolution = { width: {min: 720, max: 720}, height: {min: 576, max: 576}, }; break; case "480p": videoResolution = { width: {min: 640, max: 640}, height: {min: 480, max: 480}, }; break; case "no": videoResolution = false; break; } var opts = { lines: 12, // The number of lines to draw angle: 0.15, // The length of each line lineWidth: 0.44, // 0.44 The line thickness pointer: { length: 0.8, // 0.9 The radius of the inner circle strokeWidth: 0.035, // The rotation offset color: '#A0A0A0' // Fill color }, limitMax: true, colorStart: '#28c1d1', // Colors colorStop: '#28c1d1', // just experiment with them strokeColor: '#F0F0F0', // to see which ones work best for you generateGradient: false, gradientType: 0 }; var targets = document.querySelectorAll('.gaugeChart'); // your canvas element var gauges = []; for (var i=0;i pc.addTrack(track, stream)); //Check API "compatibility" if (pc.getSenders()[0].setParameters) { try { //Enable simulcast pc.getSenders()[0].setParameters({ encodings: [ { rid: "a"}, { rid: "b" , scaleDownResolutionBy: 2.0 }, { rid: "c" , scaleDownResolutionBy: 4.0 } ] }); } catch(e) { } } //Create new offer return pc.createOffer(); }) .then(function(offer){ console.debug("createOffer sucess",offer); //Get offer let sdp = offer.sdp; //Check simulcast 04 format if (sdp.indexOf(": send rid")) { //Convert from simulcast_03 to simulcast sdp = sdp.replace(": send rid=",":send "); //We need to modify answer too simulcast_03 = true; } //If offer doesn't have simulcast if (sdp.indexOf("simulcast")==-1) try { //OK, chrome way const reg1 = RegExp("m=video.*\?a=ssrc:(\\d*) cname:(.+?)\\r\\n","s"); const reg2 = RegExp("m=video.*\?a=ssrc:(\\d*) mslabel:(.+?)\\r\\n","s"); const reg3 = RegExp("m=video.*\?a=ssrc:(\\d*) msid:(.+?)\\r\\n","s"); const reg4 = RegExp("m=video.*\?a=ssrc:(\\d*) label:(.+?)\\r\\n","s"); //Get ssrc and cname let res = reg1.exec(sdp); const ssrc = res[1]; const cname = res[2]; //Get other params const mslabel = reg2.exec(sdp)[2]; const msid = reg3.exec(sdp)[2]; const label = reg4.exec(sdp)[2]; //Add simulcasts ssrcs const num = 2; const ssrcs = [ssrc]; for (let i=0;i