36 lines
57 KiB
JavaScript
36 lines
57 KiB
JavaScript
|
"use strict";(()=>{var P=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var x=P(E=>{"use strict";Object.defineProperty(E,"__esModule",{value:!0});var J=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};E.extractVersion=F;E.wrapPeerConnectionEvent=Te;E.disableLog=Pe;E.disableWarnings=_e;E.log=Ee;E.deprecated=Me;E.detectBrowser=be;E.compactObject=ee;E.walkStats=N;E.filterStats=ke;function Re(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var Z=!0,w=!0;function F(e,t,r){var n=e.match(t);return n&&n.length>=r&&parseInt(n[r],10)}function Te(e,t,r){if(!!e.RTCPeerConnection){var n=e.RTCPeerConnection.prototype,i=n.addEventListener;n.addEventListener=function(u,c){if(u!==t)return i.apply(this,arguments);var p=function(o){var d=r(o);d&&(c.handleEvent?c.handleEvent(d):c(d))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(c,p),i.apply(this,[u,p])};var a=n.removeEventListener;n.removeEventListener=function(u,c){if(u!==t||!this._eventMap||!this._eventMap[t])return a.apply(this,arguments);if(!this._eventMap[t].has(c))return a.apply(this,arguments);var p=this._eventMap[t].get(c);return this._eventMap[t].delete(c),this._eventMap[t].size===0&&delete this._eventMap[t],Object.keys(this._eventMap).length===0&&delete this._eventMap,a.apply(this,[u,p])},Object.defineProperty(n,"on"+t,{get:function(){return this["_on"+t]},set:function(c){this["_on"+t]&&(this.removeEventListener(t,this["_on"+t]),delete this["_on"+t]),c&&this.addEventListener(t,this["_on"+t]=c)},enumerable:!0,configurable:!0})}}function Pe(e){return typeof e!="boolean"?new Error("Argument type: "+(typeof e>"u"?"undefined":J(e))+". Please use a boolean."):(Z=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function _e(e){return typeof e!="boolean"?new Error("Argument type: "+(typeof e>"u"?"undefined":J(e))+". Please use a boolean."):(w=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function Ee(){if((typeof window>"u"?"undefined":J(window))==="object"){if(Z)return;typeof console<"u"&&typeof console.log=="function"&&console.log.apply(console,arguments)}}function Me(e,t){!w||console.warn(e+" is deprecated, please use "+t+" instead.")}function be(e){var t={browser:null,version:null};if(typeof e>"u"||!e.navigator)return t.browser="Not a browser.",t;var r=e.navigator;if(r.mozGetUserMedia)t.browser="firefox",t.version=F(r.userAgent,/Firefox\/(\d+)\./,1);else if(r.webkitGetUserMedia||e.isSecureContext===!1&&e.webkitRTCPeerConnection&&!e.RTCIceGatherer)t.browser="chrome",t.version=F(r.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(e.RTCPeerConnection&&r.userAgent.match(/AppleWebKit\/(\d+)\./))t.browser="safari",t.version=F(r.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype;else return t.browser="Not a supported browser.",t;return t}function Q(e){return Object.prototype.toString.call(e)==="[object Object]"}function ee(e){return Q(e)?Object.keys(e).reduce(function(t,r){var n=Q(e[r]),i=n?ee(e[r]):e[r],a=n&&!Object.keys(i).length;return i===void 0||a?t:Object.assign(t,Re({},r,i))},{}):e}function N(e,t,r){!t||r.has(t.id)||(r.set(t.id,t),Object.keys(t).forEach(function(n){n.endsWith("Id")?N(e,e.get(t[n]),r):n.endsWith("Ids")&&t[n].forEach(function(i){N(e,e.get(i),r)})}))}function ke(e,t,r){var n=r?"outbound-rtp":"inbound-rtp",i=new Map;if(t===null)return i;var a=[];return e.forEach(function(u){u.type==="track"&&u.trackIdentifier===t.id&&a.push(u)}),a.forEach(function(u){e.forEach(function(c){c.type===n&&c.trackId===u.id&&N(e,c,i)})}),i}});var re=P(j=>{"use strict";Object.defineProperty(j,"__esModule",{value:!0});var I=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbo
|
||
|
`).map(function(t){return t.trim()})};f.splitSections=function(e){var t=e.split(`
|
||
|
m=`);return t.map(function(r,n){return(n>0?"m="+r:r).trim()+`\r
|
||
|
`})};f.getDescription=function(e){var t=f.splitSections(e);return t&&t[0]};f.getMediaSections=function(e){var t=f.splitSections(e);return t.shift(),t};f.matchPrefix=function(e,t){return f.splitLines(e).filter(function(r){return r.indexOf(t)===0})};f.parseCandidate=function(e){var t=void 0;e.indexOf("a=candidate:")===0?t=e.substring(12).split(" "):t=e.substring(10).split(" ");for(var r={foundation:t[0],component:{1:"rtp",2:"rtcp"}[t[1]]||t[1],protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]},n=8;n<t.length;n+=2)switch(t[n]){case"raddr":r.relatedAddress=t[n+1];break;case"rport":r.relatedPort=parseInt(t[n+1],10);break;case"tcptype":r.tcpType=t[n+1];break;case"ufrag":r.ufrag=t[n+1],r.usernameFragment=t[n+1];break;default:r[t[n]]===void 0&&(r[t[n]]=t[n+1]);break}return r};f.writeCandidate=function(e){var t=[];t.push(e.foundation);var r=e.component;r==="rtp"?t.push(1):r==="rtcp"?t.push(2):t.push(r),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);var n=e.type;return t.push("typ"),t.push(n),n!=="host"&&e.relatedAddress&&e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&e.protocol.toLowerCase()==="tcp"&&(t.push("tcptype"),t.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(t.push("ufrag"),t.push(e.usernameFragment||e.ufrag)),"candidate:"+t.join(" ")};f.parseIceOptions=function(e){return e.substr(14).split(" ")};f.parseRtpMap=function(e){var t=e.substr(9).split(" "),r={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),r.name=t[0],r.clockRate=parseInt(t[1],10),r.channels=t.length===3?parseInt(t[2],10):1,r.numChannels=r.channels,r};f.writeRtpMap=function(e){var t=e.payloadType;e.preferredPayloadType!==void 0&&(t=e.preferredPayloadType);var r=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(r!==1?"/"+r:"")+`\r
|
||
|
`};f.parseExtmap=function(e){var t=e.substr(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1]}};f.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&e.direction!=="sendrecv"?"/"+e.direction:"")+" "+e.uri+`\r
|
||
|
`};f.parseFmtp=function(e){for(var t={},r=void 0,n=e.substr(e.indexOf(" ")+1).split(";"),i=0;i<n.length;i++)r=n[i].trim().split("="),t[r[0].trim()]=r[1];return t};f.writeFmtp=function(e){var t="",r=e.payloadType;if(e.preferredPayloadType!==void 0&&(r=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){var n=[];Object.keys(e.parameters).forEach(function(i){e.parameters[i]!==void 0?n.push(i+"="+e.parameters[i]):n.push(i)}),t+="a=fmtp:"+r+" "+n.join(";")+`\r
|
||
|
`}return t};f.parseRtcpFb=function(e){var t=e.substr(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}};f.writeRtcpFb=function(e){var t="",r=e.payloadType;return e.preferredPayloadType!==void 0&&(r=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach(function(n){t+="a=rtcp-fb:"+r+" "+n.type+(n.parameter&&n.parameter.length?" "+n.parameter:"")+`\r
|
||
|
`}),t};f.parseSsrcMedia=function(e){var t=e.indexOf(" "),r={ssrc:parseInt(e.substr(7,t-7),10)},n=e.indexOf(":",t);return n>-1?(r.attribute=e.substr(t+1,n-t-1),r.value=e.substr(n+1)):r.attribute=e.substr(t+1),r};f.parseSsrcGroup=function(e){var t=e.substr(13).split(" ");return{semantics:t.shift(),ssrcs:t.map(function(r){return parseInt(r,10)})}};f.getMid=function(e){var t=f.matchPrefix(e,"a=mid:")[0];if(t)return t.substr(6)};f.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1].toUpperCase()}};f.getDtlsParameters=function(e,t){var r=f.matchPrefix(e+t,"a=fingerprint:");return{role:"auto",fingerprints:r.map(f.parseFingerprint)}};f.writeDtlsParameters=function(e,t){var r="a=setup:"+t+`\r
|
||
|
`;return e.fingerprints.forEach(function(n){r+="a=fingerprint:"+n.algorithm+" "+n.value+`\r
|
||
|
`}),r};f.parseCryptoLine=function(e){var t=e.substr(9).split(" ");return{tag:parseInt(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:t.slice(3)}};f.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+(he(e.keyParams)==="object"?f.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+`\r
|
||
|
`};f.parseCryptoKeyParams=function(e){if(e.indexOf("inline:")!==0)return null;var t=e.substr(7).split("|");return{keyMethod:"inline",keySalt:t[0],lifeTime:t[1],mkiValue:t[2]?t[2].split(":")[0]:void 0,mkiLength:t[2]?t[2].split(":")[1]:void 0}};f.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")};f.getCryptoParameters=function(e,t){var r=f.matchPrefix(e+t,"a=crypto:");return r.map(f.parseCryptoLine)};f.getIceParameters=function(e,t){var r=f.matchPrefix(e+t,"a=ice-ufrag:")[0],n=f.matchPrefix(e+t,"a=ice-pwd:")[0];return r&&n?{usernameFragment:r.substr(12),password:n.substr(10)}:null};f.writeIceParameters=function(e){var t="a=ice-ufrag:"+e.usernameFragment+`\r
|
||
|
a=ice-pwd:`+e.password+`\r
|
||
|
`;return e.iceLite&&(t+=`a=ice-lite\r
|
||
|
`),t};f.parseRtpParameters=function(e){for(var t={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},r=f.splitLines(e),n=r[0].split(" "),i=3;i<n.length;i++){var a=n[i],u=f.matchPrefix(e,"a=rtpmap:"+a+" ")[0];if(u){var c=f.parseRtpMap(u),p=f.matchPrefix(e,"a=fmtp:"+a+" ");switch(c.parameters=p.length?f.parseFmtp(p[0]):{},c.rtcpFeedback=f.matchPrefix(e,"a=rtcp-fb:"+a+" ").map(f.parseRtcpFb),t.codecs.push(c),c.name.toUpperCase()){case"RED":case"ULPFEC":t.fecMechanisms.push(c.name.toUpperCase());break;default:break}}}return f.matchPrefix(e,"a=extmap:").forEach(function(s){t.headerExtensions.push(f.parseExtmap(s))}),t};f.writeRtpDescription=function(e,t){var r="";r+="m="+e+" ",r+=t.codecs.length>0?"9":"0",r+=" UDP/TLS/RTP/SAVPF ",r+=t.codecs.map(function(i){return i.preferredPayloadType!==void 0?i.preferredPayloadType:i.payloadType}).join(" ")+`\r
|
||
|
`,r+=`c=IN IP4 0.0.0.0\r
|
||
|
`,r+=`a=rtcp:9 IN IP4 0.0.0.0\r
|
||
|
`,t.codecs.forEach(function(i){r+=f.writeRtpMap(i),r+=f.writeFmtp(i),r+=f.writeRtcpFb(i)});var n=0;return t.codecs.forEach(function(i){i.maxptime>n&&(n=i.maxptime)}),n>0&&(r+="a=maxptime:"+n+`\r
|
||
|
`),t.headerExtensions&&t.headerExtensions.forEach(function(i){r+=f.writeExtmap(i)}),r};f.parseRtpEncodingParameters=function(e){var t=[],r=f.parseRtpParameters(e),n=r.fecMechanisms.indexOf("RED")!==-1,i=r.fecMechanisms.indexOf("ULPFEC")!==-1,a=f.matchPrefix(e,"a=ssrc:").map(function(o){return f.parseSsrcMedia(o)}).filter(function(o){return o.attribute==="cname"}),u=a.length>0&&a[0].ssrc,c=void 0,p=f.matchPrefix(e,"a=ssrc-group:FID").map(function(o){var d=o.substr(17).split(" ");return d.map(function(m){return parseInt(m,10)})});p.length>0&&p[0].length>1&&p[0][0]===u&&(c=p[0][1]),r.codecs.forEach(function(o){if(o.name.toUpperCase()==="RTX"&&o.parameters.apt){var d={ssrc:u,codecPayloadType:parseInt(o.parameters.apt,10)};u&&c&&(d.rtx={ssrc:c}),t.push(d),n&&(d=JSON.parse(JSON.stringify(d)),d.fec={ssrc:u,mechanism:i?"red+ulpfec":"red"},t.push(d))}}),t.length===0&&u&&t.push({ssrc:u});var s=f.matchPrefix(e,"b=");return s.length&&(s[0].indexOf("b=TIAS:")===0?s=parseInt(s[0].substr(7),10):s[0].indexOf("b=AS:")===0?s=parseInt(s[0].substr(5),10)*1e3*.95-50*40*8:s=void 0,t.forEach(function(o){o.maxBitrate=s})),t};f.parseRtcpParameters=function(e){var t={},r=f.matchPrefix(e,"a=ssrc:").map(function(a){return f.parseSsrcMedia(a)}).filter(function(a){return a.attribute==="cname"})[0];r&&(t.cname=r.value,t.ssrc=r.ssrc);var n=f.matchPrefix(e,"a=rtcp-rsize");t.reducedSize=n.length>0,t.compound=n.length===0;var i=f.matchPrefix(e,"a=rtcp-mux");return t.mux=i.length>0,t};f.writeRtcpParameters=function(e){var t="";return e.reducedSize&&(t+=`a=rtcp-rsize\r
|
||
|
`),e.mux&&(t+=`a=rtcp-mux\r
|
||
|
`),e.ssrc!==void 0&&e.cname&&(t+="a=ssrc:"+e.ssrc+" cname:"+e.cname+`\r
|
||
|
`),t};f.parseMsid=function(e){var t=void 0,r=f.matchPrefix(e,"a=msid:");if(r.length===1)return t=r[0].substr(7).split(" "),{stream:t[0],track:t[1]};var n=f.matchPrefix(e,"a=ssrc:").map(function(i){return f.parseSsrcMedia(i)}).filter(function(i){return i.attribute==="msid"});if(n.length>0)return t=n[0].value.split(" "),{stream:t[0],track:t[1]}};f.parseSctpDescription=function(e){var t=f.parseMLine(e),r=f.matchPrefix(e,"a=max-message-size:"),n=void 0;r.length>0&&(n=parseInt(r[0].substr(19),10)),isNaN(n)&&(n=65536);var i=f.matchPrefix(e,"a=sctp-port:");if(i.length>0)return{port:parseInt(i[0].substr(12),10),protocol:t.fmt,maxMessageSize:n};var a=f.matchPrefix(e,"a=sctpmap:");if(a.length>0){var u=a[0].substr(10).split(" ");return{port:parseInt(u[0],10),protocol:u[1],maxMessageSize:n}}};f.writeSctpDescription=function(e,t){var r=[];return e.protocol!=="DTLS/SCTP"?r=["m="+e.kind+" 9 "+e.protocol+" "+t.protocol+`\r
|
||
|
`,`c=IN IP4 0.0.0.0\r
|
||
|
`,"a=sctp-port:"+t.port+`\r
|
||
|
`]:r=["m="+e.kind+" 9 "+e.protocol+" "+t.port+`\r
|
||
|
`,`c=IN IP4 0.0.0.0\r
|
||
|
`,"a=sctpmap:"+t.port+" "+t.protocol+` 65535\r
|
||
|
`],t.maxMessageSize!==void 0&&r.push("a=max-message-size:"+t.maxMessageSize+`\r
|
||
|
`),r.join("")};f.generateSessionId=function(){return Math.random().toString().substr(2,21)};f.writeSessionBoilerplate=function(e,t,r){var n=void 0,i=t!==void 0?t:2;e?n=e:n=f.generateSessionId();var a=r||"thisisadapterortc";return`v=0\r
|
||
|
o=`+a+" "+n+" "+i+` IN IP4 127.0.0.1\r
|
||
|
s=-\r
|
||
|
t=0 0\r
|
||
|
`};f.getDirection=function(e,t){for(var r=f.splitLines(e),n=0;n<r.length;n++)switch(r[n]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return r[n].substr(2);default:}return t?f.getDirection(t):"sendrecv"};f.getKind=function(e){var t=f.splitLines(e),r=t[0].split(" ");return r[0].substr(2)};f.isRejected=function(e){return e.split(" ",2)[1]==="0"};f.parseMLine=function(e){var t=f.splitLines(e),r=t[0].substr(2).split(" ");return{kind:r[0],port:parseInt(r[1],10),protocol:r[2],fmt:r.slice(3).join(" ")}};f.parseOLine=function(e){var t=f.matchPrefix(e,"o=")[0],r=t.substr(2).split(" ");return{username:r[0],sessionId:r[1],sessionVersion:parseInt(r[2],10),netType:r[3],addressType:r[4],address:r[5]}};f.isValidSDP=function(e){if(typeof e!="string"||e.length===0)return!1;for(var t=f.splitLines(e),r=0;r<t.length;r++)if(t[r].length<2||t[r].charAt(1)!=="=")return!1;return!0};(typeof q>"u"?"undefined":he(q))==="object"&&(q.exports=f)});var ge=P(k=>{"use strict";Object.defineProperty(k,"__esModule",{value:!0});var ve=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};k.shimRTCIceCandidate=kt;k.shimMaxMessageSize=xt;k.shimSendThrowTypeError=Dt;k.shimConnectionState=Ot;k.removeExtmapAllowMixed=It;k.shimAddIceCandidateNullOrEmpty=Lt;k.shimParameterlessSetLocalDescription=At;var _t=Y(),V=bt(_t),Et=x(),ye=Mt(Et);function Mt(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function bt(e){return e&&e.__esModule?e:{default:e}}function kt(e){if(!(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)){var t=e.RTCIceCandidate;e.RTCIceCandidate=function(n){if((typeof n>"u"?"undefined":ve(n))==="object"&&n.candidate&&n.candidate.indexOf("a=")===0&&(n=JSON.parse(JSON.stringify(n)),n.candidate=n.candidate.substr(2)),n.candidate&&n.candidate.length){var i=new t(n),a=V.default.parseCandidate(n.candidate),u=Object.assign(i,a);return u.toJSON=function(){return{candidate:u.candidate,sdpMid:u.sdpMid,sdpMLineIndex:u.sdpMLineIndex,usernameFragment:u.usernameFragment}},u}return new t(n)},e.RTCIceCandidate.prototype=t.prototype,ye.wrapPeerConnectionEvent(e,"icecandidate",function(r){return r.candidate&&Object.defineProperty(r,"candidate",{value:new e.RTCIceCandidate(r.candidate),writable:"false"}),r})}}function xt(e,t){if(!!e.RTCPeerConnection){"sctp"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get:function(){return typeof this._sctp>"u"?null:this._sctp}});var r=function(p){if(!p||!p.sdp)return!1;var s=V.default.splitSections(p.sdp);return s.shift(),s.some(function(o){var d=V.default.parseMLine(o);return d&&d.kind==="application"&&d.protocol.indexOf("SCTP")!==-1})},n=function(p){var s=p.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(s===null||s.length<2)return-1;var o=parseInt(s[1],10);return o!==o?-1:o},i=function(p){var s=65536;return t.browser==="firefox"&&(t.version<57?p===-1?s=16384:s=2147483637:t.version<60?s=t.version===57?65535:65536:s=2147483637),s},a=function(p,s){var o=65536;t.browser==="firefox"&&t.version===57&&(o=65535);var d=V.default.matchPrefix(p.sdp,"a=max-message-size:");return d.length>0?o=parseInt(d[0].substr(19),10):t.browser==="firefox"&&s!==-1&&(o=2147483637),o},u=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,t.browser==="chrome"&&t.version>=76){var p=this.getConfiguration(),s=p.sdpSemantics;s==="plan-b"&&Object.defineProperty(this,"sctp",{get:function(){return typeof this._sctp>"u"?null:this._sctp},enumerable:!0,configurable:!0})}if(r(arguments[0])){var o=n(arguments[0]),d=i(o),m=a(arguments[0],o),l=void 0;d===0&&m===0?l=Number.POSITIVE_INFINITY:d===0||m===0?l=Math.max(d,m):l=Math.min(d,m);var v={};Object.defineProperty(v,"maxMessageSize",{get:function(){return l}}),this._sctp=v}return u.apply(this,arguments)}}}fun
|
||
|
a=extmap-allow-mixed`)!==-1){var a=i.sdp.split(`
|
||
|
`).filter(function(u){return u.trim()!=="a=extmap-allow-mixed"}).join(`
|
||
|
`);e.RTCSessionDescription&&i instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:i.type,sdp:a}):i.sdp=a}return r.apply(this,arguments)}}}function Lt(e,t){if(!!(e.RTCPeerConnection&&e.RTCPeerConnection.prototype)){var r=e.RTCPeerConnection.prototype.addIceCandidate;!r||r.length===0||(e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?(t.browser==="chrome"&&t.version<78||t.browser==="firefox"&&t.version<68||t.browser==="safari")&&arguments[0]&&arguments[0].candidate===""?Promise.resolve():r.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}}function At(e,t){if(!!(e.RTCPeerConnection&&e.RTCPeerConnection.prototype)){var r=e.RTCPeerConnection.prototype.setLocalDescription;!r||r.length===0||(e.RTCPeerConnection.prototype.setLocalDescription=function(){var i=this,a=arguments[0]||{};if((typeof a>"u"?"undefined":ve(a))!=="object"||a.type&&a.sdp)return r.apply(this,arguments);if(a={type:a.type,sdp:a.sdp},!a.type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":a.type="offer";break;default:a.type="answer";break}if(a.sdp||a.type!=="offer"&&a.type!=="answer")return r.apply(this,[a]);var u=a.type==="offer"?this.createOffer:this.createAnswer;return u.apply(this).then(function(c){return r.apply(i,[c])})})}}});var Ce=P($=>{"use strict";Object.defineProperty($,"__esModule",{value:!0});$.adapterFactory=Jt;var Gt=x(),G=O(Gt),Ut=oe(),_=O(Ut),Ft=fe(),T=O(Ft),Nt=le(),b=O(Nt),zt=ge(),C=O(zt),qt=Y(),Vt=O(qt);function O(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function Jt(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=e.window,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimSafari:!0},n=G.log,i=G.detectBrowser(t),a={browserDetails:i,commonShim:C,extractVersion:G.extractVersion,disableLog:G.disableLog,disableWarnings:G.disableWarnings,sdp:Vt};switch(i.browser){case"chrome":if(!_||!_.shimPeerConnection||!r.shimChrome)return n("Chrome shim is not included in this adapter release."),a;if(i.version===null)return n("Chrome shim can not determine version, not shimming."),a;n("adapter.js shimming chrome."),a.browserShim=_,C.shimAddIceCandidateNullOrEmpty(t,i),C.shimParameterlessSetLocalDescription(t,i),_.shimGetUserMedia(t,i),_.shimMediaStream(t,i),_.shimPeerConnection(t,i),_.shimOnTrack(t,i),_.shimAddTrackRemoveTrack(t,i),_.shimGetSendersWithDtmf(t,i),_.shimGetStats(t,i),_.shimSenderReceiverGetStats(t,i),_.fixNegotiationNeeded(t,i),_.shimSelectAudioOutput(t,i),C.shimRTCIceCandidate(t,i),C.shimConnectionState(t,i),C.shimMaxMessageSize(t,i),C.shimSendThrowTypeError(t,i),C.removeExtmapAllowMixed(t,i);break;case"firefox":if(!T||!T.shimPeerConnection||!r.shimFirefox)return n("Firefox shim is not included in this adapter release."),a;n("adapter.js shimming firefox."),a.browserShim=T,C.shimAddIceCandidateNullOrEmpty(t,i),C.shimParameterlessSetLocalDescription(t,i),T.shimGetUserMedia(t,i),T.shimPeerConnection(t,i),T.shimOnTrack(t,i),T.shimRemoveStream(t,i),T.shimSenderGetStats(t,i),T.shimReceiverGetStats(t,i),T.shimRTCDataChannel(t,i),T.shimAddTransceiver(t,i),T.shimGetParameters(t,i),T.shimCreateOffer(t,i),T.shimCreateAnswer(t,i),C.shimRTCIceCandidate(t,i),C.shimConnectionState(t,i),C.shimMaxMessageSize(t,i),C.shimSendThrowTypeError(t,i);break;case"safari":if(!b||!r.shimSafari)return n("Safari shim is not included in this adapter release."),a;n("adapter.js shimming safari."),a.browserShim=b,C.shimAddIceCandidateNullOrEmpty(t,i),C.shimParameterlessSetLocalDescription(t,i),b.shimRTCIceServerUrls(t,i),b.shimCreateOfferLegacy(t,i),b.shimCallbacksAPI(t,i),b.shimLocalStreamsAPI(t,i),b.shimRemoteStreamsAPI(t,i),b.shimTrackEventTransceiver(t,i),b.shimGetUserMedia(t,i),b.shimAudioContext(t,i),C.shimRTCIceCandidate(t,i),C.shimMaxMessageSize(t,i),C.shimSendThrowTypeError(t,i),C.removeExtmapAllowMixed(t,i);break;default:n("Unsupported browser!");break}return a}});var Kt=P((ar,Se
|