From 5a669322eea32b0052d6a440ba75875bd588bc64 Mon Sep 17 00:00:00 2001 From: Yuki Ito Date: Mon, 20 Jul 2020 17:02:31 +0900 Subject: [PATCH 01/18] =?UTF-8?q?develop=20=E3=82=92=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGES.md | 2 ++ dist/sora.js | 6 +++--- dist/sora.min.js | 4 ++-- dist/sora.min.js.map | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 76073753..852bf2e6 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -9,6 +9,8 @@ - FIX - バグ修正 +## develop + ## 2020.1.5 - [FIX] metadata が undefined の場合以外は signaling connect message に metadata を含めるように変更 diff --git a/dist/sora.js b/dist/sora.js index 274480b2..5aef0327 100644 --- a/dist/sora.js +++ b/dist/sora.js @@ -1,7 +1,7 @@ /** * sora-js-sdk * WebRTC SFU Sora JavaScript SDK - * @version: 2020.1.5 + * @version: 2020.1.5-dev * @author: Shiguredo Inc. * @license: Apache-2.0 **/ @@ -97,7 +97,7 @@ type: "connect", // @ts-ignore // eslint-disable-next-line @typescript-eslint/camelcase - sora_client: `Sora JavaScript SDK ${'2020.1.5'}`, + sora_client: `Sora JavaScript SDK ${'2020.1.5-dev'}`, environment: window.navigator.userAgent, role: role, // eslint-disable-next-line @typescript-eslint/camelcase @@ -889,7 +889,7 @@ }, version: function () { // @ts-ignore - return '2020.1.5'; + return '2020.1.5-dev'; }, }; diff --git a/dist/sora.min.js b/dist/sora.min.js index 5060f1be..e213decd 100644 --- a/dist/sora.min.js +++ b/dist/sora.min.js @@ -1,8 +1,8 @@ /** * sora-js-sdk * WebRTC SFU Sora JavaScript SDK - * @version: 2020.1.5 + * @version: 2020.1.5-dev * @author: Shiguredo Inc. * @license: Apache-2.0 - **/(function(a,b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):(a=a||self,a.Sora=b())})(this,function(){'use strict';function a(){const a=window.navigator.userAgent.toLocaleLowerCase();if(-1!==a.indexOf("edge"))return"edge";return-1!==a.indexOf("chrome")&&-1===a.indexOf("edge")?"chrome":-1!==a.indexOf("safari")&&-1===a.indexOf("chrome")?"safari":-1===a.indexOf("opera")?-1===a.indexOf("firefox")?null:"firefox":"opera"}function b(b,c){if("boolean"!=typeof c&&"VP9"===c.codec_type)return!1;if(("upstream"===b||"sendrecv"===b||"sendonly"===b)&&"firefox"===a())return!1;if(("upstream"===b||"sendrecv"===b||"sendonly"===b)&&"safari"===a())return!1;if(("downstream"===b||"recvonly"===b)&&"safari"===a()){const a=window.navigator.appVersion.toLowerCase(),b=/version\/([\d.]+)/.exec(a);if(!b)return!1;const d=b.pop();return!!(d&&12{"audio"===a&&"boolean"==typeof k[a]||"video"===a&&"boolean"==typeof k[a]||0<=h.indexOf(a)&&null!==k[a]||0<=i.indexOf(a)&&null!==k[a]||0<=j.indexOf(a)&&null!==k[a]||delete k[a]}),void 0!==k.audio&&(g.audio=k.audio);const l=Object.keys(k).some(a=>0<=h.indexOf(a));g.audio&&l&&(g.audio={},"audioCodecType"in k&&(g.audio.codec_type=k.audioCodecType),"audioBitRate"in k&&(g.audio.bit_rate=k.audioBitRate));const m=Object.keys(k).some(a=>0<=i.indexOf(a));g.audio&&m&&("object"!=typeof g.audio&&(g.audio={}),g.audio.opus_params={},"audioOpusParamsChannels"in k&&(g.audio.opus_params.channels=k.audioOpusParamsChannels),"audioOpusParamsClockRate"in k&&(g.audio.opus_params.clock_rate=k.audioOpusParamsClockRate),"audioOpusParamsMaxplaybackrate"in k&&(g.audio.opus_params.maxplaybackrate=k.audioOpusParamsMaxplaybackrate),"audioOpusParamsStereo"in k&&(g.audio.opus_params.stereo=k.audioOpusParamsStereo),"audioOpusParamsSpropStereo"in k&&(g.audio.opus_params.sprop_stereo=k.audioOpusParamsSpropStereo),"audioOpusParamsMinptime"in k&&(g.audio.opus_params.minptime=k.audioOpusParamsMinptime),"audioOpusParamsPtime"in k&&(g.audio.opus_params.ptime=k.audioOpusParamsPtime),"audioOpusParamsUseinbandfec"in k&&(g.audio.opus_params.useinbandfec=k.audioOpusParamsUseinbandfec),"audioOpusParamsUsedtx"in k&&(g.audio.opus_params.usedtx=k.audioOpusParamsUsedtx)),void 0!==k.video&&(g.video=k.video);const n=Object.keys(k).some(a=>0<=j.indexOf(a));if(g.video&&n&&(g.video={},"videoCodecType"in k&&(g.video.codec_type=k.videoCodecType),"videoBitRate"in k&&(g.video.bit_rate=k.videoBitRate)),g.simulcast&&!b(g.role,g.video))throw new Error("Simulcast can not be used with this browser");return"e2ee"in f&&(!0===g.video&&(g.video={}),g.video&&(g.video.codec_type="VP8"),g.e2ee=!0),g}function f(a,b,d){let e="";window.performance&&(e="["+(window.performance.now()/1e3).toFixed(3)+"]"),a&&(e=e+"["+a+"]"),c()?console.log(e+" "+b+"\n",d):console.info(e+" "+b+"\n",d)}var g="undefined"==typeof globalThis?"undefined"==typeof window?"undefined"==typeof global?"undefined"==typeof self?{}:self:global:window:globalThis,h=function(a,b){return b={exports:{}},a(b,b.exports),b.exports}(function(c){(function(d,a){c.exports=a()})(g,function(){return class{constructor(c){const a=!!RTCRtpSender.prototype.createEncodedVideoStreams;if(!a)throw new Error("E2EE is not supported in this browser");this.worker=null,this.masterKey=new TextEncoder().encode(c),this.onWorkerDisconnect=null}startWorker(){const b=atob("bGV0IG1hc3RlcktleSxtYXRlcmlhbDtjb25zdCBkZXJpdmVLZXlNYXA9bmV3IE1hcCxzZXFOdW1NYXA9bmV3IE1hcCx3cml0ZUlWTWFwPW5ldyBNYXAsc2VxTnVtTGVuZ3RoPTQsc3NyY0xlbmd0aD00LHBhZGRpbmdMZW5ndGg9OCx1bmVuY3J5cHRlZEJ5dGVzPXtrZXk6MTAsZGVsdGE6Myx1bmRlZmluZWQ6MX07ZnVuY3Rpb24gZ2V0U2VxTnV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KSk6ImNsZWFyIj09PWImJihkZXJpdmVLZXlNYXAuY2xlYXIoKSxzZXFOdW1NYXAuY2xlYXIoKSx3cml0ZUlWTWFwLmNsZWFyKCkpfTsK");this.worker=new Worker(URL.createObjectURL(new Blob([b],{type:"application/javascript"}))),this.worker.onmessage=c=>{const{operation:a}=c.data;"disconnect"===a&&"function"==typeof this.onWorkerDisconnect&&this.onWorkerDisconnect()},this.worker.postMessage({operation:"setKey",masterKey:this.masterKey})}terminateWorker(){this.worker&&this.worker.terminate()}setupSenderTransform(c){if(c.track){const a="video"===c.track.kind?c.createEncodedVideoStreams():c.createEncodedAudioStreams();this.worker&&this.worker.postMessage({operation:"encrypt",readableStream:a.readableStream,writableStream:a.writableStream},[a.readableStream,a.writableStream])}}setupReceiverTransform(c){const a="video"===c.track.kind?c.createEncodedVideoStreams():c.createEncodedAudioStreams();this.worker&&this.worker.postMessage({operation:"decrypt",readableStream:a.readableStream,writableStream:a.writableStream},[a.readableStream,a.writableStream])}static version(){return"2020.1.0"}}})});class i{constructor(a,b,c,d,e,f){this.role=b,this.channelId=c,this.metadata=d,this.signalingUrl=a,this.options=e,this.constraints=null,this.debug=f,this.clientId=null,this.connectionId=null,this.remoteConnectionIds=[],this.stream=null,this.ws=null,this.pc=null,this.callbacks={disconnect:()=>{},push:()=>{},addstream:()=>{},track:()=>{},removestream:()=>{},removetrack:()=>{},notify:()=>{},log:()=>{},timeout:()=>{}},this.authMetadata=null,this.e2ee=null}on(a,b){"addstream"===a?console.warn("@deprecated addstream callback will be removed in a future version. Use track callback."):"removestream"==a&&console.warn("@deprecated removestream callback will be removed in a future version. Use removetrack callback."),a in this.callbacks&&(this.callbacks[a]=b)}disconnect(){this.clientId=null,this.connectionId=null,this.authMetadata=null,this.remoteConnectionIds=[];const a=new Promise(a=>(this.debug&&console.warn("@deprecated closing MediaStream in disconnect will be removed in a future version. Close every track in the MediaStream by yourself."),!this.stream)?a():(this.stream.getTracks().forEach(a=>{a.stop()}),this.stream=null,a())),b=new Promise((a,b)=>{if(!this.ws)return a();this.ws.onclose=null;let c=5;const d=setInterval(()=>this.ws?3===this.ws.readyState?(this.ws=null,clearInterval(d),a()):(--c,0>c)?(clearInterval(d),b("WebSocket Closing Error")):void 0:(clearInterval(d),b("WebSocket Closing Error")),1e3);this.ws.close()}),c=new Promise((a,b)=>{if(d()&&this.pc)return this.pc.oniceconnectionstatechange=null,this.pc.close(),this.pc=null,a();if(!this.pc||"closed"===this.pc.signalingState)return a();let c=5;const e=setInterval(()=>this.pc?"closed"===this.pc.signalingState?(clearInterval(e),this.pc.oniceconnectionstatechange=null,this.pc=null,a()):(--c,0>c)?(clearInterval(e),b("PeerConnection Closing Error")):void 0:(clearInterval(e),b("PeerConnection Closing Error")),1e3);this.pc.close()});return this.e2ee&&(this.e2ee.terminateWorker(),this.e2ee=null),Promise.all([a,b,c])}startE2EE(){"e2ee"in this.options&&"string"==typeof this.options.e2ee&&(this.e2ee=new h(this.options.e2ee),this.e2ee.onWorkerDisconnect=()=>{this.disconnect()},this.e2ee.startWorker())}signaling(a){return this.trace("CREATE OFFER SDP",a),new Promise((b,c)=>{const d=e(a.sdp||"",this.role,this.channelId,this.metadata,this.options);null===this.ws&&(this.ws=new WebSocket(this.signalingUrl)),this.ws.onclose=a=>{c(a)},this.ws.onopen=()=>{this.trace("SIGNALING CONNECT MESSAGE",d),this.ws&&this.ws.send(JSON.stringify(d))},this.ws.onmessage=a=>{const c=JSON.parse(a.data);"offer"==c.type?(this.clientId=c.client_id,this.connectionId=c.connection_id,this.ws&&(this.ws.onclose=a=>{this.disconnect().then(()=>{this.callbacks.disconnect(a)})},this.ws.onerror=null),"metadata"in c&&(this.authMetadata=c.metadata),this.trace("SIGNALING OFFER MESSAGE",c),this.trace("OFFER SDP",c.sdp),b(c)):"update"==c.type?(this.trace("UPDATE SDP",c.sdp),this.update(c)):"ping"==c.type?c.stats?this.getStats().then(a=>{this.ws&&this.ws.send(JSON.stringify({type:"pong",stats:a}))}):this.ws&&this.ws.send(JSON.stringify({type:"pong"})):"push"==c.type?this.callbacks.push(c):"notify"==c.type&&this.callbacks.notify(c)}})}async createOffer(){const a=new window.RTCPeerConnection({iceServers:[]});if(d()){a.addTransceiver("video",{direction:"recvonly"}),a.addTransceiver("audio",{direction:"recvonly"});const b=await a.createOffer();return a.close(),b}const b=await a.createOffer({offerToReceiveAudio:!0,offerToReceiveVideo:!0});return a.close(),b}async connectPeerConnection(a){const b=a.config||{};let c=b;if(this.e2ee&&(c.forceEncodedVideoInsertableStreams=!0,c.forceEncodedAudioInsertableStreams=!0),void 0!==window.RTCPeerConnection.generateCertificate){const a=await window.RTCPeerConnection.generateCertificate({name:"ECDSA",namedCurve:"P-256"});c=Object.assign({certificates:[a]},b)}return this.trace("PEER CONNECTION CONFIG",c),this.pc=new window.RTCPeerConnection(c,this.constraints),void(this.pc.oniceconnectionstatechange=()=>{this.pc&&this.trace("ONICECONNECTIONSTATECHANGE ICECONNECTIONSTATE",this.pc.iceConnectionState)})}async setRemoteDescription(a){this.pc&&(await this.pc.setRemoteDescription(new RTCSessionDescription({type:"offer",sdp:a.sdp})))}async createAnswer(a){if(this.pc){if(this.options.simulcast&&("upstream"===this.role||"sendrecv"===this.role||"sendonly"===this.role)&&a.encodings){const b=this.pc.getTransceivers().find(a=>{if(a.mid&&0<=a.mid.indexOf("video")&&null==a.currentDirection)return a});if(!b)throw new Error("Simulcast Error");await this.setSenderParameters(b,a.encodings)}const b=await this.pc.createAnswer();await this.pc.setLocalDescription(b)}}sendAnswer(){this.pc&&this.ws&&this.pc.localDescription&&(this.trace("ANSWER SDP",this.pc.localDescription.sdp),this.ws.send(JSON.stringify({type:"answer",sdp:this.pc.localDescription.sdp})))}sendUpdateAnswer(){this.pc&&this.ws&&this.pc.localDescription&&(this.trace("ANSWER SDP",this.pc.localDescription.sdp),this.ws.send(JSON.stringify({type:"update",sdp:this.pc.localDescription.sdp})))}onIceCandidate(){return new Promise((a,b)=>{const c=setInterval(()=>{if(null===this.pc){clearInterval(c);const a=new Error;a.message="ICECANDIDATE TIMEOUT",b(a)}else this.pc&&"connected"===this.pc.iceConnectionState&&(clearInterval(c),a())},100);this.pc&&(this.pc.onicecandidate=b=>{if(this.pc&&this.trace("ONICECANDIDATE ICEGATHERINGSTATE",this.pc.iceGatheringState),null===b.candidate)clearInterval(c),a();else{const a=b.candidate.toJSON(),c=Object.assign(a,{type:"candidate"});this.trace("ONICECANDIDATE CANDIDATE MESSAGE",c),this.ws&&this.ws.send(JSON.stringify(c))}})})}trace(a,b){this.callbacks.log(a,b);this.debug&&f(this.clientId,a,b)}async update(a){await this.setRemoteDescription(a),await this.createAnswer(a),this.sendUpdateAnswer()}setSenderParameters(a,b){const c=a.sender.getParameters();return c.encodings=b,a.sender.setParameters(c)}async getStats(){const a=[];if(!this.pc)return a;const b=await this.pc.getStats();return b.forEach(b=>{a.push(b)}),a}}class j extends i{connect(a){return this.options.multistream?this.multiStream(a):this.singleStream(a)}async singleStream(a){let b=0;this.options.timeout&&0{const a=new Error;a.message="CONNECTION TIMEOUT",this.callbacks.timeout(),this.disconnect(),Promise.reject(a)},this.options.timeout)),await this.disconnect(),this.startE2EE();const c=await this.createOffer(),d=await this.signaling(c);return await this.connectPeerConnection(d),await this.setRemoteDescription(d),a.getTracks().forEach(b=>{this.pc&&this.pc.addTrack(b,a)}),this.stream=a,await this.createAnswer(d),this.sendAnswer(),this.pc&&this.e2ee&&this.pc.getSenders().forEach(a=>{this.e2ee&&this.e2ee.setupSenderTransform(a)}),await this.onIceCandidate(),clearTimeout(b),a}async multiStream(a){let b=0;this.options.timeout&&0{const a=new Error;a.message="CONNECTION TIMEOUT",this.callbacks.timeout(),this.disconnect(),Promise.reject(a)},this.options.timeout)),await this.disconnect(),this.startE2EE();const c=await this.createOffer(),d=await this.signaling(c);return await this.connectPeerConnection(d),this.pc&&(this.pc.ontrack=a=>{const b=a.streams[0];b&&"default"!==b.id&&b.id!==this.connectionId&&(this.e2ee&&this.e2ee.setupReceiverTransform(a.receiver),this.callbacks.track(a),b.onremovetrack=a=>{if(this.callbacks.removetrack(a),a.target){const b=this.remoteConnectionIds.indexOf(a.target.id);-1{this.pc&&this.pc.addTrack(b,a)}),this.stream=a,await this.createAnswer(d),this.sendAnswer(),this.pc&&this.e2ee&&this.pc.getSenders().forEach(a=>{this.e2ee&&this.e2ee.setupSenderTransform(a)}),await this.onIceCandidate(),clearTimeout(b),a}}class k extends i{connect(){return this.options.multistream?this.multiStream():this.singleStream()}async singleStream(){let a=0;this.options.timeout&&0{const a=new Error;a.message="CONNECTION TIMEOUT",this.callbacks.timeout(),this.disconnect(),Promise.reject(a)},this.options.timeout)),await this.disconnect(),this.startE2EE();const b=await this.createOffer(),c=await this.signaling(b);return await this.connectPeerConnection(c),this.pc&&(this.pc.ontrack=a=>{this.stream=a.streams[0];const b=this.stream.id;"default"!==b&&(this.e2ee&&this.e2ee.setupReceiverTransform(a.receiver),this.callbacks.track(a),this.stream.onremovetrack=a=>{if(this.callbacks.removetrack(a),a.target){const b=this.remoteConnectionIds.indexOf(a.target.id);-1{const a=new Error;a.message="CONNECTION TIMEOUT",this.callbacks.timeout(),this.disconnect(),Promise.reject(a)},this.options.timeout)),await this.disconnect(),this.startE2EE();const b=await this.createOffer(),c=await this.signaling(b);return await this.connectPeerConnection(c),this.pc&&(this.pc.ontrack=a=>{const b=a.streams[0];"default"!==b.id&&b.id!==this.connectionId&&(this.e2ee&&this.e2ee.setupReceiverTransform(a.receiver),this.callbacks.track(a),b.onremovetrack=a=>{if(this.callbacks.removetrack(a),a.target){const b=this.remoteConnectionIds.indexOf(a.target.id);-1{"audio"===a&&"boolean"==typeof k[a]||"video"===a&&"boolean"==typeof k[a]||0<=h.indexOf(a)&&null!==k[a]||0<=i.indexOf(a)&&null!==k[a]||0<=j.indexOf(a)&&null!==k[a]||delete k[a]}),void 0!==k.audio&&(g.audio=k.audio);const l=Object.keys(k).some(a=>0<=h.indexOf(a));g.audio&&l&&(g.audio={},"audioCodecType"in k&&(g.audio.codec_type=k.audioCodecType),"audioBitRate"in k&&(g.audio.bit_rate=k.audioBitRate));const m=Object.keys(k).some(a=>0<=i.indexOf(a));g.audio&&m&&("object"!=typeof g.audio&&(g.audio={}),g.audio.opus_params={},"audioOpusParamsChannels"in k&&(g.audio.opus_params.channels=k.audioOpusParamsChannels),"audioOpusParamsClockRate"in k&&(g.audio.opus_params.clock_rate=k.audioOpusParamsClockRate),"audioOpusParamsMaxplaybackrate"in k&&(g.audio.opus_params.maxplaybackrate=k.audioOpusParamsMaxplaybackrate),"audioOpusParamsStereo"in k&&(g.audio.opus_params.stereo=k.audioOpusParamsStereo),"audioOpusParamsSpropStereo"in k&&(g.audio.opus_params.sprop_stereo=k.audioOpusParamsSpropStereo),"audioOpusParamsMinptime"in k&&(g.audio.opus_params.minptime=k.audioOpusParamsMinptime),"audioOpusParamsPtime"in k&&(g.audio.opus_params.ptime=k.audioOpusParamsPtime),"audioOpusParamsUseinbandfec"in k&&(g.audio.opus_params.useinbandfec=k.audioOpusParamsUseinbandfec),"audioOpusParamsUsedtx"in k&&(g.audio.opus_params.usedtx=k.audioOpusParamsUsedtx)),void 0!==k.video&&(g.video=k.video);const n=Object.keys(k).some(a=>0<=j.indexOf(a));if(g.video&&n&&(g.video={},"videoCodecType"in k&&(g.video.codec_type=k.videoCodecType),"videoBitRate"in k&&(g.video.bit_rate=k.videoBitRate)),g.simulcast&&!b(g.role,g.video))throw new Error("Simulcast can not be used with this browser");return"e2ee"in f&&(!0===g.video&&(g.video={}),g.video&&(g.video.codec_type="VP8"),g.e2ee=!0),g}function f(a,b,d){let e="";window.performance&&(e="["+(window.performance.now()/1e3).toFixed(3)+"]"),a&&(e=e+"["+a+"]"),c()?console.log(e+" "+b+"\n",d):console.info(e+" "+b+"\n",d)}var g="undefined"==typeof globalThis?"undefined"==typeof window?"undefined"==typeof global?"undefined"==typeof self?{}:self:global:window:globalThis,h=function(a,b){return b={exports:{}},a(b,b.exports),b.exports}(function(c){(function(d,a){c.exports=a()})(g,function(){return class{constructor(c){const a=!!RTCRtpSender.prototype.createEncodedVideoStreams;if(!a)throw new Error("E2EE is not supported in this browser");this.worker=null,this.masterKey=new TextEncoder().encode(c),this.onWorkerDisconnect=null}startWorker(){const b=atob("bGV0IG1hc3RlcktleSxtYXRlcmlhbDtjb25zdCBkZXJpdmVLZXlNYXA9bmV3IE1hcCxzZXFOdW1NYXA9bmV3IE1hcCx3cml0ZUlWTWFwPW5ldyBNYXAsc2VxTnVtTGVuZ3RoPTQsc3NyY0xlbmd0aD00LHBhZGRpbmdMZW5ndGg9OCx1bmVuY3J5cHRlZEJ5dGVzPXtrZXk6MTAsZGVsdGE6Myx1bmRlZmluZWQ6MX07ZnVuY3Rpb24gZ2V0U2VxTnVtKGEpe3JldHVybiBzZXFOdW1NYXAuZ2V0KGEpfHwwfWZ1bmN0aW9uIHNldFNlcU51bShhLGIpe3NlcU51bU1hcC5zZXQoYSxiKX1hc3luYyBmdW5jdGlvbiBnZW5lcmF0ZURlcml2ZUtleShhLGIpe2xldCBjPWRlcml2ZUtleU1hcC5nZXQoYSk7cmV0dXJuIGN8fChjPWF3YWl0IGNyeXB0by5zdWJ0bGUuZGVyaXZlS2V5KHtuYW1lOiJQQktERjIiLHNhbHQ6YixpdGVyYXRpb25zOjFlNCxoYXNoOiJTSEEtMjU2In0sbWF0ZXJpYWwse25hbWU6IkFFUy1HQ00iLGxlbmd0aDoxMjh9LCExLFsiZW5jcnlwdCIsImRlY3J5cHQiXSksZGVyaXZlS2V5TWFwLnNldChhLGMpKSxjfWFzeW5jIGZ1bmN0aW9uIGdlbmVyYXRlSVYoYSxiLGMpe2xldCBkPXdyaXRlSVZNYXAuZ2V0KGEpO2lmKCFkKXtjb25zdCBjPWF3YWl0IGNyeXB0by5zdWJ0bGUuZGVyaXZlQml0cyh7bmFtZToiUEJLREYyIixzYWx0OmIsaXRlcmF0aW9uczoxZTQsaGFzaDp7bmFtZToiU0hBLTM4NCJ9fSxtYXRlcmlhbCw5Nik7ZD1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VRvKGMpfWVsc2UgaWYoImRlY3J5cHQiPT09Yil7Y29uc3R7cmVhZGFibGVTdHJlYW06Yix3cml0YWJsZVN0cmVhbTpjfT1hLmRhdGEsZD1uZXcgVHJhbnNmb3JtU3RyZWFtKHt0cmFuc2Zvcm06ZGVjcnlwdEZ1bmN0aW9ufSk7Yi5waXBlVGhyb3VnaChkKS5waXBlVG8oYyl9ZWxzZSJzZXRLZXkiPT09Yj8obWFzdGVyS2V5PWEuZGF0YS5tYXN0ZXJLZXksbWF0ZXJpYWw9YXdhaXQgY3J5cHRvLnN1YnRsZS5pbXBvcnRLZXkoInJhdyIsbWFzdGVyS2V5LCJQQktERjIiLCExLFsiZGVyaXZlQml0cyIsImRlcml2ZUtleSJdKSk6ImNsZWFyIj09PWImJihkZXJpdmVLZXlNYXAuY2xlYXIoKSxzZXFOdW1NYXAuY2xlYXIoKSx3cml0ZUlWTWFwLmNsZWFyKCkpfTsK");this.worker=new Worker(URL.createObjectURL(new Blob([b],{type:"application/javascript"}))),this.worker.onmessage=c=>{const{operation:a}=c.data;"disconnect"===a&&"function"==typeof this.onWorkerDisconnect&&this.onWorkerDisconnect()},this.worker.postMessage({operation:"setKey",masterKey:this.masterKey})}terminateWorker(){this.worker&&this.worker.terminate()}setupSenderTransform(c){if(c.track){const a="video"===c.track.kind?c.createEncodedVideoStreams():c.createEncodedAudioStreams();this.worker&&this.worker.postMessage({operation:"encrypt",readableStream:a.readableStream,writableStream:a.writableStream},[a.readableStream,a.writableStream])}}setupReceiverTransform(c){const a="video"===c.track.kind?c.createEncodedVideoStreams():c.createEncodedAudioStreams();this.worker&&this.worker.postMessage({operation:"decrypt",readableStream:a.readableStream,writableStream:a.writableStream},[a.readableStream,a.writableStream])}static version(){return"2020.1.0"}}})});class i{constructor(a,b,c,d,e,f){this.role=b,this.channelId=c,this.metadata=d,this.signalingUrl=a,this.options=e,this.constraints=null,this.debug=f,this.clientId=null,this.connectionId=null,this.remoteConnectionIds=[],this.stream=null,this.ws=null,this.pc=null,this.callbacks={disconnect:()=>{},push:()=>{},addstream:()=>{},track:()=>{},removestream:()=>{},removetrack:()=>{},notify:()=>{},log:()=>{},timeout:()=>{}},this.authMetadata=null,this.e2ee=null}on(a,b){"addstream"===a?console.warn("@deprecated addstream callback will be removed in a future version. Use track callback."):"removestream"==a&&console.warn("@deprecated removestream callback will be removed in a future version. Use removetrack callback."),a in this.callbacks&&(this.callbacks[a]=b)}disconnect(){this.clientId=null,this.connectionId=null,this.authMetadata=null,this.remoteConnectionIds=[];const a=new Promise(a=>(this.debug&&console.warn("@deprecated closing MediaStream in disconnect will be removed in a future version. Close every track in the MediaStream by yourself."),!this.stream)?a():(this.stream.getTracks().forEach(a=>{a.stop()}),this.stream=null,a())),b=new Promise((a,b)=>{if(!this.ws)return a();this.ws.onclose=null;let c=5;const d=setInterval(()=>this.ws?3===this.ws.readyState?(this.ws=null,clearInterval(d),a()):(--c,0>c)?(clearInterval(d),b("WebSocket Closing Error")):void 0:(clearInterval(d),b("WebSocket Closing Error")),1e3);this.ws.close()}),c=new Promise((a,b)=>{if(d()&&this.pc)return this.pc.oniceconnectionstatechange=null,this.pc.close(),this.pc=null,a();if(!this.pc||"closed"===this.pc.signalingState)return a();let c=5;const e=setInterval(()=>this.pc?"closed"===this.pc.signalingState?(clearInterval(e),this.pc.oniceconnectionstatechange=null,this.pc=null,a()):(--c,0>c)?(clearInterval(e),b("PeerConnection Closing Error")):void 0:(clearInterval(e),b("PeerConnection Closing Error")),1e3);this.pc.close()});return this.e2ee&&(this.e2ee.terminateWorker(),this.e2ee=null),Promise.all([a,b,c])}startE2EE(){"e2ee"in this.options&&"string"==typeof this.options.e2ee&&(this.e2ee=new h(this.options.e2ee),this.e2ee.onWorkerDisconnect=()=>{this.disconnect()},this.e2ee.startWorker())}signaling(a){return this.trace("CREATE OFFER SDP",a),new Promise((b,c)=>{const d=e(a.sdp||"",this.role,this.channelId,this.metadata,this.options);null===this.ws&&(this.ws=new WebSocket(this.signalingUrl)),this.ws.onclose=a=>{c(a)},this.ws.onopen=()=>{this.trace("SIGNALING CONNECT MESSAGE",d),this.ws&&this.ws.send(JSON.stringify(d))},this.ws.onmessage=a=>{const c=JSON.parse(a.data);"offer"==c.type?(this.clientId=c.client_id,this.connectionId=c.connection_id,this.ws&&(this.ws.onclose=a=>{this.disconnect().then(()=>{this.callbacks.disconnect(a)})},this.ws.onerror=null),"metadata"in c&&(this.authMetadata=c.metadata),this.trace("SIGNALING OFFER MESSAGE",c),this.trace("OFFER SDP",c.sdp),b(c)):"update"==c.type?(this.trace("UPDATE SDP",c.sdp),this.update(c)):"ping"==c.type?c.stats?this.getStats().then(a=>{this.ws&&this.ws.send(JSON.stringify({type:"pong",stats:a}))}):this.ws&&this.ws.send(JSON.stringify({type:"pong"})):"push"==c.type?this.callbacks.push(c):"notify"==c.type&&this.callbacks.notify(c)}})}async createOffer(){const a=new window.RTCPeerConnection({iceServers:[]});if(d()){a.addTransceiver("video",{direction:"recvonly"}),a.addTransceiver("audio",{direction:"recvonly"});const b=await a.createOffer();return a.close(),b}const b=await a.createOffer({offerToReceiveAudio:!0,offerToReceiveVideo:!0});return a.close(),b}async connectPeerConnection(a){const b=a.config||{};let c=b;if(this.e2ee&&(c.forceEncodedVideoInsertableStreams=!0,c.forceEncodedAudioInsertableStreams=!0),void 0!==window.RTCPeerConnection.generateCertificate){const a=await window.RTCPeerConnection.generateCertificate({name:"ECDSA",namedCurve:"P-256"});c=Object.assign({certificates:[a]},b)}return this.trace("PEER CONNECTION CONFIG",c),this.pc=new window.RTCPeerConnection(c,this.constraints),void(this.pc.oniceconnectionstatechange=()=>{this.pc&&this.trace("ONICECONNECTIONSTATECHANGE ICECONNECTIONSTATE",this.pc.iceConnectionState)})}async setRemoteDescription(a){this.pc&&(await this.pc.setRemoteDescription(new RTCSessionDescription({type:"offer",sdp:a.sdp})))}async createAnswer(a){if(this.pc){if(this.options.simulcast&&("upstream"===this.role||"sendrecv"===this.role||"sendonly"===this.role)&&a.encodings){const b=this.pc.getTransceivers().find(a=>{if(a.mid&&0<=a.mid.indexOf("video")&&null==a.currentDirection)return a});if(!b)throw new Error("Simulcast Error");await this.setSenderParameters(b,a.encodings)}const b=await this.pc.createAnswer();await this.pc.setLocalDescription(b)}}sendAnswer(){this.pc&&this.ws&&this.pc.localDescription&&(this.trace("ANSWER SDP",this.pc.localDescription.sdp),this.ws.send(JSON.stringify({type:"answer",sdp:this.pc.localDescription.sdp})))}sendUpdateAnswer(){this.pc&&this.ws&&this.pc.localDescription&&(this.trace("ANSWER SDP",this.pc.localDescription.sdp),this.ws.send(JSON.stringify({type:"update",sdp:this.pc.localDescription.sdp})))}onIceCandidate(){return new Promise((a,b)=>{const c=setInterval(()=>{if(null===this.pc){clearInterval(c);const a=new Error;a.message="ICECANDIDATE TIMEOUT",b(a)}else this.pc&&"connected"===this.pc.iceConnectionState&&(clearInterval(c),a())},100);this.pc&&(this.pc.onicecandidate=b=>{if(this.pc&&this.trace("ONICECANDIDATE ICEGATHERINGSTATE",this.pc.iceGatheringState),null===b.candidate)clearInterval(c),a();else{const a=b.candidate.toJSON(),c=Object.assign(a,{type:"candidate"});this.trace("ONICECANDIDATE CANDIDATE MESSAGE",c),this.ws&&this.ws.send(JSON.stringify(c))}})})}trace(a,b){this.callbacks.log(a,b);this.debug&&f(this.clientId,a,b)}async update(a){await this.setRemoteDescription(a),await this.createAnswer(a),this.sendUpdateAnswer()}setSenderParameters(a,b){const c=a.sender.getParameters();return c.encodings=b,a.sender.setParameters(c)}async getStats(){const a=[];if(!this.pc)return a;const b=await this.pc.getStats();return b.forEach(b=>{a.push(b)}),a}}class j extends i{connect(a){return this.options.multistream?this.multiStream(a):this.singleStream(a)}async singleStream(a){let b=0;this.options.timeout&&0{const a=new Error;a.message="CONNECTION TIMEOUT",this.callbacks.timeout(),this.disconnect(),Promise.reject(a)},this.options.timeout)),await this.disconnect(),this.startE2EE();const c=await this.createOffer(),d=await this.signaling(c);return await this.connectPeerConnection(d),await this.setRemoteDescription(d),a.getTracks().forEach(b=>{this.pc&&this.pc.addTrack(b,a)}),this.stream=a,await this.createAnswer(d),this.sendAnswer(),this.pc&&this.e2ee&&this.pc.getSenders().forEach(a=>{this.e2ee&&this.e2ee.setupSenderTransform(a)}),await this.onIceCandidate(),clearTimeout(b),a}async multiStream(a){let b=0;this.options.timeout&&0{const a=new Error;a.message="CONNECTION TIMEOUT",this.callbacks.timeout(),this.disconnect(),Promise.reject(a)},this.options.timeout)),await this.disconnect(),this.startE2EE();const c=await this.createOffer(),d=await this.signaling(c);return await this.connectPeerConnection(d),this.pc&&(this.pc.ontrack=a=>{const b=a.streams[0];b&&"default"!==b.id&&b.id!==this.connectionId&&(this.e2ee&&this.e2ee.setupReceiverTransform(a.receiver),this.callbacks.track(a),b.onremovetrack=a=>{if(this.callbacks.removetrack(a),a.target){const b=this.remoteConnectionIds.indexOf(a.target.id);-1{this.pc&&this.pc.addTrack(b,a)}),this.stream=a,await this.createAnswer(d),this.sendAnswer(),this.pc&&this.e2ee&&this.pc.getSenders().forEach(a=>{this.e2ee&&this.e2ee.setupSenderTransform(a)}),await this.onIceCandidate(),clearTimeout(b),a}}class k extends i{connect(){return this.options.multistream?this.multiStream():this.singleStream()}async singleStream(){let a=0;this.options.timeout&&0{const a=new Error;a.message="CONNECTION TIMEOUT",this.callbacks.timeout(),this.disconnect(),Promise.reject(a)},this.options.timeout)),await this.disconnect(),this.startE2EE();const b=await this.createOffer(),c=await this.signaling(b);return await this.connectPeerConnection(c),this.pc&&(this.pc.ontrack=a=>{this.stream=a.streams[0];const b=this.stream.id;"default"!==b&&(this.e2ee&&this.e2ee.setupReceiverTransform(a.receiver),this.callbacks.track(a),this.stream.onremovetrack=a=>{if(this.callbacks.removetrack(a),a.target){const b=this.remoteConnectionIds.indexOf(a.target.id);-1{const a=new Error;a.message="CONNECTION TIMEOUT",this.callbacks.timeout(),this.disconnect(),Promise.reject(a)},this.options.timeout)),await this.disconnect(),this.startE2EE();const b=await this.createOffer(),c=await this.signaling(b);return await this.connectPeerConnection(c),this.pc&&(this.pc.ontrack=a=>{const b=a.streams[0];"default"!==b.id&&b.id!==this.connectionId&&(this.e2ee&&this.e2ee.setupReceiverTransform(a.receiver),this.callbacks.track(a),b.onremovetrack=a=>{if(this.callbacks.removetrack(a),a.target){const b=this.remoteConnectionIds.indexOf(a.target.id);-1{const{operation:b}=a.data;\"disconnect\"===b&&\"function\"==typeof this.onWorkerDisconnect&&this.onWorkerDisconnect()},this.worker.postMessage({operation:\"setKey\",masterKey:this.masterKey})}terminateWorker(){this.worker&&this.worker.terminate()}setupSenderTransform(a){if(a.track){const b=\"video\"===a.track.kind?a.createEncodedVideoStreams():a.createEncodedAudioStreams();this.worker&&this.worker.postMessage({operation:\"encrypt\",readableStream:b.readableStream,writableStream:b.writableStream},[b.readableStream,b.writableStream])}}setupReceiverTransform(a){const b=\"video\"===a.track.kind?a.createEncodedVideoStreams():a.createEncodedAudioStreams();this.worker&&this.worker.postMessage({operation:\"decrypt\",readableStream:b.readableStream,writableStream:b.writableStream},[b.readableStream,b.writableStream])}static version(){return\"2020.1.0\"}}});\n//# sourceMappingURL=sora_e2ee.min.js.map\n"],"names":["a","b","module","this","constructor","RTCRtpSender","prototype","createEncodedVideoStreams","Error","worker","masterKey","TextEncoder","encode","onWorkerDisconnect","startWorker","atob","Worker","URL","createObjectURL","Blob","type","onmessage","operation","data","postMessage","terminateWorker","terminate","setupSenderTransform","track","kind","createEncodedAudioStreams","readableStream","writableStream","setupReceiverTransform","version"],"mappings":";;;;;;03IAMI,CAAC,SAASA,CAAT,CAAWC,CAAX,CAAa,CAAsDC,SAAA,CAAeD,CAAC,EAA8E,CAAlK,EAAoKE,CAApK,CAAyK,UAAU,CAAc,MAAO,MAAO,CAACC,WAAW,CAACJ,CAAD,CAAG,CAAC,KAAMC,CAAAA,CAAC,CAAC,CAAC,CAACI,YAAY,CAACC,SAAb,CAAuBC,yBAAjC,CAA2D,GAAG,CAACN,CAAJ,CAAM,KAAM,IAAIO,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C,cAAc,CAAC/B,CAAC,CAAC+B,cAAtE,CAAxB,CAA8G,CAAC/B,CAAC,CAAC8B,cAAH,CAAkB9B,CAAC,CAAC+B,cAApB,CAA9G,CAAmJ,CAAC,CAAAC,sBAAsB,CAACjC,CAAD,CAAG,CAAC,KAAMC,CAAAA,CAAC,CAAC,UAAUD,CAAC,CAAC4B,KAAF,CAAQC,IAAlB,CAAuB7B,CAAC,CAACO,yBAAF,EAAvB,CAAqDP,CAAC,CAAC8B,yBAAF,EAA7D,CAA2F,KAAKrB,MAAL,EAAa,KAAKA,MAAL,CAAYe,WAAZ,CAAwB,CAACF,SAAS,CAAC,SAAX,CAAqBS,cAAc,CAAC9B,CAAC,CAAC8B,cAAtC,CAAqDC,cAAc,CAAC/B,CAAC,CAAC+B,cAAtE,CAAxB,CAA8G,CAAC/B,CAAC,CAAC8B,cAAH,CAAkB9B,CAAC,CAAC+B,cAApB,CAA9G,CAAmJ,OAAOE,CAAAA,OAAP,EAAgB,CAAC,MAAM,UAAW,CAAvqL,CAAyqL,CAAx3L"} \ No newline at end of file +{"version":3,"file":"sora.min.js","sources":["../node_modules/sora-e2ee/dist/sora_e2ee.min.js"],"sourcesContent":["/**\n * sora-e2ee\n * WebRTC SFU Sora JavaScript E2EE Library\n * @version: 2020.1.0\n * @author: Shiguredo Inc.\n * @license: Apache-2.0\n **/(function(a,b){\"object\"==typeof exports&&\"undefined\"!=typeof module?module.exports=b():\"function\"==typeof define&&define.amd?define(b):(a=a||self,a.SoraE2EE=b())})(this,function(){'use strict';return class a{constructor(a){const b=!!RTCRtpSender.prototype.createEncodedVideoStreams;if(!b)throw new Error(\"E2EE is not supported in this browser\");this.worker=null,this.masterKey=new TextEncoder().encode(a),this.onWorkerDisconnect=null}startWorker(){const a=atob(\"bGV0IG1hc3RlcktleSxtYXRlcmlhbDtjb25zdCBkZXJpdmVLZXlNYXA9bmV3IE1hcCxzZXFOdW1NYXA9bmV3IE1hcCx3cml0ZUlWTWFwPW5ldyBNYXA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S2V5PWEuZGF0YS5tYXN0ZXJLZXksbWF0ZXJpYWw9YXdhaXQgY3J5cHRvLnN1YnRsZS5pbXBvcnRLZXkoInJhdyIsbWFzdGVyS2V5LCJQQktERjIiLCExLFsiZGVyaXZlQml0cyIsImRlcml2ZUtleSJdKSk6ImNsZWFyIj09PWImJihkZXJpdmVLZXlNYXAuY2xlYXIoKSxzZXFOdW1NYXAuY2xlYXIoKSx3cml0ZUlWTWFwLmNsZWFyKCkpfTsK\");this.worker=new Worker(URL.createObjectURL(new Blob([a],{type:\"application/javascript\"}))),this.worker.onmessage=a=>{const{operation:b}=a.data;\"disconnect\"===b&&\"function\"==typeof this.onWorkerDisconnect&&this.onWorkerDisconnect()},this.worker.postMessage({operation:\"setKey\",masterKey:this.masterKey})}terminateWorker(){this.worker&&this.worker.terminate()}setupSenderTransform(a){if(a.track){const b=\"video\"===a.track.kind?a.createEncodedVideoStreams():a.createEncodedAudioStreams();this.worker&&this.worker.postMessage({operation:\"encrypt\",readableStream:b.readableStream,writableStream:b.writableStream},[b.readableStream,b.writableStream])}}setupReceiverTransform(a){const b=\"video\"===a.track.kind?a.createEncodedVideoStreams():a.createEncodedAudioStreams();this.worker&&this.worker.postMessage({operation:\"decrypt\",readableStream:b.readableStream,writableStream:b.writableStream},[b.readableStream,b.writableStream])}static version(){return\"2020.1.0\"}}});\n//# sourceMappingURL=sora_e2ee.min.js.map\n"],"names":["a","b","module","this","constructor","RTCRtpSender","prototype","createEncodedVideoStreams","Error","worker","masterKey","TextEncoder","encode","onWorkerDisconnect","startWorker","atob","Worker","URL","createObjectURL","Blob","type","onmessage","operation","data","postMessage","terminateWorker","terminate","setupSenderTransform","track","kind","createEncodedAudioStreams","readableStream","writableStream","setupReceiverTransform","version"],"mappings":";;;;;;83IAMI,CAAC,SAASA,CAAT,CAAWC,CAAX,CAAa,CAAsDC,SAAA,CAAeD,CAAC,EAA8E,CAAlK,EAAoKE,CAApK,CAAyK,UAAU,CAAc,MAAO,MAAO,CAACC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yBAAF,EAA7D,CAA2F,KAAKrB,MAAL,EAAa,KAAKA,MAAL,CAAYe,WAAZ,CAAwB,CAACF,SAAS,CAAC,SAAX,CAAqBS,cAAc,CAAC9B,CAAC,CAAC8B,cAAtC,CAAqDC,cAAc,CAAC/B,CAAC,CAAC+B,cAAtE,CAAxB,CAA8G,CAAC/B,CAAC,CAAC8B,cAAH,CAAkB9B,CAAC,CAAC+B,cAApB,CAA9G,CAAmJ,CAAC,CAAAC,sBAAsB,CAACjC,CAAD,CAAG,CAAC,KAAMC,CAAAA,CAAC,CAAC,UAAUD,CAAC,CAAC4B,KAAF,CAAQC,IAAlB,CAAuB7B,CAAC,CAACO,yBAAF,EAAvB,CAAqDP,CAAC,CAAC8B,yBAAF,EAA7D,CAA2F,KAAKrB,MAAL,EAAa,KAAKA,MAAL,CAAYe,WAAZ,CAAwB,CAACF,SAAS,CAAC,SAAX,CAAqBS,cAAc,CAAC9B,CAAC,CAAC8B,cAAtC,CAAqDC,cAAc,CAAC/B,CAAC,CAAC+B,cAAtE,CAAxB,CAA8G,CAAC/B,CAAC,CAAC8B,cAAH,CAAkB9B,CAAC,CAAC+B,cAApB,CAA9G,CAAmJ,OAAOE,CAAAA,OAAP,EAAgB,CAAC,MAAM,UAAW,CAAvqL,CAAyqL,CAAx3L"} \ No newline at end of file From 5921569e67752a312349faf99d232465a02611ea Mon Sep 17 00:00:00 2001 From: NAKAI Ryosuke Date: Sat, 25 Jul 2020 18:09:53 +0900 Subject: [PATCH 02/18] yarn upgrade --- package.json | 2 +- yarn.lock | 501 ++++++++++++++++++++++++++------------------------- 2 files changed, 255 insertions(+), 248 deletions(-) diff --git a/package.json b/package.json index c44e7d42..918c9e5b 100644 --- a/package.json +++ b/package.json @@ -46,6 +46,6 @@ "typescript": "^3.8.3" }, "dependencies": { - "sora-e2ee": "^2020.1.0" + "sora-e2ee": "^2020.2.0" } } diff --git a/yarn.lock b/yarn.lock index 33a0685f..fb36c34c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,152 +2,151 @@ # yarn lockfile v1 -"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.10.3": - version "7.10.3" - resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.10.3.tgz#324bcfd8d35cd3d47dae18cde63d752086435e9a" - integrity sha512-fDx9eNW0qz0WkUeqL6tXEXzVlPh6Y5aCDEZesl0xBGA8ndRukX91Uk44ZqnkECp01NAZUdCAl+aiQNGi0k88Eg== +"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.10.4.tgz#168da1a36e90da68ae8d49c0f1b48c7c6249213a" + integrity sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg== dependencies: - "@babel/highlight" "^7.10.3" + "@babel/highlight" "^7.10.4" "@babel/core@^7.1.0", "@babel/core@^7.7.5", "@babel/core@^7.8.7": - version "7.10.3" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.10.3.tgz#73b0e8ddeec1e3fdd7a2de587a60e17c440ec77e" - integrity sha512-5YqWxYE3pyhIi84L84YcwjeEgS+fa7ZjK6IBVGTjDVfm64njkR2lfDhVR5OudLk8x2GK59YoSyVv+L/03k1q9w== - dependencies: - "@babel/code-frame" "^7.10.3" - "@babel/generator" "^7.10.3" - "@babel/helper-module-transforms" "^7.10.1" - "@babel/helpers" "^7.10.1" - "@babel/parser" "^7.10.3" - "@babel/template" "^7.10.3" - "@babel/traverse" "^7.10.3" - "@babel/types" "^7.10.3" + version "7.10.5" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.10.5.tgz#1f15e2cca8ad9a1d78a38ddba612f5e7cdbbd330" + integrity sha512-O34LQooYVDXPl7QWCdW9p4NR+QlzOr7xShPPJz8GsuCU3/8ua/wqTr7gmnxXv+WBESiGU/G5s16i6tUvHkNb+w== + dependencies: + "@babel/code-frame" "^7.10.4" + "@babel/generator" "^7.10.5" + "@babel/helper-module-transforms" "^7.10.5" + "@babel/helpers" "^7.10.4" + "@babel/parser" "^7.10.5" + "@babel/template" "^7.10.4" + "@babel/traverse" "^7.10.5" + "@babel/types" "^7.10.5" convert-source-map "^1.7.0" debug "^4.1.0" gensync "^1.0.0-beta.1" json5 "^2.1.2" - lodash "^4.17.13" + lodash "^4.17.19" resolve "^1.3.2" semver "^5.4.1" source-map "^0.5.0" -"@babel/generator@^7.10.3": - version "7.10.3" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.10.3.tgz#32b9a0d963a71d7a54f5f6c15659c3dbc2a523a5" - integrity sha512-drt8MUHbEqRzNR0xnF8nMehbY11b1SDkRw03PSNH/3Rb2Z35oxkddVSi3rcaak0YJQ86PCuE7Qx1jSFhbLNBMA== +"@babel/generator@^7.10.5": + version "7.10.5" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.10.5.tgz#1b903554bc8c583ee8d25f1e8969732e6b829a69" + integrity sha512-3vXxr3FEW7E7lJZiWQ3bM4+v/Vyr9C+hpolQ8BGFr9Y8Ri2tFLWTixmwKBafDujO1WVah4fhZBeU1bieKdghig== dependencies: - "@babel/types" "^7.10.3" + "@babel/types" "^7.10.5" jsesc "^2.5.1" - lodash "^4.17.13" source-map "^0.5.0" -"@babel/helper-function-name@^7.10.3": - version "7.10.3" - resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.10.3.tgz#79316cd75a9fa25ba9787ff54544307ed444f197" - integrity sha512-FvSj2aiOd8zbeqijjgqdMDSyxsGHaMt5Tr0XjQsGKHD3/1FP3wksjnLAWzxw7lvXiej8W1Jt47SKTZ6upQNiRw== - dependencies: - "@babel/helper-get-function-arity" "^7.10.3" - "@babel/template" "^7.10.3" - "@babel/types" "^7.10.3" - -"@babel/helper-get-function-arity@^7.10.3": - version "7.10.3" - resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.10.3.tgz#3a28f7b28ccc7719eacd9223b659fdf162e4c45e" - integrity sha512-iUD/gFsR+M6uiy69JA6fzM5seno8oE85IYZdbVVEuQaZlEzMO2MXblh+KSPJgsZAUx0EEbWXU0yJaW7C9CdAVg== - dependencies: - "@babel/types" "^7.10.3" - -"@babel/helper-member-expression-to-functions@^7.10.1": - version "7.10.3" - resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.10.3.tgz#bc3663ac81ac57c39148fef4c69bf48a77ba8dd6" - integrity sha512-q7+37c4EPLSjNb2NmWOjNwj0+BOyYlssuQ58kHEWk1Z78K5i8vTUsteq78HMieRPQSl/NtpQyJfdjt3qZ5V2vw== - dependencies: - "@babel/types" "^7.10.3" - -"@babel/helper-module-imports@^7.10.1": - version "7.10.3" - resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.10.3.tgz#766fa1d57608e53e5676f23ae498ec7a95e1b11a" - integrity sha512-Jtqw5M9pahLSUWA+76nhK9OG8nwYXzhQzVIGFoNaHnXF/r4l7kz4Fl0UAW7B6mqC5myoJiBP5/YQlXQTMfHI9w== - dependencies: - "@babel/types" "^7.10.3" - -"@babel/helper-module-transforms@^7.10.1": - version "7.10.1" - resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.10.1.tgz#24e2f08ee6832c60b157bb0936c86bef7210c622" - integrity sha512-RLHRCAzyJe7Q7sF4oy2cB+kRnU4wDZY/H2xJFGof+M+SJEGhZsb+GFj5j1AD8NiSaVBJ+Pf0/WObiXu/zxWpFg== - dependencies: - "@babel/helper-module-imports" "^7.10.1" - "@babel/helper-replace-supers" "^7.10.1" - "@babel/helper-simple-access" "^7.10.1" - "@babel/helper-split-export-declaration" "^7.10.1" - "@babel/template" "^7.10.1" - "@babel/types" "^7.10.1" - lodash "^4.17.13" - -"@babel/helper-optimise-call-expression@^7.10.1": - version "7.10.3" - resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.10.3.tgz#f53c4b6783093195b0f69330439908841660c530" - integrity sha512-kT2R3VBH/cnSz+yChKpaKRJQJWxdGoc6SjioRId2wkeV3bK0wLLioFpJROrX0U4xr/NmxSSAWT/9Ih5snwIIzg== - dependencies: - "@babel/types" "^7.10.3" - -"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.1", "@babel/helper-plugin-utils@^7.8.0": - version "7.10.3" - resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.3.tgz#aac45cccf8bc1873b99a85f34bceef3beb5d3244" - integrity sha512-j/+j8NAWUTxOtx4LKHybpSClxHoq6I91DQ/mKgAXn5oNUPIUiGppjPIX3TDtJWPrdfP9Kfl7e4fgVMiQR9VE/g== - -"@babel/helper-replace-supers@^7.10.1": - version "7.10.1" - resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.10.1.tgz#ec6859d20c5d8087f6a2dc4e014db7228975f13d" - integrity sha512-SOwJzEfpuQwInzzQJGjGaiG578UYmyi2Xw668klPWV5n07B73S0a9btjLk/52Mlcxa+5AdIYqws1KyXRfMoB7A== - dependencies: - "@babel/helper-member-expression-to-functions" "^7.10.1" - "@babel/helper-optimise-call-expression" "^7.10.1" - "@babel/traverse" "^7.10.1" - "@babel/types" "^7.10.1" - -"@babel/helper-simple-access@^7.10.1": - version "7.10.1" - resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.10.1.tgz#08fb7e22ace9eb8326f7e3920a1c2052f13d851e" - integrity sha512-VSWpWzRzn9VtgMJBIWTZ+GP107kZdQ4YplJlCmIrjoLVSi/0upixezHCDG8kpPVTBJpKfxTH01wDhh+jS2zKbw== - dependencies: - "@babel/template" "^7.10.1" - "@babel/types" "^7.10.1" - -"@babel/helper-split-export-declaration@^7.10.1": - version "7.10.1" - resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.10.1.tgz#c6f4be1cbc15e3a868e4c64a17d5d31d754da35f" - integrity sha512-UQ1LVBPrYdbchNhLwj6fetj46BcFwfS4NllJo/1aJsT+1dLTEnXJL0qHqtY7gPzF8S2fXBJamf1biAXV3X077g== - dependencies: - "@babel/types" "^7.10.1" - -"@babel/helper-validator-identifier@^7.10.3": - version "7.10.3" - resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.3.tgz#60d9847f98c4cea1b279e005fdb7c28be5412d15" - integrity sha512-bU8JvtlYpJSBPuj1VUmKpFGaDZuLxASky3LhaKj3bmpSTY6VWooSM8msk+Z0CZoErFye2tlABF6yDkT3FOPAXw== - -"@babel/helpers@^7.10.1": - version "7.10.1" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.10.1.tgz#a6827b7cb975c9d9cef5fd61d919f60d8844a973" - integrity sha512-muQNHF+IdU6wGgkaJyhhEmI54MOZBKsFfsXFhboz1ybwJ1Kl7IHlbm2a++4jwrmY5UYsgitt5lfqo1wMFcHmyw== - dependencies: - "@babel/template" "^7.10.1" - "@babel/traverse" "^7.10.1" - "@babel/types" "^7.10.1" - -"@babel/highlight@^7.10.3": - version "7.10.3" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.10.3.tgz#c633bb34adf07c5c13156692f5922c81ec53f28d" - integrity sha512-Ih9B/u7AtgEnySE2L2F0Xm0GaM729XqqLfHkalTsbjXGyqmf/6M0Cu0WpvqueUlW+xk88BHw9Nkpj49naU+vWw== - dependencies: - "@babel/helper-validator-identifier" "^7.10.3" +"@babel/helper-function-name@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.10.4.tgz#d2d3b20c59ad8c47112fa7d2a94bc09d5ef82f1a" + integrity sha512-YdaSyz1n8gY44EmN7x44zBn9zQ1Ry2Y+3GTA+3vH6Mizke1Vw0aWDM66FOYEPw8//qKkmqOckrGgTYa+6sceqQ== + dependencies: + "@babel/helper-get-function-arity" "^7.10.4" + "@babel/template" "^7.10.4" + "@babel/types" "^7.10.4" + +"@babel/helper-get-function-arity@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.10.4.tgz#98c1cbea0e2332f33f9a4661b8ce1505b2c19ba2" + integrity sha512-EkN3YDB+SRDgiIUnNgcmiD361ti+AVbL3f3Henf6dqqUyr5dMsorno0lJWJuLhDhkI5sYEpgj6y9kB8AOU1I2A== + dependencies: + "@babel/types" "^7.10.4" + +"@babel/helper-member-expression-to-functions@^7.10.4": + version "7.10.5" + resolved "https://registry.yarnpkg.com/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.10.5.tgz#172f56e7a63e78112f3a04055f24365af702e7ee" + integrity sha512-HiqJpYD5+WopCXIAbQDG0zye5XYVvcO9w/DHp5GsaGkRUaamLj2bEtu6i8rnGGprAhHM3qidCMgp71HF4endhA== + dependencies: + "@babel/types" "^7.10.5" + +"@babel/helper-module-imports@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/helper-module-imports/-/helper-module-imports-7.10.4.tgz#4c5c54be04bd31670a7382797d75b9fa2e5b5620" + integrity sha512-nEQJHqYavI217oD9+s5MUBzk6x1IlvoS9WTPfgG43CbMEeStE0v+r+TucWdx8KFGowPGvyOkDT9+7DHedIDnVw== + dependencies: + "@babel/types" "^7.10.4" + +"@babel/helper-module-transforms@^7.10.5": + version "7.10.5" + resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.10.5.tgz#120c271c0b3353673fcdfd8c053db3c544a260d6" + integrity sha512-4P+CWMJ6/j1W915ITJaUkadLObmCRRSC234uctJfn/vHrsLNxsR8dwlcXv9ZhJWzl77awf+mWXSZEKt5t0OnlA== + dependencies: + "@babel/helper-module-imports" "^7.10.4" + "@babel/helper-replace-supers" "^7.10.4" + "@babel/helper-simple-access" "^7.10.4" + "@babel/helper-split-export-declaration" "^7.10.4" + "@babel/template" "^7.10.4" + "@babel/types" "^7.10.5" + lodash "^4.17.19" + +"@babel/helper-optimise-call-expression@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.10.4.tgz#50dc96413d594f995a77905905b05893cd779673" + integrity sha512-n3UGKY4VXwXThEiKrgRAoVPBMqeoPgHVqiHZOanAJCG9nQUL2pLRQirUzl0ioKclHGpGqRgIOkgcIJaIWLpygg== + dependencies: + "@babel/types" "^7.10.4" + +"@babel/helper-plugin-utils@^7.0.0", "@babel/helper-plugin-utils@^7.10.4", "@babel/helper-plugin-utils@^7.8.0": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/helper-plugin-utils/-/helper-plugin-utils-7.10.4.tgz#2f75a831269d4f677de49986dff59927533cf375" + integrity sha512-O4KCvQA6lLiMU9l2eawBPMf1xPP8xPfB3iEQw150hOVTqj/rfXz0ThTb4HEzqQfs2Bmo5Ay8BzxfzVtBrr9dVg== + +"@babel/helper-replace-supers@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/helper-replace-supers/-/helper-replace-supers-7.10.4.tgz#d585cd9388ea06e6031e4cd44b6713cbead9e6cf" + integrity sha512-sPxZfFXocEymYTdVK1UNmFPBN+Hv5mJkLPsYWwGBxZAxaWfFu+xqp7b6qWD0yjNuNL2VKc6L5M18tOXUP7NU0A== + dependencies: + "@babel/helper-member-expression-to-functions" "^7.10.4" + "@babel/helper-optimise-call-expression" "^7.10.4" + "@babel/traverse" "^7.10.4" + "@babel/types" "^7.10.4" + +"@babel/helper-simple-access@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/helper-simple-access/-/helper-simple-access-7.10.4.tgz#0f5ccda2945277a2a7a2d3a821e15395edcf3461" + integrity sha512-0fMy72ej/VEvF8ULmX6yb5MtHG4uH4Dbd6I/aHDb/JVg0bbivwt9Wg+h3uMvX+QSFtwr5MeItvazbrc4jtRAXw== + dependencies: + "@babel/template" "^7.10.4" + "@babel/types" "^7.10.4" + +"@babel/helper-split-export-declaration@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.10.4.tgz#2c70576eaa3b5609b24cb99db2888cc3fc4251d1" + integrity sha512-pySBTeoUff56fL5CBU2hWm9TesA4r/rOkI9DyJLvvgz09MB9YtfIYe3iBriVaYNaPe+Alua0vBIOVOLs2buWhg== + dependencies: + "@babel/types" "^7.10.4" + +"@babel/helper-validator-identifier@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz#a78c7a7251e01f616512d31b10adcf52ada5e0d2" + integrity sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw== + +"@babel/helpers@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.10.4.tgz#2abeb0d721aff7c0a97376b9e1f6f65d7a475044" + integrity sha512-L2gX/XeUONeEbI78dXSrJzGdz4GQ+ZTA/aazfUsFaWjSe95kiCuOZ5HsXvkiw3iwF+mFHSRUfJU8t6YavocdXA== + dependencies: + "@babel/template" "^7.10.4" + "@babel/traverse" "^7.10.4" + "@babel/types" "^7.10.4" + +"@babel/highlight@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.10.4.tgz#7d1bdfd65753538fabe6c38596cdb76d9ac60143" + integrity sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA== + dependencies: + "@babel/helper-validator-identifier" "^7.10.4" chalk "^2.0.0" js-tokens "^4.0.0" -"@babel/parser@^7.1.0", "@babel/parser@^7.10.3": - version "7.10.3" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.10.3.tgz#7e71d892b0d6e7d04a1af4c3c79d72c1f10f5315" - integrity sha512-oJtNJCMFdIMwXGmx+KxuaD7i3b8uS7TTFYW/FNG2BT8m+fmGHoiPYoH0Pe3gya07WuFmM5FCDIr1x0irkD/hyA== +"@babel/parser@^7.1.0", "@babel/parser@^7.10.4", "@babel/parser@^7.10.5": + version "7.10.5" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.10.5.tgz#e7c6bf5a7deff957cec9f04b551e2762909d826b" + integrity sha512-wfryxy4bE1UivvQKSQDU4/X6dr+i8bctjUjj8Zyt3DQy7NtPizJXT8M52nqpNKL+nq2PW8lxk4ZqLj0fD4B4hQ== "@babel/plugin-syntax-async-generators@^7.8.4": version "7.8.4" @@ -164,11 +163,11 @@ "@babel/helper-plugin-utils" "^7.8.0" "@babel/plugin-syntax-class-properties@^7.8.3": - version "7.10.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.10.1.tgz#d5bc0645913df5b17ad7eda0fa2308330bde34c5" - integrity sha512-Gf2Yx/iRs1JREDtVZ56OrjjgFHCaldpTnuy9BHla10qyVT3YkIIGEtoDWhyop0ksu1GvNjHIoYRBqm3zoR1jyQ== + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.10.4.tgz#6644e6a0baa55a61f9e3231f6c9eeb6ee46c124c" + integrity sha512-GCSBF7iUle6rNugfURwNmCGG3Z/2+opxAMLs1nND4bhEG5PuxTIggDBoeYYSujAlLtsupzOHYJQgPS3pivwXIA== dependencies: - "@babel/helper-plugin-utils" "^7.10.1" + "@babel/helper-plugin-utils" "^7.10.4" "@babel/plugin-syntax-dynamic-import@^7.8.3": version "7.8.3" @@ -178,11 +177,11 @@ "@babel/helper-plugin-utils" "^7.8.0" "@babel/plugin-syntax-import-meta@^7.8.3": - version "7.10.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.1.tgz#3e59120ed8b3c2ccc5abb1cfc7aaa3ea01cd36b6" - integrity sha512-ypC4jwfIVF72og0dgvEcFRdOM2V9Qm1tu7RGmdZOlhsccyK0wisXmMObGuWEOd5jQ+K9wcIgSNftCpk2vkjUfQ== + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz#ee601348c370fa334d2207be158777496521fd51" + integrity sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g== dependencies: - "@babel/helper-plugin-utils" "^7.10.1" + "@babel/helper-plugin-utils" "^7.10.4" "@babel/plugin-syntax-json-strings@^7.8.3": version "7.8.3" @@ -192,11 +191,11 @@ "@babel/helper-plugin-utils" "^7.8.0" "@babel/plugin-syntax-logical-assignment-operators@^7.8.3": - version "7.10.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.1.tgz#fffee77b4934ce77f3b427649ecdddbec1958550" - integrity sha512-XyHIFa9kdrgJS91CUH+ccPVTnJShr8nLGc5bG2IhGXv5p1Rd+8BleGE5yzIg2Nc1QZAdHDa0Qp4m6066OL96Iw== + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz#ca91ef46303530448b906652bac2e9fe9941f699" + integrity sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig== dependencies: - "@babel/helper-plugin-utils" "^7.10.1" + "@babel/helper-plugin-utils" "^7.10.4" "@babel/plugin-syntax-nullish-coalescing-operator@^7.8.3": version "7.8.3" @@ -206,11 +205,11 @@ "@babel/helper-plugin-utils" "^7.8.0" "@babel/plugin-syntax-numeric-separator@^7.8.3": - version "7.10.1" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.1.tgz#25761ee7410bc8cf97327ba741ee94e4a61b7d99" - integrity sha512-uTd0OsHrpe3tH5gRPTxG8Voh99/WCU78vIm5NMRYPAqC8lR4vajt6KkCAknCHrx24vkPdd/05yfdGSB4EIY2mg== + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz#b9b070b3e33570cd9fd07ba7fa91c0dd37b9af97" + integrity sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug== dependencies: - "@babel/helper-plugin-utils" "^7.10.1" + "@babel/helper-plugin-utils" "^7.10.4" "@babel/plugin-syntax-object-rest-spread@^7.8.3": version "7.8.3" @@ -233,37 +232,37 @@ dependencies: "@babel/helper-plugin-utils" "^7.8.0" -"@babel/template@^7.10.1", "@babel/template@^7.10.3", "@babel/template@^7.3.3": - version "7.10.3" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.10.3.tgz#4d13bc8e30bf95b0ce9d175d30306f42a2c9a7b8" - integrity sha512-5BjI4gdtD+9fHZUsaxPHPNpwa+xRkDO7c7JbhYn2afvrkDu5SfAAbi9AIMXw2xEhO/BR35TqiW97IqNvCo/GqA== - dependencies: - "@babel/code-frame" "^7.10.3" - "@babel/parser" "^7.10.3" - "@babel/types" "^7.10.3" - -"@babel/traverse@^7.1.0", "@babel/traverse@^7.10.1", "@babel/traverse@^7.10.3": - version "7.10.3" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.10.3.tgz#0b01731794aa7b77b214bcd96661f18281155d7e" - integrity sha512-qO6623eBFhuPm0TmmrUFMT1FulCmsSeJuVGhiLodk2raUDFhhTECLd9E9jC4LBIWziqt4wgF6KuXE4d+Jz9yug== - dependencies: - "@babel/code-frame" "^7.10.3" - "@babel/generator" "^7.10.3" - "@babel/helper-function-name" "^7.10.3" - "@babel/helper-split-export-declaration" "^7.10.1" - "@babel/parser" "^7.10.3" - "@babel/types" "^7.10.3" +"@babel/template@^7.10.4", "@babel/template@^7.3.3": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.10.4.tgz#3251996c4200ebc71d1a8fc405fba940f36ba278" + integrity sha512-ZCjD27cGJFUB6nmCB1Enki3r+L5kJveX9pq1SvAUKoICy6CZ9yD8xO086YXdYhvNjBdnekm4ZnaP5yC8Cs/1tA== + dependencies: + "@babel/code-frame" "^7.10.4" + "@babel/parser" "^7.10.4" + "@babel/types" "^7.10.4" + +"@babel/traverse@^7.1.0", "@babel/traverse@^7.10.4", "@babel/traverse@^7.10.5": + version "7.10.5" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.10.5.tgz#77ce464f5b258be265af618d8fddf0536f20b564" + integrity sha512-yc/fyv2gUjPqzTz0WHeRJH2pv7jA9kA7mBX2tXl/x5iOE81uaVPuGPtaYk7wmkx4b67mQ7NqI8rmT2pF47KYKQ== + dependencies: + "@babel/code-frame" "^7.10.4" + "@babel/generator" "^7.10.5" + "@babel/helper-function-name" "^7.10.4" + "@babel/helper-split-export-declaration" "^7.10.4" + "@babel/parser" "^7.10.5" + "@babel/types" "^7.10.5" debug "^4.1.0" globals "^11.1.0" - lodash "^4.17.13" + lodash "^4.17.19" -"@babel/types@^7.0.0", "@babel/types@^7.10.1", "@babel/types@^7.10.3", "@babel/types@^7.3.0", "@babel/types@^7.3.3": - version "7.10.3" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.10.3.tgz#6535e3b79fea86a6b09e012ea8528f935099de8e" - integrity sha512-nZxaJhBXBQ8HVoIcGsf9qWep3Oh3jCENK54V4mRF7qaJabVsAYdbTtmSD8WmAp1R6ytPiu5apMwSXyxB1WlaBA== +"@babel/types@^7.0.0", "@babel/types@^7.10.4", "@babel/types@^7.10.5", "@babel/types@^7.3.0", "@babel/types@^7.3.3": + version "7.10.5" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.10.5.tgz#d88ae7e2fde86bfbfe851d4d81afa70a997b5d15" + integrity sha512-ixV66KWfCI6GKoA/2H9v6bQdbfXEwwpOdQ8cRvb4F+eyvhlaHxWFMQB4+3d9QFJXZsiiiqVrewNV0DFEQpyT4Q== dependencies: - "@babel/helper-validator-identifier" "^7.10.3" - lodash "^4.17.13" + "@babel/helper-validator-identifier" "^7.10.4" + lodash "^4.17.19" to-fast-properties "^2.0.0" "@bcoe/v8-coverage@^0.2.3": @@ -510,9 +509,9 @@ picomatch "^2.2.2" "@sinonjs/commons@^1.7.0": - version "1.8.0" - resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.8.0.tgz#c8d68821a854c555bba172f3b06959a0039b236d" - integrity sha512-wEj54PfsZ5jGSwMX68G8ZXFawcSglQSXqCftWX3ec8MDUzQdHgcKvw97awHbY0efQEL5iKUOAmmVtoYgmrSG4Q== + version "1.8.1" + resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.8.1.tgz#e7df00f98a203324f6dc7cc606cad9d4a8ab2217" + integrity sha512-892K+kWUUi3cl+LlqEWIDrhvLgdL79tECi8JZUyq6IviKy/DNhuzCRlbHUjxK89f4ypPMMaFnFuR9Ie6DoIMsw== dependencies: type-detect "4.0.8" @@ -543,9 +542,9 @@ "@babel/types" "^7.0.0" "@types/babel__traverse@*", "@types/babel__traverse@^7.0.6": - version "7.0.12" - resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.0.12.tgz#22f49a028e69465390f87bb103ebd61bd086b8f5" - integrity sha512-t4CoEokHTfcyfb4hUaF9oOHu9RmmNWnm1CP0YmMqOOfClKascOmvlEM736vlqeScuGvBDsHkf8R2INd4DWreQA== + version "7.0.13" + resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.0.13.tgz#1874914be974a492e1b4cb00585cabb274e8ba18" + integrity sha512-i+zS7t6/s9cdQvbqKDARrcbrPvtJGlbYsMkazo03nTAK3RX9FNrLllXys22uiTGJapPOTZTQ35nHh4ISph4SLQ== dependencies: "@babel/types" "^7.3.0" @@ -559,16 +558,16 @@ resolved "https://registry.yarnpkg.com/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#1ee30d79544ca84d68d4b3cdb0af4f205663dd2d" integrity sha512-OCutwjDZ4aFS6PB1UZ988C4YgwlBHJd6wCeQqaLdmadZ/7e+w79+hbMUFC1QXDNCmdyoRfAFdm0RypzwR+Qpag== +"@types/estree@*": + version "0.0.45" + resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.45.tgz#e9387572998e5ecdac221950dab3e8c3b16af884" + integrity sha512-jnqIUKDUqJbDIUxm0Uj7bnlMnRm1T/eZ9N+AVMqhPgzrba2GhGG5o/jCTwmdPK709nEZsGoMzXEDUjcXHa3W0g== + "@types/estree@0.0.39": version "0.0.39" resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f" integrity sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw== -"@types/estree@0.0.44": - version "0.0.44" - resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.44.tgz#980cc5a29a3ef3bea6ff1f7d021047d7ea575e21" - integrity sha512-iaIVzr+w2ZJ5HkidlZ3EJM8VTZb2MJLCjw3V+505yVts0gRC4UMvjw0d1HPtGqI/HQC/KdsYtayfzl+AXY2R8g== - "@types/graceful-fs@^4.1.2": version "4.1.3" resolved "https://registry.yarnpkg.com/@types/graceful-fs/-/graceful-fs-4.1.3.tgz#039af35fe26bec35003e8d86d2ee9c586354348f" @@ -610,9 +609,9 @@ integrity sha512-7+2BITlgjgDhH0vvwZU/HZJVyk+2XUlvxXe8dFMedNX/aMkaOq++rMAFXc0tM7ij15QaWlbdQASBR9dihi+bDQ== "@types/node@*": - version "14.0.13" - resolved "https://registry.yarnpkg.com/@types/node/-/node-14.0.13.tgz#ee1128e881b874c371374c1f72201893616417c9" - integrity sha512-rouEWBImiRaSJsVA+ITTFM6ZxibuAlTuNOCyxVbwreu6k6+ujs7DfnU9o+PShFhET78pMBl3eH+AGSI5eOTkPA== + version "14.0.26" + resolved "https://registry.yarnpkg.com/@types/node/-/node-14.0.26.tgz#22a3b8a46510da8944b67bfc27df02c34a35331c" + integrity sha512-W+fpe5s91FBGE0pEa0lnqGLL4USgpLgs4nokw16SrBBco/gQxuua7KnArSEOd5iaMqbbSHV10vUDkJYJJqpXKA== "@types/normalize-package-data@^2.4.0": version "2.4.0" @@ -753,9 +752,9 @@ ajv@6.5.3: uri-js "^4.2.2" ajv@^6.10.0, ajv@^6.10.2, ajv@^6.5.5: - version "6.12.2" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.2.tgz#c629c5eced17baf314437918d2da88c99d5958cd" - integrity sha512-k+V+hzjm5q/Mr8ef/1Y9goCmlsK4I6Sm74teeyGvFk1XrOsbsKLjEdrvny42CZ+a8sXbk8KWpY/bDwS+FLL2UQ== + version "6.12.3" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.3.tgz#18c5af38a111ddeb4f2697bd78d68abc1cabd706" + integrity sha512-4K0cK3L1hsqk9xIb2z9vs/XU+PGJZ9PNpJRDS9YLzmNdX6jmVPfamLvTJr0aDAusnHyCHO6MjzlkAsgtqp9teA== dependencies: fast-deep-equal "^3.1.1" fast-json-stable-stringify "^2.0.0" @@ -1342,6 +1341,14 @@ chalk@^3.0.0: ansi-styles "^4.1.0" supports-color "^7.1.0" +chalk@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.0.tgz#4e14870a618d9e2edd97dd8345fd9d9dc315646a" + integrity sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A== + dependencies: + ansi-styles "^4.1.0" + supports-color "^7.1.0" + chardet@^0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e" @@ -1374,10 +1381,10 @@ cli-cursor@^3.1.0: dependencies: restore-cursor "^3.1.0" -cli-width@^2.0.0: - version "2.2.1" - resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-2.2.1.tgz#b0433d0b4e9c847ef18868a4ef16fd5fc8271c48" - integrity sha512-GRMWDxpOB6Dgk2E5Uo+3eEBvtOOlimMmpbFiKuLFnQzYDavtLFY3K5ona41jgN/WdRZtG7utuVSVTL4HbZHGkw== +cli-width@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-3.0.0.tgz#a2f48437a2caa9a22436e794bf071ec9e61cedf6" + integrity sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw== clipboardy@1.2.3: version "1.2.3" @@ -1692,9 +1699,9 @@ escape-string-regexp@^1.0.5: integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= escodegen@^1.11.1: - version "1.14.2" - resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.14.2.tgz#14ab71bf5026c2aa08173afba22c6f3173284a84" - integrity sha512-InuOIiKk8wwuOFg6x9BQXbzjrQhtyXh46K9bqVTPzSo2FnyMBaYGBMC6PhQy7yxxil9vIedFBweQBMK74/7o8A== + version "1.14.3" + resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.14.3.tgz#4e7b81fba61581dc97582ed78cab7f0e8d63f503" + integrity sha512-qFcX0XJkdg+PB3xjZZG/wKSuT1PnQWx57+TVSjIMmILd2yC/6ByYElPwJnslDsuWuSAp4AwJGumarAAmJch5Kw== dependencies: esprima "^4.0.1" estraverse "^4.2.0" @@ -2358,20 +2365,20 @@ ini@~1.3.0: integrity sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw== inquirer@^7.0.0: - version "7.2.0" - resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-7.2.0.tgz#63ce99d823090de7eb420e4bb05e6f3449aa389a" - integrity sha512-E0c4rPwr9ByePfNlTIB8z51kK1s2n6jrHuJeEHENl/sbq2G/S1auvibgEwNR4uSyiU+PiYHqSwsgGiXjG8p5ZQ== + version "7.3.3" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-7.3.3.tgz#04d176b2af04afc157a83fd7c100e98ee0aad003" + integrity sha512-JG3eIAj5V9CwcGvuOmoo6LB9kbAYT8HXffUl6memuszlwDC/qvFAJw49XJ5NROSFNPxp3iQg1GqkFhaY/CR0IA== dependencies: ansi-escapes "^4.2.1" - chalk "^3.0.0" + chalk "^4.1.0" cli-cursor "^3.1.0" - cli-width "^2.0.0" + cli-width "^3.0.0" external-editor "^3.0.3" figures "^3.0.0" - lodash "^4.17.15" + lodash "^4.17.19" mute-stream "0.0.8" run-async "^2.4.0" - rxjs "^6.5.3" + rxjs "^6.6.0" string-width "^4.1.0" strip-ansi "^6.0.0" through "^2.3.6" @@ -2513,11 +2520,11 @@ is-plain-object@^2.0.3, is-plain-object@^2.0.4: isobject "^3.0.1" is-reference@^1.1.2: - version "1.2.0" - resolved "https://registry.yarnpkg.com/is-reference/-/is-reference-1.2.0.tgz#d938b0cf85a0df09849417b274f02fb509293599" - integrity sha512-ZVxq+5TkOx6GQdnoMm2aRdCKADdcrOWXLGzGT+vIA8DMpqEJaRk5AL1bS80zJ2bjHunVmjdzfCt0e4BymIEqKQ== + version "1.2.1" + resolved "https://registry.yarnpkg.com/is-reference/-/is-reference-1.2.1.tgz#8b2dac0b371f4bc994fdeaba9eb542d03002d0b7" + integrity sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ== dependencies: - "@types/estree" "0.0.44" + "@types/estree" "*" is-stream@^1.1.0: version "1.1.0" @@ -2808,9 +2815,9 @@ jest-mock@^25.5.0: "@jest/types" "^25.5.0" jest-pnp-resolver@^1.2.1: - version "1.2.1" - resolved "https://registry.yarnpkg.com/jest-pnp-resolver/-/jest-pnp-resolver-1.2.1.tgz#ecdae604c077a7fbc70defb6d517c3c1c898923a" - integrity sha512-pgFw2tm54fzgYvc/OHrnysABEObZCUNFnhjoRjaVOCN8NYc032/gVjPaHD4Aq6ApkSieWtfKAFQtmDKAmhupnQ== + version "1.2.2" + resolved "https://registry.yarnpkg.com/jest-pnp-resolver/-/jest-pnp-resolver-1.2.2.tgz#b704ac0ae028a89108a4d040b3f919dfddc8e33c" + integrity sha512-olV41bKSMm8BdnuMsewT4jqlZ8+3TCARAXjZGT9jcoSnrfUnRCqnMoF9XEeoWjbzObpqF9dRhHQj0Xb9QdF6/w== jest-regex-util@^25.2.6: version "25.2.6" @@ -3146,7 +3153,7 @@ lodash.sortby@^4.7.0: resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438" integrity sha1-7dFMgk4sycHgsKG0K7UhBRakJDg= -lodash@^4.17.11, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15: +lodash@^4.17.11, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19: version "4.17.19" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.19.tgz#e48ddedbe30b3321783c5b4301fbd353bc1e4a4b" integrity sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ== @@ -3507,9 +3514,9 @@ parent-module@^1.0.0: callsites "^3.0.0" parse-json@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-5.0.0.tgz#73e5114c986d143efa3712d4ea24db9a4266f60f" - integrity sha512-OOY5b7PAEFV0E2Fir1KOkxchnZNCdowAJgQ5NuxjpBKTRP3pQhwkrkxqQjeoKJ+fO7bCpmIZaogI4eZGDMEGOw== + version "5.0.1" + resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-5.0.1.tgz#7cfe35c1ccd641bce3981467e6c2ece61b3b3878" + integrity sha512-ztoZ4/DYeXQq4E21v169sC8qWINGpcosGv9XhTDvg9/hWvx/zrFkc9BiWxR58OJLHGk28j5BL0SDLeV2WmFZlQ== dependencies: "@babel/code-frame" "^7.0.0" error-ex "^1.3.1" @@ -3760,19 +3767,19 @@ repeat-string@^1.6.1: resolved "https://registry.yarnpkg.com/repeat-string/-/repeat-string-1.6.1.tgz#8dcae470e1c88abc2d600fff4a776286da75e637" integrity sha1-jcrkcOHIirwtYA//Sndihtp15jc= -request-promise-core@1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/request-promise-core/-/request-promise-core-1.1.3.tgz#e9a3c081b51380dfea677336061fea879a829ee9" - integrity sha512-QIs2+ArIGQVp5ZYbWD5ZLCY29D5CfWizP8eWnm8FoGD1TX61veauETVQbrV60662V0oFBkrDOuaBI8XgtuyYAQ== +request-promise-core@1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/request-promise-core/-/request-promise-core-1.1.4.tgz#3eedd4223208d419867b78ce815167d10593a22f" + integrity sha512-TTbAfBBRdWD7aNNOoVOBH4pN/KigV6LyapYNNlAPA8JwbovRti1E88m3sYAwsLi5ryhPKsE9APwnjFTgdUjTpw== dependencies: - lodash "^4.17.15" + lodash "^4.17.19" request-promise-native@^1.0.7: - version "1.0.8" - resolved "https://registry.yarnpkg.com/request-promise-native/-/request-promise-native-1.0.8.tgz#a455b960b826e44e2bf8999af64dff2bfe58cb36" - integrity sha512-dapwLGqkHtwL5AEbfenuzjTYg35Jd6KPytsC2/TLkVMz8rm+tNt72MGUWT1RP/aYawMpN6HqbNGBQaRcBtjQMQ== + version "1.0.9" + resolved "https://registry.yarnpkg.com/request-promise-native/-/request-promise-native-1.0.9.tgz#e407120526a5efdc9a39b28a5679bf47b9d9dc28" + integrity sha512-wcW+sIUiWnKgNY0dqCpOZkUbF/I+YPi+f09JZIDa39Ec+q82CpSYniDp+ISgTTbKmnpJWASeJBPZmoxH84wt3g== dependencies: - request-promise-core "1.1.3" + request-promise-core "1.1.4" stealthy-require "^1.1.1" tough-cookie "^2.3.3" @@ -3903,9 +3910,9 @@ rollup-plugin-typescript2@^0.27.0: tslib "1.11.2" rollup@^2.6.1: - version "2.17.1" - resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.17.1.tgz#d01a27c1b76e42efe2cd786609589f6332e81aa6" - integrity sha512-lVrtCXJ+08Eapa0SfApLmRNWNWm2FsYFnLPIJZJvZz2uI2Gv+dfPyu1zgF7KKF/HYFJDvjxbdCbI8lUVMnG7Sg== + version "2.23.0" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.23.0.tgz#b7ab1fee0c0e60132fd0553c4df1e9cdacfada9d" + integrity sha512-vLNmZFUGVwrnqNAJ/BvuLk1MtWzu4IuoqsH9UWK5AIdO3rt8/CSiJNvPvCIvfzrbNsqKbNzPAG1V2O4eTe2XZg== optionalDependencies: fsevents "~2.1.2" @@ -3919,10 +3926,10 @@ run-async@^2.4.0: resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.4.1.tgz#8440eccf99ea3e70bd409d49aab88e10c189a455" integrity sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ== -rxjs@^6.5.3: - version "6.5.5" - resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.5.5.tgz#c5c884e3094c8cfee31bf27eb87e54ccfc87f9ec" - integrity sha512-WfQI+1gohdf0Dai/Bbmk5L5ItH5tYqm3ki2c5GdWhKjalzjg93N3avFjVStyZZz+A2Em+ZxKH5bNghw9UeylGQ== +rxjs@^6.6.0: + version "6.6.0" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.6.0.tgz#af2901eedf02e3a83ffa7f886240ff9018bbec84" + integrity sha512-3HMA8z/Oz61DUHe+SdOiQyzIf4tOx5oQHmMir7IZEu6TMqCLHT4LRcmNaUS0NwOz8VLvmmBduMsoaUvMaIiqzg== dependencies: tslib "^1.9.0" @@ -4112,10 +4119,10 @@ snapdragon@^0.8.1: source-map-resolve "^0.5.0" use "^3.1.0" -sora-e2ee@^2020.1.0: - version "2020.1.0" - resolved "https://registry.yarnpkg.com/sora-e2ee/-/sora-e2ee-2020.1.0.tgz#88393618a68d55f944969738da395a984fc6e215" - integrity sha512-4X7PR4DU3mTbhpk9d0RTWN5Kav42VRNlHU4GsEZTHfQkH/LEdDFS+8WE3wnPkvw8dAgpLCGC08sW4KTFw+jBJg== +sora-e2ee@^2020.2.0: + version "2020.2.0" + resolved "https://registry.yarnpkg.com/sora-e2ee/-/sora-e2ee-2020.2.0.tgz#332ec78f1bce0b3cf843edfe0bf460ce1deba168" + integrity sha512-beP2iXJphHxyTQ1ngYg4b+KlOH4RHhWdWxixsR57KXD9ZHggNhlDSCw0ydw5RtkDL8rbrxM043Qgcq3XVgeLDQ== source-map-resolve@^0.5.0: version "0.5.3" @@ -4303,9 +4310,9 @@ strip-final-newline@^2.0.0: integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA== strip-json-comments@^3.0.1: - version "3.1.0" - resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.0.tgz#7638d31422129ecf4457440009fba03f9f9ac180" - integrity sha512-e6/d0eBu7gHtdCqFt0xJr642LdToM5/cN4Qb9DbHjVx1CP5RyeM+zH7pbecEmDv/lBqb0QH+6Uqq75rxFPkM0w== + version "3.1.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006" + integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig== strip-json-comments@~2.0.1: version "2.0.1" @@ -4541,9 +4548,9 @@ typedarray-to-buffer@^3.1.5: is-typedarray "^1.0.0" typescript@^3.8.3: - version "3.9.5" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.5.tgz#586f0dba300cde8be52dd1ac4f7e1009c1b13f36" - integrity sha512-hSAifV3k+i6lEoCJ2k6R2Z/rp/H3+8sdmcn5NrS3/3kE7+RyZXm9aqvxWqjEXHAd8b0pShatpcdMTvEdvAJltQ== + version "3.9.7" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.9.7.tgz#98d600a5ebdc38f40cb277522f12dc800e9e25fa" + integrity sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw== union-value@^1.0.0: version "1.0.1" @@ -4746,9 +4753,9 @@ write@1.0.3: mkdirp "^0.5.1" ws@^7.0.0: - version "7.3.0" - resolved "https://registry.yarnpkg.com/ws/-/ws-7.3.0.tgz#4b2f7f219b3d3737bc1a2fbf145d825b94d38ffd" - integrity sha512-iFtXzngZVXPGgpTlP1rBqsUK82p9tKqsWRPg5L56egiljujJT3vGAYnHANvFxBieXrTFavhzhxW52jnaWV+w2w== + version "7.3.1" + resolved "https://registry.yarnpkg.com/ws/-/ws-7.3.1.tgz#d0547bf67f7ce4f12a72dfe31262c68d7dc551c8" + integrity sha512-D3RuNkynyHmEJIpD2qrgVkc9DQ23OrN/moAwZX4L8DfvszsJxpjQuUq3LMx6HoYji9fbIOBY18XWBsAux1ZZUA== xml-name-validator@^3.0.0: version "3.0.0" @@ -4770,7 +4777,7 @@ yallist@^2.1.2: resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" integrity sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI= -yargs-parser@18.x, yargs-parser@^18.1.1: +yargs-parser@18.x, yargs-parser@^18.1.2: version "18.1.3" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-18.1.3.tgz#be68c4975c6b2abf469236b0c870362fab09a7b0" integrity sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ== @@ -4779,9 +4786,9 @@ yargs-parser@18.x, yargs-parser@^18.1.1: decamelize "^1.2.0" yargs@^15.3.1: - version "15.3.1" - resolved "https://registry.yarnpkg.com/yargs/-/yargs-15.3.1.tgz#9505b472763963e54afe60148ad27a330818e98b" - integrity sha512-92O1HWEjw27sBfgmXiixJWT5hRBp2eobqXicLtPBIDBhYB+1HpwZlXmbW2luivBJHBzki+7VyCLRtAkScbTBQA== + version "15.4.1" + resolved "https://registry.yarnpkg.com/yargs/-/yargs-15.4.1.tgz#0d87a16de01aee9d8bec2bfbf74f67851730f4f8" + integrity sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A== dependencies: cliui "^6.0.0" decamelize "^1.2.0" @@ -4793,4 +4800,4 @@ yargs@^15.3.1: string-width "^4.2.0" which-module "^2.0.0" y18n "^4.0.0" - yargs-parser "^18.1.1" + yargs-parser "^18.1.2" From ed4bec32f8dae9aeec7aa5f9bad05d8b727c52d7 Mon Sep 17 00:00:00 2001 From: NAKAI Ryosuke Date: Sat, 25 Jul 2020 18:11:00 +0900 Subject: [PATCH 03/18] =?UTF-8?q?=E5=A4=89=E6=9B=B4=E5=B1=A5=E6=AD=B4?= =?UTF-8?q?=E3=82=92=E6=9B=B4=E6=96=B0=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGES.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 852bf2e6..2b825c32 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -11,6 +11,9 @@ ## develop +- [UPDATE] sora-e2ee を 2020.2.0 に上げる + - @voluntas + ## 2020.1.5 - [FIX] metadata が undefined の場合以外は signaling connect message に metadata を含めるように変更 From d1a4d9b24fc7d65974cfd0aa55a1bfdee6a00cc3 Mon Sep 17 00:00:00 2001 From: NAKAI Ryosuke Date: Sat, 25 Jul 2020 18:27:43 +0900 Subject: [PATCH 04/18] =?UTF-8?q?forceEncodedVideoInsertableStreams=20?= =?UTF-8?q?=E3=81=A8=20forceEncodedAudioInsertableStreams=20=E3=81=8C=20de?= =?UTF-8?q?precated=20=E3=81=AB=E3=81=AA=E3=81=A3=E3=81=9F=E3=81=AE?= =?UTF-8?q?=E3=81=A7=20encodedInsertableStreams=20=E3=81=AB=E5=A4=89?= =?UTF-8?q?=E6=9B=B4=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/base.ts b/src/base.ts index 0f74808b..b06ab48f 100644 --- a/src/base.ts +++ b/src/base.ts @@ -254,9 +254,8 @@ export default class ConnectionBase { let config = messageConfig; if (this.e2ee) { // @ts-ignore - config["forceEncodedVideoInsertableStreams"] = true; - // @ts-ignore - config["forceEncodedAudioInsertableStreams"] = true; + encodedInsertableStreams + config["encodedInsertableStreams"] = true; } if (window.RTCPeerConnection.generateCertificate !== undefined) { const certificate = await window.RTCPeerConnection.generateCertificate({ name: "ECDSA", namedCurve: "P-256" }); From a52eb1c97b6b9bb36baf5072e53689750ffa8079 Mon Sep 17 00:00:00 2001 From: NAKAI Ryosuke Date: Sat, 25 Jul 2020 18:29:03 +0900 Subject: [PATCH 05/18] =?UTF-8?q?=E6=B6=88=E3=81=99=E5=BF=98=E3=82=8C?= =?UTF-8?q?=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/base.ts b/src/base.ts index b06ab48f..1dc57059 100644 --- a/src/base.ts +++ b/src/base.ts @@ -254,7 +254,6 @@ export default class ConnectionBase { let config = messageConfig; if (this.e2ee) { // @ts-ignore - encodedInsertableStreams config["encodedInsertableStreams"] = true; } if (window.RTCPeerConnection.generateCertificate !== undefined) { From 3e85b102fde4998c2943c0b4fe1af17ff5c45a8f Mon Sep 17 00:00:00 2001 From: NAKAI Ryosuke Date: Sat, 25 Jul 2020 18:29:25 +0900 Subject: [PATCH 06/18] =?UTF-8?q?=E9=96=8B=E7=99=BA=E7=89=88=E3=81=AE?= =?UTF-8?q?=E6=88=90=E6=9E=9C=E7=89=A9=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/sora.js | 10 ++++------ dist/sora.min.js | 2 +- dist/sora.min.js.map | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/dist/sora.js b/dist/sora.js index 5aef0327..95f605dd 100644 --- a/dist/sora.js +++ b/dist/sora.js @@ -9,7 +9,7 @@ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : - (global = global || self, global.Sora = factory()); + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Sora = factory()); }(this, (function () { 'use strict'; function browser() { @@ -277,10 +277,10 @@ /** * sora-e2ee * WebRTC SFU Sora JavaScript E2EE Library - * @version: 2020.1.0 + * @version: 2020.2.0 * @author: Shiguredo Inc. * @license: Apache-2.0 - **/(function(a,b){module.exports=b();})(commonjsGlobal,function(){return class a{constructor(a){const b=!!RTCRtpSender.prototype.createEncodedVideoStreams;if(!b)throw new Error("E2EE is not supported in this browser");this.worker=null,this.masterKey=new TextEncoder().encode(a),this.onWorkerDisconnect=null;}startWorker(){const a=atob("bGV0IG1hc3RlcktleSxtYXRlcmlhbDtjb25zdCBkZXJpdmVLZXlNYXA9bmV3IE1hcCxzZXFOdW1NYXA9bmV3IE1hcCx3cml0ZUlWTWFwPW5ldyBNYXAsc2VxTnVtTGVuZ3RoPTQsc3NyY0xlbmd0aD00LHBhZGRpbmdMZW5ndGg9OCx1bmVuY3J5cHRlZEJ5dGVzPXtrZXk6MTAsZGVsdGE6Myx1bmRlZmluZWQ6MX07ZnVuY3Rpb24gZ2V0U2VxTnVtKGEpe3JldHVybiBzZXFOdW1NYXAuZ2V0KGEpfHwwfWZ1bmN0aW9uIHNldFNlcU51bShhLGIpe3NlcU51bU1hcC5zZXQoYSxiKX1hc3luYyBmdW5jdGlvbiBnZW5lcmF0ZURlcml2ZUtleShhLGIpe2xldCBjPWRlcml2ZUtleU1hcC5nZXQoYSk7cmV0dXJuIGN8fChjPWF3YWl0IGNyeXB0by5zdWJ0bGUuZGVyaXZlS2V5KHtuYW1lOiJQQktERjIiLHNhbHQ6YixpdGVyYXRpb25zOjFlNCxoYXNoOiJTSEEtMjU2In0sbWF0ZXJpYWwse25hbWU6IkFFUy1HQ00iLGxlbmd0aDoxMjh9LCExLFsiZW5jcnlwdCIsImRlY3J5cHQiXSksZGVyaXZlS2V5TWFwLnNldChhLGMpKSxjfWFzeW5jIGZ1bmN0aW9uIGdlbmVyYXRlSVYoYSxiLGMpe2xldCBkPXdyaXRlSVZNYXAuZ2V0KGEpO2lmKCFkKXtjb25zdCBjPWF3YWl0IGNyeXB0by5zdWJ0bGUuZGVyaXZlQml0cyh7bmFtZToiU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mV3IFRyYW5zZm9ybVN0cmVhbSh7dHJhbnNmb3JtOmVuY3J5cHRGdW5jdGlvbn0pO2IucGlwZVRocm91Z2goZCkucGlwZVRvKGMpfWVsc2UgaWYoImRlY3J5cHQiPT09Yil7Y29uc3R7cmVhZGFibGVTdHJlYW06Yix3cml0YWJsZVN0cmVhbTpjfT1hLmRhdGEsZD1uZXcgVHJhbnNmb3JtU3RyZWFtKHt0cmFuc2Zvcm06ZGVjcnlwdEZ1bmN0aW9ufSk7Yi5waXBlVGhyb3VnaChkKS5waXBlVG8oYyl9ZWxzZSJzZXRLZXkiPT09Yj8obWFzdGVyS2V5PWEuZGF0YS5tYXN0ZXJLZXksbWF0ZXJpYWw9YXdhaXQgY3J5cHRvLnN1YnRsZS5pbXBvcnRLZXkoInJhdyIsbWFzdGVyS2V5LCJQQktERjIiLCExLFsiZGVyaXZlQml0cyIsImRlcml2ZUtleSJdKSk6ImNsZWFyIj09PWImJihkZXJpdmVLZXlNYXAuY2xlYXIoKSxzZXFOdW1NYXAuY2xlYXIoKSx3cml0ZUlWTWFwLmNsZWFyKCkpfTsK");this.worker=new Worker(URL.createObjectURL(new Blob([a],{type:"application/javascript"}))),this.worker.onmessage=a=>{const{operation:b}=a.data;"disconnect"===b&&"function"==typeof this.onWorkerDisconnect&&this.onWorkerDisconnect();},this.worker.postMessage({operation:"setKey",masterKey:this.masterKey});}terminateWorker(){this.worker&&this.worker.terminate();}setupSenderTransform(a){if(a.track){const b="video"===a.track.kind?a.createEncodedVideoStreams():a.createEncodedAudioStreams();this.worker&&this.worker.postMessage({operation:"encrypt",readableStream:b.readableStream,writableStream:b.writableStream},[b.readableStream,b.writableStream]);}}setupReceiverTransform(a){const b="video"===a.track.kind?a.createEncodedVideoStreams():a.createEncodedAudioStreams();this.worker&&this.worker.postMessage({operation:"decrypt",readableStream:b.readableStream,writableStream:b.writableStream},[b.readableStream,b.writableStream]);}static version(){return "2020.1.0"}}}); + **/(function(a,b){module.exports=b();})(commonjsGlobal,function(){return class a{constructor(a){const b=!!RTCRtpSender.prototype.createEncodedStreams;if(!b)throw new Error("E2EE is not supported in this browser");this.worker=null,this.masterKey=new TextEncoder().encode(a),this.onWorkerDisconnect=null;}startWorker(){const a=atob("bGV0IG1hc3RlcktleSxtYXRlcmlhbDtjb25zdCBkZXJpdmVLZXlNYXA9bmV3IE1hcCxzZXFOdW1NYXA9bmV3IE1hcCx3cml0ZUlWTWFwPW5ldyBNYXAsc2VxTnVtTGVuZ3RoPTQsc3NyY0xlbmd0aD00LHBhZGRpbmdMZW5ndGg9OCx1bmVuY3J5cHRlZEJ5dGVzPXtrZXk6MTAsZGVsdGE6Myx1bmRlZmluZWQ6MX07ZnVuY3Rpb24gZ2V0U2VxTnVtKGEpe3JldHVybiBzZXFOdW1NYXAuZ2V0KGEpfHwwfWZ1bmN0aW9uIHNldFNlcU51bShhLGIpe3NlcU51bU1hcC5zZXQoYSxiKX1hc3luYyBmdW5jdGlvbiBnZW5lcmF0ZURlcml2ZUtleShhLGIpe2xldCBjPWRlcml2ZUtleU1hcC5nZXQoYSk7cmV0dXJuIGN8fChjPWF3YWl0IGNyeXB0by5zdWJ0bGUuZGVyaXZlS2V5KHtuYW1lOiJQQktERjIiLHNhbHQ6YixpdGVyYXRpb25zOjFlNCxoYXNoOiJTSEEtMjU2In0sbWF0ZXJpYWwse25hbWU6IkFFUy1HQ00iLGxlbmd0aDoxMjh9LCExLFsiZW5jcnlwdCIsImRlY3J5cHQiXSksZGVyaXZlS2V5TWFwLnNldChhLGMpKSxjfWFzeW5jIGZ1bmN0aW9uIGdlbmVyYXRlSVYoYSxiLGMpe2xldCBkPXdyaXRlSVZNYXAuZ2V0KGEpO2lmKCFkKXtjb25zdCBjPWF3YWl0IGNyeXB0by5zdWJ0bGUuZGVyaXZlQml0cyh7bmFtZToiUEJLREYyIixzYWx0OmIsaXRlcmF0aW9uczoxZTQsaGFzaDp7bmFtZToiU0hBLTM4NCJ9fSxtYXRlcmlhbCw5Nik7ZD1uZ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vKGMpfWVsc2UgaWYoImRlY3J5cHQiPT09Yil7Y29uc3R7cmVhZGFibGVTdHJlYW06Yix3cml0YWJsZVN0cmVhbTpjfT1hLmRhdGEsZD1uZXcgVHJhbnNmb3JtU3RyZWFtKHt0cmFuc2Zvcm06ZGVjcnlwdEZ1bmN0aW9ufSk7Yi5waXBlVGhyb3VnaChkKS5waXBlVG8oYyl9ZWxzZSJzZXRLZXkiPT09Yj8obWFzdGVyS2V5PWEuZGF0YS5tYXN0ZXJLZXksbWF0ZXJpYWw9YXdhaXQgY3J5cHRvLnN1YnRsZS5pbXBvcnRLZXkoInJhdyIsbWFzdGVyS2V5LCJQQktERjIiLCExLFsiZGVyaXZlQml0cyIsImRlcml2ZUtleSJdKSk6ImNsZWFyIj09PWImJihkZXJpdmVLZXlNYXAuY2xlYXIoKSxzZXFOdW1NYXAuY2xlYXIoKSx3cml0ZUlWTWFwLmNsZWFyKCkpfTsK");this.worker=new Worker(URL.createObjectURL(new Blob([a],{type:"application/javascript"}))),this.worker.onmessage=a=>{const{operation:b}=a.data;"disconnect"===b&&"function"==typeof this.onWorkerDisconnect&&this.onWorkerDisconnect();},this.worker.postMessage({operation:"setKey",masterKey:this.masterKey});}terminateWorker(){this.worker&&this.worker.terminate();}setupSenderTransform(a){if(a.track){const b=a.createEncodedStreams();this.worker&&this.worker.postMessage({operation:"encrypt",readableStream:b.readableStream,writableStream:b.writableStream},[b.readableStream,b.writableStream]);}}setupReceiverTransform(a){const b=a.createEncodedStreams();this.worker&&this.worker.postMessage({operation:"decrypt",readableStream:b.readableStream,writableStream:b.writableStream},[b.readableStream,b.writableStream]);}static version(){return "2020.2.0"}}}); }); @@ -492,9 +492,7 @@ let config = messageConfig; if (this.e2ee) { // @ts-ignore - config["forceEncodedVideoInsertableStreams"] = true; - // @ts-ignore - config["forceEncodedAudioInsertableStreams"] = true; + config["encodedInsertableStreams"] = true; } if (window.RTCPeerConnection.generateCertificate !== undefined) { const certificate = await window.RTCPeerConnection.generateCertificate({ name: "ECDSA", namedCurve: "P-256" }); diff --git a/dist/sora.min.js b/dist/sora.min.js index e213decd..d8f645af 100644 --- a/dist/sora.min.js +++ b/dist/sora.min.js @@ -4,5 +4,5 @@ * @version: 2020.1.5-dev * @author: Shiguredo Inc. * @license: Apache-2.0 - **/(function(a,b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):(a=a||self,a.Sora=b())})(this,function(){'use strict';function a(){const a=window.navigator.userAgent.toLocaleLowerCase();if(-1!==a.indexOf("edge"))return"edge";return-1!==a.indexOf("chrome")&&-1===a.indexOf("edge")?"chrome":-1!==a.indexOf("safari")&&-1===a.indexOf("chrome")?"safari":-1===a.indexOf("opera")?-1===a.indexOf("firefox")?null:"firefox":"opera"}function b(b,c){if("boolean"!=typeof c&&"VP9"===c.codec_type)return!1;if(("upstream"===b||"sendrecv"===b||"sendonly"===b)&&"firefox"===a())return!1;if(("upstream"===b||"sendrecv"===b||"sendonly"===b)&&"safari"===a())return!1;if(("downstream"===b||"recvonly"===b)&&"safari"===a()){const a=window.navigator.appVersion.toLowerCase(),b=/version\/([\d.]+)/.exec(a);if(!b)return!1;const d=b.pop();return!!(d&&12{"audio"===a&&"boolean"==typeof k[a]||"video"===a&&"boolean"==typeof k[a]||0<=h.indexOf(a)&&null!==k[a]||0<=i.indexOf(a)&&null!==k[a]||0<=j.indexOf(a)&&null!==k[a]||delete k[a]}),void 0!==k.audio&&(g.audio=k.audio);const l=Object.keys(k).some(a=>0<=h.indexOf(a));g.audio&&l&&(g.audio={},"audioCodecType"in k&&(g.audio.codec_type=k.audioCodecType),"audioBitRate"in k&&(g.audio.bit_rate=k.audioBitRate));const m=Object.keys(k).some(a=>0<=i.indexOf(a));g.audio&&m&&("object"!=typeof g.audio&&(g.audio={}),g.audio.opus_params={},"audioOpusParamsChannels"in k&&(g.audio.opus_params.channels=k.audioOpusParamsChannels),"audioOpusParamsClockRate"in k&&(g.audio.opus_params.clock_rate=k.audioOpusParamsClockRate),"audioOpusParamsMaxplaybackrate"in k&&(g.audio.opus_params.maxplaybackrate=k.audioOpusParamsMaxplaybackrate),"audioOpusParamsStereo"in k&&(g.audio.opus_params.stereo=k.audioOpusParamsStereo),"audioOpusParamsSpropStereo"in k&&(g.audio.opus_params.sprop_stereo=k.audioOpusParamsSpropStereo),"audioOpusParamsMinptime"in k&&(g.audio.opus_params.minptime=k.audioOpusParamsMinptime),"audioOpusParamsPtime"in k&&(g.audio.opus_params.ptime=k.audioOpusParamsPtime),"audioOpusParamsUseinbandfec"in k&&(g.audio.opus_params.useinbandfec=k.audioOpusParamsUseinbandfec),"audioOpusParamsUsedtx"in k&&(g.audio.opus_params.usedtx=k.audioOpusParamsUsedtx)),void 0!==k.video&&(g.video=k.video);const n=Object.keys(k).some(a=>0<=j.indexOf(a));if(g.video&&n&&(g.video={},"videoCodecType"in k&&(g.video.codec_type=k.videoCodecType),"videoBitRate"in k&&(g.video.bit_rate=k.videoBitRate)),g.simulcast&&!b(g.role,g.video))throw new Error("Simulcast can not be used with this browser");return"e2ee"in f&&(!0===g.video&&(g.video={}),g.video&&(g.video.codec_type="VP8"),g.e2ee=!0),g}function f(a,b,d){let e="";window.performance&&(e="["+(window.performance.now()/1e3).toFixed(3)+"]"),a&&(e=e+"["+a+"]"),c()?console.log(e+" "+b+"\n",d):console.info(e+" "+b+"\n",d)}var g="undefined"==typeof globalThis?"undefined"==typeof window?"undefined"==typeof global?"undefined"==typeof self?{}:self:global:window:globalThis,h=function(a,b){return b={exports:{}},a(b,b.exports),b.exports}(function(c){(function(d,a){c.exports=a()})(g,function(){return class{constructor(c){const a=!!RTCRtpSender.prototype.createEncodedVideoStreams;if(!a)throw new Error("E2EE is not supported in this browser");this.worker=null,this.masterKey=new TextEncoder().encode(c),this.onWorkerDisconnect=null}startWorker(){const b=atob("bGV0IG1hc3RlcktleSxtYXRlcmlhbDtjb25zdCBkZXJpdmVLZXlNYXA9bmV3IE1hcCxzZXFOdW1NYXA9bmV3I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WxzZSJzZXRLZXkiPT09Yj8obWFzdGVyS2V5PWEuZGF0YS5tYXN0ZXJLZXksbWF0ZXJpYWw9YXdhaXQgY3J5cHRvLnN1YnRsZS5pbXBvcnRLZXkoInJhdyIsbWFzdGVyS2V5LCJQQktERjIiLCExLFsiZGVyaXZlQml0cyIsImRlcml2ZUtleSJdKSk6ImNsZWFyIj09PWImJihkZXJpdmVLZXlNYXAuY2xlYXIoKSxzZXFOdW1NYXAuY2xlYXIoKSx3cml0ZUlWTWFwLmNsZWFyKCkpfTsK");this.worker=new Worker(URL.createObjectURL(new Blob([b],{type:"application/javascript"}))),this.worker.onmessage=c=>{const{operation:a}=c.data;"disconnect"===a&&"function"==typeof this.onWorkerDisconnect&&this.onWorkerDisconnect()},this.worker.postMessage({operation:"setKey",masterKey:this.masterKey})}terminateWorker(){this.worker&&this.worker.terminate()}setupSenderTransform(c){if(c.track){const a="video"===c.track.kind?c.createEncodedVideoStreams():c.createEncodedAudioStreams();this.worker&&this.worker.postMessage({operation:"encrypt",readableStream:a.readableStream,writableStream:a.writableStream},[a.readableStream,a.writableStream])}}setupReceiverTransform(c){const a="video"===c.track.kind?c.createEncodedVideoStreams():c.createEncodedAudioStreams();this.worker&&this.worker.postMessage({operation:"decrypt",readableStream:a.readableStream,writableStream:a.writableStream},[a.readableStream,a.writableStream])}static version(){return"2020.1.0"}}})});class i{constructor(a,b,c,d,e,f){this.role=b,this.channelId=c,this.metadata=d,this.signalingUrl=a,this.options=e,this.constraints=null,this.debug=f,this.clientId=null,this.connectionId=null,this.remoteConnectionIds=[],this.stream=null,this.ws=null,this.pc=null,this.callbacks={disconnect:()=>{},push:()=>{},addstream:()=>{},track:()=>{},removestream:()=>{},removetrack:()=>{},notify:()=>{},log:()=>{},timeout:()=>{}},this.authMetadata=null,this.e2ee=null}on(a,b){"addstream"===a?console.warn("@deprecated addstream callback will be removed in a future version. Use track callback."):"removestream"==a&&console.warn("@deprecated removestream callback will be removed in a future version. Use removetrack callback."),a in this.callbacks&&(this.callbacks[a]=b)}disconnect(){this.clientId=null,this.connectionId=null,this.authMetadata=null,this.remoteConnectionIds=[];const a=new Promise(a=>(this.debug&&console.warn("@deprecated closing MediaStream in disconnect will be removed in a future version. Close every track in the MediaStream by yourself."),!this.stream)?a():(this.stream.getTracks().forEach(a=>{a.stop()}),this.stream=null,a())),b=new Promise((a,b)=>{if(!this.ws)return a();this.ws.onclose=null;let c=5;const d=setInterval(()=>this.ws?3===this.ws.readyState?(this.ws=null,clearInterval(d),a()):(--c,0>c)?(clearInterval(d),b("WebSocket Closing Error")):void 0:(clearInterval(d),b("WebSocket Closing Error")),1e3);this.ws.close()}),c=new Promise((a,b)=>{if(d()&&this.pc)return this.pc.oniceconnectionstatechange=null,this.pc.close(),this.pc=null,a();if(!this.pc||"closed"===this.pc.signalingState)return a();let c=5;const e=setInterval(()=>this.pc?"closed"===this.pc.signalingState?(clearInterval(e),this.pc.oniceconnectionstatechange=null,this.pc=null,a()):(--c,0>c)?(clearInterval(e),b("PeerConnection Closing Error")):void 0:(clearInterval(e),b("PeerConnection Closing Error")),1e3);this.pc.close()});return this.e2ee&&(this.e2ee.terminateWorker(),this.e2ee=null),Promise.all([a,b,c])}startE2EE(){"e2ee"in this.options&&"string"==typeof this.options.e2ee&&(this.e2ee=new h(this.options.e2ee),this.e2ee.onWorkerDisconnect=()=>{this.disconnect()},this.e2ee.startWorker())}signaling(a){return this.trace("CREATE OFFER SDP",a),new Promise((b,c)=>{const d=e(a.sdp||"",this.role,this.channelId,this.metadata,this.options);null===this.ws&&(this.ws=new WebSocket(this.signalingUrl)),this.ws.onclose=a=>{c(a)},this.ws.onopen=()=>{this.trace("SIGNALING CONNECT MESSAGE",d),this.ws&&this.ws.send(JSON.stringify(d))},this.ws.onmessage=a=>{const c=JSON.parse(a.data);"offer"==c.type?(this.clientId=c.client_id,this.connectionId=c.connection_id,this.ws&&(this.ws.onclose=a=>{this.disconnect().then(()=>{this.callbacks.disconnect(a)})},this.ws.onerror=null),"metadata"in c&&(this.authMetadata=c.metadata),this.trace("SIGNALING OFFER MESSAGE",c),this.trace("OFFER SDP",c.sdp),b(c)):"update"==c.type?(this.trace("UPDATE SDP",c.sdp),this.update(c)):"ping"==c.type?c.stats?this.getStats().then(a=>{this.ws&&this.ws.send(JSON.stringify({type:"pong",stats:a}))}):this.ws&&this.ws.send(JSON.stringify({type:"pong"})):"push"==c.type?this.callbacks.push(c):"notify"==c.type&&this.callbacks.notify(c)}})}async createOffer(){const a=new window.RTCPeerConnection({iceServers:[]});if(d()){a.addTransceiver("video",{direction:"recvonly"}),a.addTransceiver("audio",{direction:"recvonly"});const b=await a.createOffer();return a.close(),b}const b=await a.createOffer({offerToReceiveAudio:!0,offerToReceiveVideo:!0});return a.close(),b}async connectPeerConnection(a){const b=a.config||{};let c=b;if(this.e2ee&&(c.forceEncodedVideoInsertableStreams=!0,c.forceEncodedAudioInsertableStreams=!0),void 0!==window.RTCPeerConnection.generateCertificate){const a=await window.RTCPeerConnection.generateCertificate({name:"ECDSA",namedCurve:"P-256"});c=Object.assign({certificates:[a]},b)}return this.trace("PEER CONNECTION CONFIG",c),this.pc=new window.RTCPeerConnection(c,this.constraints),void(this.pc.oniceconnectionstatechange=()=>{this.pc&&this.trace("ONICECONNECTIONSTATECHANGE ICECONNECTIONSTATE",this.pc.iceConnectionState)})}async setRemoteDescription(a){this.pc&&(await this.pc.setRemoteDescription(new RTCSessionDescription({type:"offer",sdp:a.sdp})))}async createAnswer(a){if(this.pc){if(this.options.simulcast&&("upstream"===this.role||"sendrecv"===this.role||"sendonly"===this.role)&&a.encodings){const b=this.pc.getTransceivers().find(a=>{if(a.mid&&0<=a.mid.indexOf("video")&&null==a.currentDirection)return a});if(!b)throw new Error("Simulcast Error");await this.setSenderParameters(b,a.encodings)}const b=await this.pc.createAnswer();await this.pc.setLocalDescription(b)}}sendAnswer(){this.pc&&this.ws&&this.pc.localDescription&&(this.trace("ANSWER SDP",this.pc.localDescription.sdp),this.ws.send(JSON.stringify({type:"answer",sdp:this.pc.localDescription.sdp})))}sendUpdateAnswer(){this.pc&&this.ws&&this.pc.localDescription&&(this.trace("ANSWER SDP",this.pc.localDescription.sdp),this.ws.send(JSON.stringify({type:"update",sdp:this.pc.localDescription.sdp})))}onIceCandidate(){return new Promise((a,b)=>{const c=setInterval(()=>{if(null===this.pc){clearInterval(c);const a=new Error;a.message="ICECANDIDATE TIMEOUT",b(a)}else this.pc&&"connected"===this.pc.iceConnectionState&&(clearInterval(c),a())},100);this.pc&&(this.pc.onicecandidate=b=>{if(this.pc&&this.trace("ONICECANDIDATE ICEGATHERINGSTATE",this.pc.iceGatheringState),null===b.candidate)clearInterval(c),a();else{const a=b.candidate.toJSON(),c=Object.assign(a,{type:"candidate"});this.trace("ONICECANDIDATE CANDIDATE MESSAGE",c),this.ws&&this.ws.send(JSON.stringify(c))}})})}trace(a,b){this.callbacks.log(a,b);this.debug&&f(this.clientId,a,b)}async update(a){await this.setRemoteDescription(a),await this.createAnswer(a),this.sendUpdateAnswer()}setSenderParameters(a,b){const c=a.sender.getParameters();return c.encodings=b,a.sender.setParameters(c)}async getStats(){const a=[];if(!this.pc)return a;const b=await this.pc.getStats();return b.forEach(b=>{a.push(b)}),a}}class j extends i{connect(a){return this.options.multistream?this.multiStream(a):this.singleStream(a)}async singleStream(a){let b=0;this.options.timeout&&0{const a=new Error;a.message="CONNECTION TIMEOUT",this.callbacks.timeout(),this.disconnect(),Promise.reject(a)},this.options.timeout)),await this.disconnect(),this.startE2EE();const c=await this.createOffer(),d=await this.signaling(c);return await this.connectPeerConnection(d),await this.setRemoteDescription(d),a.getTracks().forEach(b=>{this.pc&&this.pc.addTrack(b,a)}),this.stream=a,await this.createAnswer(d),this.sendAnswer(),this.pc&&this.e2ee&&this.pc.getSenders().forEach(a=>{this.e2ee&&this.e2ee.setupSenderTransform(a)}),await this.onIceCandidate(),clearTimeout(b),a}async multiStream(a){let b=0;this.options.timeout&&0{const a=new Error;a.message="CONNECTION TIMEOUT",this.callbacks.timeout(),this.disconnect(),Promise.reject(a)},this.options.timeout)),await this.disconnect(),this.startE2EE();const c=await this.createOffer(),d=await this.signaling(c);return await this.connectPeerConnection(d),this.pc&&(this.pc.ontrack=a=>{const b=a.streams[0];b&&"default"!==b.id&&b.id!==this.connectionId&&(this.e2ee&&this.e2ee.setupReceiverTransform(a.receiver),this.callbacks.track(a),b.onremovetrack=a=>{if(this.callbacks.removetrack(a),a.target){const b=this.remoteConnectionIds.indexOf(a.target.id);-1{this.pc&&this.pc.addTrack(b,a)}),this.stream=a,await this.createAnswer(d),this.sendAnswer(),this.pc&&this.e2ee&&this.pc.getSenders().forEach(a=>{this.e2ee&&this.e2ee.setupSenderTransform(a)}),await this.onIceCandidate(),clearTimeout(b),a}}class k extends i{connect(){return this.options.multistream?this.multiStream():this.singleStream()}async singleStream(){let a=0;this.options.timeout&&0{const a=new Error;a.message="CONNECTION TIMEOUT",this.callbacks.timeout(),this.disconnect(),Promise.reject(a)},this.options.timeout)),await this.disconnect(),this.startE2EE();const b=await this.createOffer(),c=await this.signaling(b);return await this.connectPeerConnection(c),this.pc&&(this.pc.ontrack=a=>{this.stream=a.streams[0];const b=this.stream.id;"default"!==b&&(this.e2ee&&this.e2ee.setupReceiverTransform(a.receiver),this.callbacks.track(a),this.stream.onremovetrack=a=>{if(this.callbacks.removetrack(a),a.target){const b=this.remoteConnectionIds.indexOf(a.target.id);-1{const a=new Error;a.message="CONNECTION TIMEOUT",this.callbacks.timeout(),this.disconnect(),Promise.reject(a)},this.options.timeout)),await this.disconnect(),this.startE2EE();const b=await this.createOffer(),c=await this.signaling(b);return await this.connectPeerConnection(c),this.pc&&(this.pc.ontrack=a=>{const b=a.streams[0];"default"!==b.id&&b.id!==this.connectionId&&(this.e2ee&&this.e2ee.setupReceiverTransform(a.receiver),this.callbacks.track(a),b.onremovetrack=a=>{if(this.callbacks.removetrack(a),a.target){const b=this.remoteConnectionIds.indexOf(a.target.id);-1{"audio"===a&&"boolean"==typeof k[a]||"video"===a&&"boolean"==typeof k[a]||0<=h.indexOf(a)&&null!==k[a]||0<=i.indexOf(a)&&null!==k[a]||0<=j.indexOf(a)&&null!==k[a]||delete k[a]}),void 0!==k.audio&&(g.audio=k.audio);const l=Object.keys(k).some(a=>0<=h.indexOf(a));g.audio&&l&&(g.audio={},"audioCodecType"in k&&(g.audio.codec_type=k.audioCodecType),"audioBitRate"in k&&(g.audio.bit_rate=k.audioBitRate));const m=Object.keys(k).some(a=>0<=i.indexOf(a));g.audio&&m&&("object"!=typeof g.audio&&(g.audio={}),g.audio.opus_params={},"audioOpusParamsChannels"in k&&(g.audio.opus_params.channels=k.audioOpusParamsChannels),"audioOpusParamsClockRate"in k&&(g.audio.opus_params.clock_rate=k.audioOpusParamsClockRate),"audioOpusParamsMaxplaybackrate"in k&&(g.audio.opus_params.maxplaybackrate=k.audioOpusParamsMaxplaybackrate),"audioOpusParamsStereo"in k&&(g.audio.opus_params.stereo=k.audioOpusParamsStereo),"audioOpusParamsSpropStereo"in k&&(g.audio.opus_params.sprop_stereo=k.audioOpusParamsSpropStereo),"audioOpusParamsMinptime"in k&&(g.audio.opus_params.minptime=k.audioOpusParamsMinptime),"audioOpusParamsPtime"in k&&(g.audio.opus_params.ptime=k.audioOpusParamsPtime),"audioOpusParamsUseinbandfec"in k&&(g.audio.opus_params.useinbandfec=k.audioOpusParamsUseinbandfec),"audioOpusParamsUsedtx"in k&&(g.audio.opus_params.usedtx=k.audioOpusParamsUsedtx)),void 0!==k.video&&(g.video=k.video);const n=Object.keys(k).some(a=>0<=j.indexOf(a));if(g.video&&n&&(g.video={},"videoCodecType"in k&&(g.video.codec_type=k.videoCodecType),"videoBitRate"in k&&(g.video.bit_rate=k.videoBitRate)),g.simulcast&&!b(g.role,g.video))throw new Error("Simulcast can not be used with this browser");return"e2ee"in f&&(!0===g.video&&(g.video={}),g.video&&(g.video.codec_type="VP8"),g.e2ee=!0),g}function f(a,b,d){let e="";window.performance&&(e="["+(window.performance.now()/1e3).toFixed(3)+"]"),a&&(e=e+"["+a+"]"),c()?console.log(e+" "+b+"\n",d):console.info(e+" "+b+"\n",d)}var g="undefined"==typeof globalThis?"undefined"==typeof window?"undefined"==typeof global?"undefined"==typeof self?{}:self:global:window:globalThis,h=function(a,b){return b={exports:{}},a(b,b.exports),b.exports}(function(c){(function(d,a){c.exports=a()})(g,function(){return class{constructor(c){const a=!!RTCRtpSender.prototype.createEncodedStreams;if(!a)throw new Error("E2EE is not supported in this browser");this.worker=null,this.masterKey=new TextEncoder().encode(c),this.onWorkerDisconnect=null}startWorker(){const b=atob("bGV0IG1hc3RlcktleSxtYXRlcmlhbDtjb25zdCBkZXJpdmVLZXlNYXA9bmV3IE1hcCxzZXFOdW1NYXA9bmV3IE1hcCx3cml0ZUlWTWFwPW5ldyBNYXAsc2VxTnVtTGVuZ3RoPTQsc3NyY0xlbmd0aD00LHBhZGRpbmdMZW5ndGg9OCx1bmVuY3J5cHRlZEJ5dGVzPXtrZXk6MTAsZGVsdGE6Myx1bmRlZmluZWQ6MX07ZnVuY3Rpb24gZ2V0U2VxTnVtKGEpe3JldHVybiBzZXFOdW1NYXAuZ2V0KGEpfHwwfWZ1bmN0aW9uIHNldFNlcU51bShhLGIpe3NlcU51bU1hcC5zZXQoYSxiKX1hc3luYyBmdW5jdGlvbiBnZW5lcmF0ZURlcml2ZUtleShhLGIpe2xldCBjPWRlcml2ZUtleU1hcC5nZXQoYSk7cmV0dXJuIGN8fChjPWF3YWl0IGNyeXB0by5zdWJ0bGUuZGVyaXZlS2V5KHtuYW1lOiJQQktERjIiLHNhbHQ6YixpdGVyYXRpb25zOjFlNCxoYXNoOiJTSEEtMjU2In0sbWF0ZXJpYWwse25hbWU6IkFFUy1HQ00iLGxlbmd0aDoxMjh9LCExLFsiZW5jcnlwdCIsImRlY3J5cHQiXSksZGVyaXZlS2V5TWFwLnNldChhLGMpKSxjfWFzeW5jIGZ1bmN0aW9uIGdlbmVyYXRlSVYoYSxiLGMpe2xldCBkPXdyaXRlSV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JlbmNyeXB0Ij09PWIpe2NvbnN0e3JlYWRhYmxlU3RyZWFtOmIsd3JpdGFibGVTdHJlYW06Y309YS5kYXRhLGQ9bmV3IFRyYW5zZm9ybVN0cmVhbSh7dHJhbnNmb3JtOmVuY3J5cHRGdW5jdGlvbn0pO2IucGlwZVRocm91Z2goZCkucGlwZVRvKGMpfWVsc2UgaWYoImRlY3J5cHQiPT09Yil7Y29uc3R7cmVhZGFibGVTdHJlYW06Yix3cml0YWJsZVN0cmVhbTpjfT1hLmRhdGEsZD1uZXcgVHJhbnNmb3JtU3RyZWFtKHt0cmFuc2Zvcm06ZGVjcnlwdEZ1bmN0aW9ufSk7Yi5waXBlVGhyb3VnaChkKS5waXBlVG8oYyl9ZWxzZSJzZXRLZXkiPT09Yj8obWFzdGVyS2V5PWEuZGF0YS5tYXN0ZXJLZXksbWF0ZXJpYWw9YXdhaXQgY3J5cHRvLnN1YnRsZS5pbXBvcnRLZXkoInJhdyIsbWFzdGVyS2V5LCJQQktERjIiLCExLFsiZGVyaXZlQml0cyIsImRlcml2ZUtleSJdKSk6ImNsZWFyIj09PWImJihkZXJpdmVLZXlNYXAuY2xlYXIoKSxzZXFOdW1NYXAuY2xlYXIoKSx3cml0ZUlWTWFwLmNsZWFyKCkpfTsK");this.worker=new Worker(URL.createObjectURL(new Blob([b],{type:"application/javascript"}))),this.worker.onmessage=c=>{const{operation:a}=c.data;"disconnect"===a&&"function"==typeof this.onWorkerDisconnect&&this.onWorkerDisconnect()},this.worker.postMessage({operation:"setKey",masterKey:this.masterKey})}terminateWorker(){this.worker&&this.worker.terminate()}setupSenderTransform(c){if(c.track){const a=c.createEncodedStreams();this.worker&&this.worker.postMessage({operation:"encrypt",readableStream:a.readableStream,writableStream:a.writableStream},[a.readableStream,a.writableStream])}}setupReceiverTransform(c){const a=c.createEncodedStreams();this.worker&&this.worker.postMessage({operation:"decrypt",readableStream:a.readableStream,writableStream:a.writableStream},[a.readableStream,a.writableStream])}static version(){return"2020.2.0"}}})});class i{constructor(a,b,c,d,e,f){this.role=b,this.channelId=c,this.metadata=d,this.signalingUrl=a,this.options=e,this.constraints=null,this.debug=f,this.clientId=null,this.connectionId=null,this.remoteConnectionIds=[],this.stream=null,this.ws=null,this.pc=null,this.callbacks={disconnect:()=>{},push:()=>{},addstream:()=>{},track:()=>{},removestream:()=>{},removetrack:()=>{},notify:()=>{},log:()=>{},timeout:()=>{}},this.authMetadata=null,this.e2ee=null}on(a,b){"addstream"===a?console.warn("@deprecated addstream callback will be removed in a future version. Use track callback."):"removestream"==a&&console.warn("@deprecated removestream callback will be removed in a future version. Use removetrack callback."),a in this.callbacks&&(this.callbacks[a]=b)}disconnect(){this.clientId=null,this.connectionId=null,this.authMetadata=null,this.remoteConnectionIds=[];const a=new Promise(a=>(this.debug&&console.warn("@deprecated closing MediaStream in disconnect will be removed in a future version. Close every track in the MediaStream by yourself."),!this.stream)?a():(this.stream.getTracks().forEach(a=>{a.stop()}),this.stream=null,a())),b=new Promise((a,b)=>{if(!this.ws)return a();this.ws.onclose=null;let c=5;const d=setInterval(()=>this.ws?3===this.ws.readyState?(this.ws=null,clearInterval(d),a()):(--c,0>c)?(clearInterval(d),b("WebSocket Closing Error")):void 0:(clearInterval(d),b("WebSocket Closing Error")),1e3);this.ws.close()}),c=new Promise((a,b)=>{if(d()&&this.pc)return this.pc.oniceconnectionstatechange=null,this.pc.close(),this.pc=null,a();if(!this.pc||"closed"===this.pc.signalingState)return a();let c=5;const e=setInterval(()=>this.pc?"closed"===this.pc.signalingState?(clearInterval(e),this.pc.oniceconnectionstatechange=null,this.pc=null,a()):(--c,0>c)?(clearInterval(e),b("PeerConnection Closing Error")):void 0:(clearInterval(e),b("PeerConnection Closing Error")),1e3);this.pc.close()});return this.e2ee&&(this.e2ee.terminateWorker(),this.e2ee=null),Promise.all([a,b,c])}startE2EE(){"e2ee"in this.options&&"string"==typeof this.options.e2ee&&(this.e2ee=new h(this.options.e2ee),this.e2ee.onWorkerDisconnect=()=>{this.disconnect()},this.e2ee.startWorker())}signaling(a){return this.trace("CREATE OFFER SDP",a),new Promise((b,c)=>{const d=e(a.sdp||"",this.role,this.channelId,this.metadata,this.options);null===this.ws&&(this.ws=new WebSocket(this.signalingUrl)),this.ws.onclose=a=>{c(a)},this.ws.onopen=()=>{this.trace("SIGNALING CONNECT MESSAGE",d),this.ws&&this.ws.send(JSON.stringify(d))},this.ws.onmessage=a=>{const c=JSON.parse(a.data);"offer"==c.type?(this.clientId=c.client_id,this.connectionId=c.connection_id,this.ws&&(this.ws.onclose=a=>{this.disconnect().then(()=>{this.callbacks.disconnect(a)})},this.ws.onerror=null),"metadata"in c&&(this.authMetadata=c.metadata),this.trace("SIGNALING OFFER MESSAGE",c),this.trace("OFFER SDP",c.sdp),b(c)):"update"==c.type?(this.trace("UPDATE SDP",c.sdp),this.update(c)):"ping"==c.type?c.stats?this.getStats().then(a=>{this.ws&&this.ws.send(JSON.stringify({type:"pong",stats:a}))}):this.ws&&this.ws.send(JSON.stringify({type:"pong"})):"push"==c.type?this.callbacks.push(c):"notify"==c.type&&this.callbacks.notify(c)}})}async createOffer(){const a=new window.RTCPeerConnection({iceServers:[]});if(d()){a.addTransceiver("video",{direction:"recvonly"}),a.addTransceiver("audio",{direction:"recvonly"});const b=await a.createOffer();return a.close(),b}const b=await a.createOffer({offerToReceiveAudio:!0,offerToReceiveVideo:!0});return a.close(),b}async connectPeerConnection(a){const b=a.config||{};let c=b;if(this.e2ee&&(c.encodedInsertableStreams=!0),void 0!==window.RTCPeerConnection.generateCertificate){const a=await window.RTCPeerConnection.generateCertificate({name:"ECDSA",namedCurve:"P-256"});c=Object.assign({certificates:[a]},b)}return this.trace("PEER CONNECTION CONFIG",c),this.pc=new window.RTCPeerConnection(c,this.constraints),void(this.pc.oniceconnectionstatechange=()=>{this.pc&&this.trace("ONICECONNECTIONSTATECHANGE ICECONNECTIONSTATE",this.pc.iceConnectionState)})}async setRemoteDescription(a){this.pc&&(await this.pc.setRemoteDescription(new RTCSessionDescription({type:"offer",sdp:a.sdp})))}async createAnswer(a){if(this.pc){if(this.options.simulcast&&("upstream"===this.role||"sendrecv"===this.role||"sendonly"===this.role)&&a.encodings){const b=this.pc.getTransceivers().find(a=>{if(a.mid&&0<=a.mid.indexOf("video")&&null==a.currentDirection)return a});if(!b)throw new Error("Simulcast Error");await this.setSenderParameters(b,a.encodings)}const b=await this.pc.createAnswer();await this.pc.setLocalDescription(b)}}sendAnswer(){this.pc&&this.ws&&this.pc.localDescription&&(this.trace("ANSWER SDP",this.pc.localDescription.sdp),this.ws.send(JSON.stringify({type:"answer",sdp:this.pc.localDescription.sdp})))}sendUpdateAnswer(){this.pc&&this.ws&&this.pc.localDescription&&(this.trace("ANSWER SDP",this.pc.localDescription.sdp),this.ws.send(JSON.stringify({type:"update",sdp:this.pc.localDescription.sdp})))}onIceCandidate(){return new Promise((a,b)=>{const c=setInterval(()=>{if(null===this.pc){clearInterval(c);const a=new Error;a.message="ICECANDIDATE TIMEOUT",b(a)}else this.pc&&"connected"===this.pc.iceConnectionState&&(clearInterval(c),a())},100);this.pc&&(this.pc.onicecandidate=b=>{if(this.pc&&this.trace("ONICECANDIDATE ICEGATHERINGSTATE",this.pc.iceGatheringState),null===b.candidate)clearInterval(c),a();else{const a=b.candidate.toJSON(),c=Object.assign(a,{type:"candidate"});this.trace("ONICECANDIDATE CANDIDATE MESSAGE",c),this.ws&&this.ws.send(JSON.stringify(c))}})})}trace(a,b){this.callbacks.log(a,b);this.debug&&f(this.clientId,a,b)}async update(a){await this.setRemoteDescription(a),await this.createAnswer(a),this.sendUpdateAnswer()}setSenderParameters(a,b){const c=a.sender.getParameters();return c.encodings=b,a.sender.setParameters(c)}async getStats(){const a=[];if(!this.pc)return a;const b=await this.pc.getStats();return b.forEach(b=>{a.push(b)}),a}}class j extends i{connect(a){return this.options.multistream?this.multiStream(a):this.singleStream(a)}async singleStream(a){let b=0;this.options.timeout&&0{const a=new Error;a.message="CONNECTION TIMEOUT",this.callbacks.timeout(),this.disconnect(),Promise.reject(a)},this.options.timeout)),await this.disconnect(),this.startE2EE();const c=await this.createOffer(),d=await this.signaling(c);return await this.connectPeerConnection(d),await this.setRemoteDescription(d),a.getTracks().forEach(b=>{this.pc&&this.pc.addTrack(b,a)}),this.stream=a,await this.createAnswer(d),this.sendAnswer(),this.pc&&this.e2ee&&this.pc.getSenders().forEach(a=>{this.e2ee&&this.e2ee.setupSenderTransform(a)}),await this.onIceCandidate(),clearTimeout(b),a}async multiStream(a){let b=0;this.options.timeout&&0{const a=new Error;a.message="CONNECTION TIMEOUT",this.callbacks.timeout(),this.disconnect(),Promise.reject(a)},this.options.timeout)),await this.disconnect(),this.startE2EE();const c=await this.createOffer(),d=await this.signaling(c);return await this.connectPeerConnection(d),this.pc&&(this.pc.ontrack=a=>{const b=a.streams[0];b&&"default"!==b.id&&b.id!==this.connectionId&&(this.e2ee&&this.e2ee.setupReceiverTransform(a.receiver),this.callbacks.track(a),b.onremovetrack=a=>{if(this.callbacks.removetrack(a),a.target){const b=this.remoteConnectionIds.indexOf(a.target.id);-1{this.pc&&this.pc.addTrack(b,a)}),this.stream=a,await this.createAnswer(d),this.sendAnswer(),this.pc&&this.e2ee&&this.pc.getSenders().forEach(a=>{this.e2ee&&this.e2ee.setupSenderTransform(a)}),await this.onIceCandidate(),clearTimeout(b),a}}class k extends i{connect(){return this.options.multistream?this.multiStream():this.singleStream()}async singleStream(){let a=0;this.options.timeout&&0{const a=new Error;a.message="CONNECTION TIMEOUT",this.callbacks.timeout(),this.disconnect(),Promise.reject(a)},this.options.timeout)),await this.disconnect(),this.startE2EE();const b=await this.createOffer(),c=await this.signaling(b);return await this.connectPeerConnection(c),this.pc&&(this.pc.ontrack=a=>{this.stream=a.streams[0];const b=this.stream.id;"default"!==b&&(this.e2ee&&this.e2ee.setupReceiverTransform(a.receiver),this.callbacks.track(a),this.stream.onremovetrack=a=>{if(this.callbacks.removetrack(a),a.target){const b=this.remoteConnectionIds.indexOf(a.target.id);-1{const a=new Error;a.message="CONNECTION TIMEOUT",this.callbacks.timeout(),this.disconnect(),Promise.reject(a)},this.options.timeout)),await this.disconnect(),this.startE2EE();const b=await this.createOffer(),c=await this.signaling(b);return await this.connectPeerConnection(c),this.pc&&(this.pc.ontrack=a=>{const b=a.streams[0];"default"!==b.id&&b.id!==this.connectionId&&(this.e2ee&&this.e2ee.setupReceiverTransform(a.receiver),this.callbacks.track(a),b.onremovetrack=a=>{if(this.callbacks.removetrack(a),a.target){const b=this.remoteConnectionIds.indexOf(a.target.id);-1{const{operation:b}=a.data;\"disconnect\"===b&&\"function\"==typeof this.onWorkerDisconnect&&this.onWorkerDisconnect()},this.worker.postMessage({operation:\"setKey\",masterKey:this.masterKey})}terminateWorker(){this.worker&&this.worker.terminate()}setupSenderTransform(a){if(a.track){const b=\"video\"===a.track.kind?a.createEncodedVideoStreams():a.createEncodedAudioStreams();this.worker&&this.worker.postMessage({operation:\"encrypt\",readableStream:b.readableStream,writableStream:b.writableStream},[b.readableStream,b.writableStream])}}setupReceiverTransform(a){const b=\"video\"===a.track.kind?a.createEncodedVideoStreams():a.createEncodedAudioStreams();this.worker&&this.worker.postMessage({operation:\"decrypt\",readableStream:b.readableStream,writableStream:b.writableStream},[b.readableStream,b.writableStream])}static version(){return\"2020.1.0\"}}});\n//# sourceMappingURL=sora_e2ee.min.js.map\n"],"names":["a","b","module","this","constructor","RTCRtpSender","prototype","createEncodedVideoStreams","Error","worker","masterKey","TextEncoder","encode","onWorkerDisconnect","startWorker","atob","Worker","URL","createObjectURL","Blob","type","onmessage","operation","data","postMessage","terminateWorker","terminate","setupSenderTransform","track","kind","createEncodedAudioStreams","readableStream","writableStream","setupReceiverTransform","version"],"mappings":";;;;;;83IAMI,CAAC,SAASA,CAAT,CAAWC,CAAX,CAAa,CAAsDC,SAAA,CAAeD,CAAC,EAA8E,CAAlK,EAAoKE,CAApK,CAAyK,UAAU,CAAc,MAAO,MAAO,CAACC,WAAW,CAACJ,CAAD,CAAG,CAAC,KAAMC,CA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KAAKA,MAAL,CAAYe,WAAZ,CAAwB,CAACF,SAAS,CAAC,SAAX,CAAqBS,cAAc,CAAC9B,CAAC,CAAC8B,cAAtC,CAAqDC,cAAc,CAAC/B,CAAC,CAAC+B,cAAtE,CAAxB,CAA8G,CAAC/B,CAAC,CAAC8B,cAAH,CAAkB9B,CAAC,CAAC+B,cAApB,CAA9G,CAAmJ,CAAC,CAAAC,sBAAsB,CAACjC,CAAD,CAAG,CAAC,KAAMC,CAAAA,CAAC,CAAC,UAAUD,CAAC,CAAC4B,KAAF,CAAQC,IAAlB,CAAuB7B,CAAC,CAACO,yBAAF,EAAvB,CAAqDP,CAAC,CAAC8B,yBAAF,EAA7D,CAA2F,KAAKrB,MAAL,EAAa,KAAKA,MAAL,CAAYe,WAAZ,CAAwB,CAACF,SAAS,CAAC,SAAX,CAAqBS,cAAc,CAAC9B,CAAC,CAAC8B,cAAtC,CAAqDC,cAAc,CAAC/B,CAAC,CAAC+B,cAAtE,CAAxB,CAA8G,CAAC/B,CAAC,CAAC8B,cAAH,CAAkB9B,CAAC,CAAC+B,cAApB,CAA9G,CAAmJ,OAAOE,CAAAA,OAAP,EAAgB,CAAC,MAAM,UAAW,CAAvqL,CAAyqL,CAAx3L"} \ No newline at end of file +{"version":3,"file":"sora.min.js","sources":["../node_modules/sora-e2ee/dist/sora_e2ee.min.js"],"sourcesContent":["/**\n * sora-e2ee\n * WebRTC SFU Sora JavaScript E2EE Library\n * @version: 2020.2.0\n * @author: Shiguredo Inc.\n * @license: Apache-2.0\n **/(function(a,b){\"object\"==typeof exports&&\"undefined\"!=typeof module?module.exports=b():\"function\"==typeof define&&define.amd?define(b):(a=\"undefined\"==typeof globalThis?a||self:globalThis,a.SoraE2EE=b())})(this,function(){'use strict';return class a{constructor(a){const b=!!RTCRtpSender.prototype.createEncodedStreams;if(!b)throw new Error(\"E2EE is not supported in this browser\");this.worker=null,this.masterKey=new TextEncoder().encode(a),this.onWorkerDisconnect=null}startWorker(){const a=atob(\"bGV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tKHt0cmFuc2Zvcm06ZGVjcnlwdEZ1bmN0aW9ufSk7Yi5waXBlVGhyb3VnaChkKS5waXBlVG8oYyl9ZWxzZSJzZXRLZXkiPT09Yj8obWFzdGVyS2V5PWEuZGF0YS5tYXN0ZXJLZXksbWF0ZXJpYWw9YXdhaXQgY3J5cHRvLnN1YnRsZS5pbXBvcnRLZXkoInJhdyIsbWFzdGVyS2V5LCJQQktERjIiLCExLFsiZGVyaXZlQml0cyIsImRlcml2ZUtleSJdKSk6ImNsZWFyIj09PWImJihkZXJpdmVLZXlNYXAuY2xlYXIoKSxzZXFOdW1NYXAuY2xlYXIoKSx3cml0ZUlWTWFwLmNsZWFyKCkpfTsK\");this.worker=new Worker(URL.createObjectURL(new Blob([a],{type:\"application/javascript\"}))),this.worker.onmessage=a=>{const{operation:b}=a.data;\"disconnect\"===b&&\"function\"==typeof this.onWorkerDisconnect&&this.onWorkerDisconnect()},this.worker.postMessage({operation:\"setKey\",masterKey:this.masterKey})}terminateWorker(){this.worker&&this.worker.terminate()}setupSenderTransform(a){if(a.track){const b=a.createEncodedStreams();this.worker&&this.worker.postMessage({operation:\"encrypt\",readableStream:b.readableStream,writableStream:b.writableStream},[b.readableStream,b.writableStream])}}setupReceiverTransform(a){const b=a.createEncodedStreams();this.worker&&this.worker.postMessage({operation:\"decrypt\",readableStream:b.readableStream,writableStream:b.writableStream},[b.readableStream,b.writableStream])}static version(){return\"2020.2.0\"}}});\n//# sourceMappingURL=sora_e2ee.min.js.map\n"],"names":["a","b","module","this","constructor","RTCRtpSender","prototype","createEncodedStreams","Error","worker","masterKey","TextEncoder","encode","onWorkerDisconnect","startWorker","atob","Worker","URL","createObjectURL","Blob","type","onmessage","operation","data","postMessage","terminateWorker","terminate","setupSenderTransform","track","readableStream","writableStream","setupReceiverTransform","version"],"mappings":";;;;;;w6IAMI,CAAC,SAASA,CAAT,CAAWC,CAAX,CAAa,CAAsDC,SAAA,CAAeD,CAAC,EAAwH,CAA5M,EAA8ME,CAA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AL,CAAYe,WAAZ,CAAwB,CAACF,SAAS,CAAC,SAAX,CAAqBO,cAAc,CAAC5B,CAAC,CAAC4B,cAAtC,CAAqDC,cAAc,CAAC7B,CAAC,CAAC6B,cAAtE,CAAxB,CAA8G,CAAC7B,CAAC,CAAC4B,cAAH,CAAkB5B,CAAC,CAAC6B,cAApB,CAA9G,CAAmJ,CAAC,CAAAC,sBAAsB,CAAC/B,CAAD,CAAG,CAAC,KAAMC,CAAAA,CAAC,CAACD,CAAC,CAACO,oBAAF,EAAR,CAAiC,KAAKE,MAAL,EAAa,KAAKA,MAAL,CAAYe,WAAZ,CAAwB,CAACF,SAAS,CAAC,SAAX,CAAqBO,cAAc,CAAC5B,CAAC,CAAC4B,cAAtC,CAAqDC,cAAc,CAAC7B,CAAC,CAAC6B,cAAtE,CAAxB,CAA8G,CAAC7B,CAAC,CAAC4B,cAAH,CAAkB5B,CAAC,CAAC6B,cAApB,CAA9G,CAAmJ,OAAOE,CAAAA,OAAP,EAAgB,CAAC,MAAM,UAAW,CAA9iL,CAAgjL,CAAzyL"} \ No newline at end of file From a01d493954e02d1085a429dd40dcc1d83a7b5217 Mon Sep 17 00:00:00 2001 From: NAKAI Ryosuke Date: Tue, 4 Aug 2020 15:07:47 +0900 Subject: [PATCH 07/18] =?UTF-8?q?WebRTC=20SFU=20Sora=202020.1=20=E4=BB=A5?= =?UTF-8?q?=E9=99=8D=E3=81=AB=E4=B8=8A=E3=81=92=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cda303ba..3f3d7145 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ Sora JavaScript SDK に対する有償のサポートについては提供して ## システム条件 -- WebRTC SFU Sora 19.10.8 以降 +- WebRTC SFU Sora 2020.1 以降 ## サンプル From 88b5d237a146324c125ade0c7ef1127af5ddff9b Mon Sep 17 00:00:00 2001 From: Yuki Ito Date: Fri, 7 Aug 2020 10:13:59 +0900 Subject: [PATCH 08/18] =?UTF-8?q?example=20=E3=81=AE=20video=20tag=20?= =?UTF-8?q?=E3=81=AB=20attribute=20=E3=82=92=E8=BF=BD=E5=8A=A0=E3=81=99?= =?UTF-8?q?=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- example/multistream_recvonly.html | 2 ++ example/multistream_sendonly.html | 2 +- example/multistream_sendrecv.html | 8 ++++++-- example/multistream_sendrecv_e2ee.html | 12 +++++++++--- example/sendonly_recvonly.html | 6 +++--- example/simulcast.html | 8 ++++---- example/spotlight_recvonly.html | 2 ++ example/spotlight_sendrecv.html | 8 ++++++-- 8 files changed, 33 insertions(+), 15 deletions(-) diff --git a/example/multistream_recvonly.html b/example/multistream_recvonly.html index 22802252..17a3fe69 100644 --- a/example/multistream_recvonly.html +++ b/example/multistream_recvonly.html @@ -39,6 +39,8 @@

Multistream Recvonly test

remoteVideo.id = remoteVideoId; remoteVideo.style.border = '1px solid red'; remoteVideo.autoplay = true; + remoteVideo.playsinline = true; + remoteVideo.controls = true; remoteVideo.width = '320'; remoteVideo.height = '240'; remoteVideo.srcObject = stream; diff --git a/example/multistream_sendonly.html b/example/multistream_sendonly.html index ea1216f5..58c61364 100644 --- a/example/multistream_sendonly.html +++ b/example/multistream_sendonly.html @@ -10,7 +10,7 @@

Multistream Sendonly test

sendonly1


- + diff --git a/example/multistream_sendrecv.html b/example/multistream_sendrecv.html index c1f64726..57b69d82 100644 --- a/example/multistream_sendrecv.html +++ b/example/multistream_sendrecv.html @@ -11,14 +11,14 @@

Multistream Sendrecv test

sendrecv1


- +

sendrecv2


- +
@@ -57,6 +57,8 @@

sendrecv2

remoteVideo.id = remoteVideoId; remoteVideo.style.border = '1px solid red'; remoteVideo.autoplay = true; + remoteVideo.playsinline = true; + remoteVideo.controls = true; remoteVideo.width = '160'; remoteVideo.height = '120'; remoteVideo.srcObject = stream; @@ -92,6 +94,8 @@

sendrecv2

remoteVideo.id = remoteVideoId; remoteVideo.style.border = '1px solid red'; remoteVideo.autoplay = true; + remoteVideo.playsinline = true; + remoteVideo.controls = true; remoteVideo.width = '160'; remoteVideo.height = '120'; remoteVideo.srcObject = stream; diff --git a/example/multistream_sendrecv_e2ee.html b/example/multistream_sendrecv_e2ee.html index 304b9969..7ce790c6 100644 --- a/example/multistream_sendrecv_e2ee.html +++ b/example/multistream_sendrecv_e2ee.html @@ -12,7 +12,7 @@

sendrecv1

secretKey: MasterKey


- +
@@ -20,7 +20,7 @@

sendrecv2

secretKey: MasterKey


- +
@@ -28,7 +28,7 @@

sendrecv3

secretKey: AnotherKey


- +
@@ -74,6 +74,8 @@

sendrecv3

remoteVideo.id = remoteVideoId; remoteVideo.style.border = '1px solid red'; remoteVideo.autoplay = true; + remoteVideo.playsinline = true; + remoteVideo.controls = true; remoteVideo.width = '160'; remoteVideo.height = '120'; remoteVideo.srcObject = stream; @@ -109,6 +111,8 @@

sendrecv3

remoteVideo.id = remoteVideoId; remoteVideo.style.border = '1px solid red'; remoteVideo.autoplay = true; + remoteVideo.playsinline = true; + remoteVideo.controls = true; remoteVideo.width = '160'; remoteVideo.height = '120'; remoteVideo.srcObject = stream; @@ -144,6 +148,8 @@

sendrecv3

remoteVideo.id = remoteVideoId; remoteVideo.style.border = '1px solid red'; remoteVideo.autoplay = true; + remoteVideo.playsinline = true; + remoteVideo.controls = true; remoteVideo.width = '160'; remoteVideo.height = '120'; remoteVideo.srcObject = stream; diff --git a/example/sendonly_recvonly.html b/example/sendonly_recvonly.html index ae76a9e8..fc6a4508 100644 --- a/example/sendonly_recvonly.html +++ b/example/sendonly_recvonly.html @@ -11,17 +11,17 @@

Sendonly / Recvonly test

sendonly

- +

recvonly1

- +

recvonly2

- +
diff --git a/example/simulcast.html b/example/simulcast.html index 176a8523..e4d4e72b 100644 --- a/example/simulcast.html +++ b/example/simulcast.html @@ -9,19 +9,19 @@

Simulcast test

sendonly

- +

recvonly low

- +

recvonly middle

- +

recvonly high

- +
diff --git a/example/spotlight_recvonly.html b/example/spotlight_recvonly.html index c36fd819..080fb944 100644 --- a/example/spotlight_recvonly.html +++ b/example/spotlight_recvonly.html @@ -40,6 +40,8 @@

Spotlight Recvonly test

remoteVideo.id = remoteVideoId; remoteVideo.style.border = '1px solid red'; remoteVideo.autoplay = true; + remoteVideo.playsinline = true; + remoteVideo.controls = true; remoteVideo.width = '320'; remoteVideo.height = '240'; remoteVideo.srcObject = stream; diff --git a/example/spotlight_sendrecv.html b/example/spotlight_sendrecv.html index c3736f30..37d16a77 100644 --- a/example/spotlight_sendrecv.html +++ b/example/spotlight_sendrecv.html @@ -11,14 +11,14 @@

Spotlight Sendrecv test

sendrecv1


- +

sendrecv2


- +
@@ -58,6 +58,8 @@

sendrecv2

remoteVideo.id = remoteVideoId; remoteVideo.style.border = '1px solid red'; remoteVideo.autoplay = true; + remoteVideo.playsinline = true; + remoteVideo.controls = true; remoteVideo.width = '160'; remoteVideo.height = '120'; remoteVideo.srcObject = stream; @@ -93,6 +95,8 @@

sendrecv2

remoteVideo.id = remoteVideoId; remoteVideo.style.border = '1px solid red'; remoteVideo.autoplay = true; + remoteVideo.playsinline = true; + remoteVideo.controls = true; remoteVideo.width = '160'; remoteVideo.height = '120'; remoteVideo.srcObject = stream; From ca7b0ca7067f8cfc0e43acf52700f1c4dc09bfe0 Mon Sep 17 00:00:00 2001 From: voluntas Date: Sun, 9 Aug 2020 17:30:04 +0900 Subject: [PATCH 09/18] Update README.md --- README.md | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 3f3d7145..3cb2aedb 100644 --- a/README.md +++ b/README.md @@ -11,16 +11,9 @@ Sora JavaScript SDK は[株式会社時雨堂](https://shiguredo.jp/)が開発 We check PRs or Issues only when written in JAPANESE. In other languages, we won't be able to deal with them. Thank you for your understanding. -## Discord +## 時雨堂のオープンソースソフトウェアについて -https://discord.gg/uZ5wgHE - -Sora JavaScript SDK に関する質問・要望などの報告は Disocrd へお願いします。 - -バグに関してはまず Discord へお願いします。 -ただし、 Sora のライセンス契約の有無に関わらず、 Issue への応答時間と問題の解決を保証しませんのでご了承ください。 - -Sora JavaScript SDK に対する有償のサポートについては提供しておりません。 +利用前に https://github.com/shiguredo/oss をお読みください。 ## 使い方 From 6b8034df8447675f4ee9fac124146a9694d839d8 Mon Sep 17 00:00:00 2001 From: Yuki Ito Date: Thu, 27 Aug 2020 11:24:19 +0900 Subject: [PATCH 10/18] =?UTF-8?q?disconnect=20=E3=81=8C=E8=A4=87=E6=95=B0?= =?UTF-8?q?=E5=9B=9E=E5=91=BC=E3=81=B0=E3=82=8C=E3=81=9F=E5=A0=B4=E5=90=88?= =?UTF-8?q?=E3=81=AB=E4=BE=8B=E5=A4=96=E3=81=8C=E8=B5=B7=E3=81=8D=E3=81=AA?= =?UTF-8?q?=E3=81=84=E3=82=88=E3=81=86=E3=81=AB=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/base.ts b/src/base.ts index 1dc57059..4b56a7dc 100644 --- a/src/base.ts +++ b/src/base.ts @@ -101,13 +101,12 @@ export default class ConnectionBase { }); const closeWebSocket: Promise = new Promise((resolve, reject) => { if (!this.ws) return resolve(); - this.ws.onclose = null; let counter = 5; const timerId = setInterval(() => { if (!this.ws) { clearInterval(timerId); - return reject("WebSocket Closing Error"); + return resolve(); } if (this.ws.readyState === 3) { this.ws = null; @@ -136,7 +135,7 @@ export default class ConnectionBase { const timerId = setInterval(() => { if (!this.pc) { clearInterval(timerId); - return reject("PeerConnection Closing Error"); + return resolve(); } if (this.pc.signalingState === "closed") { clearInterval(timerId); @@ -198,9 +197,8 @@ export default class ConnectionBase { this.connectionId = data.connection_id; if (this.ws) { this.ws.onclose = (e): void => { - this.disconnect().then(() => { - this.callbacks.disconnect(e); - }); + this.callbacks.disconnect(e); + this.disconnect(); }; this.ws.onerror = null; } From 85d0cef86505ad7d7ff371582721cc7278f52d94 Mon Sep 17 00:00:00 2001 From: Yuki Ito Date: Thu, 27 Aug 2020 11:24:32 +0900 Subject: [PATCH 11/18] =?UTF-8?q?=E6=88=90=E6=9E=9C=E7=89=A9=E3=82=92?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/sora.js | 10 ++++------ dist/sora.min.js | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/dist/sora.js b/dist/sora.js index 95f605dd..54bf65c4 100644 --- a/dist/sora.js +++ b/dist/sora.js @@ -345,12 +345,11 @@ const closeWebSocket = new Promise((resolve, reject) => { if (!this.ws) return resolve(); - this.ws.onclose = null; let counter = 5; const timerId = setInterval(() => { if (!this.ws) { clearInterval(timerId); - return reject("WebSocket Closing Error"); + return resolve(); } if (this.ws.readyState === 3) { this.ws = null; @@ -379,7 +378,7 @@ const timerId = setInterval(() => { if (!this.pc) { clearInterval(timerId); - return reject("PeerConnection Closing Error"); + return resolve(); } if (this.pc.signalingState === "closed") { clearInterval(timerId); @@ -433,9 +432,8 @@ this.connectionId = data.connection_id; if (this.ws) { this.ws.onclose = (e) => { - this.disconnect().then(() => { - this.callbacks.disconnect(e); - }); + this.callbacks.disconnect(e); + this.disconnect(); }; this.ws.onerror = null; } diff --git a/dist/sora.min.js b/dist/sora.min.js index d8f645af..6ec2154d 100644 --- a/dist/sora.min.js +++ b/dist/sora.min.js @@ -4,5 +4,5 @@ * @version: 2020.1.5-dev * @author: Shiguredo Inc. * @license: Apache-2.0 - **/(function(a,b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):(a="undefined"==typeof globalThis?a||self:globalThis,a.Sora=b())})(this,function(){'use strict';function a(){const a=window.navigator.userAgent.toLocaleLowerCase();if(-1!==a.indexOf("edge"))return"edge";return-1!==a.indexOf("chrome")&&-1===a.indexOf("edge")?"chrome":-1!==a.indexOf("safari")&&-1===a.indexOf("chrome")?"safari":-1===a.indexOf("opera")?-1===a.indexOf("firefox")?null:"firefox":"opera"}function b(b,c){if("boolean"!=typeof c&&"VP9"===c.codec_type)return!1;if(("upstream"===b||"sendrecv"===b||"sendonly"===b)&&"firefox"===a())return!1;if(("upstream"===b||"sendrecv"===b||"sendonly"===b)&&"safari"===a())return!1;if(("downstream"===b||"recvonly"===b)&&"safari"===a()){const a=window.navigator.appVersion.toLowerCase(),b=/version\/([\d.]+)/.exec(a);if(!b)return!1;const d=b.pop();return!!(d&&12{"audio"===a&&"boolean"==typeof k[a]||"video"===a&&"boolean"==typeof k[a]||0<=h.indexOf(a)&&null!==k[a]||0<=i.indexOf(a)&&null!==k[a]||0<=j.indexOf(a)&&null!==k[a]||delete k[a]}),void 0!==k.audio&&(g.audio=k.audio);const l=Object.keys(k).some(a=>0<=h.indexOf(a));g.audio&&l&&(g.audio={},"audioCodecType"in k&&(g.audio.codec_type=k.audioCodecType),"audioBitRate"in k&&(g.audio.bit_rate=k.audioBitRate));const m=Object.keys(k).some(a=>0<=i.indexOf(a));g.audio&&m&&("object"!=typeof g.audio&&(g.audio={}),g.audio.opus_params={},"audioOpusParamsChannels"in k&&(g.audio.opus_params.channels=k.audioOpusParamsChannels),"audioOpusParamsClockRate"in k&&(g.audio.opus_params.clock_rate=k.audioOpusParamsClockRate),"audioOpusParamsMaxplaybackrate"in k&&(g.audio.opus_params.maxplaybackrate=k.audioOpusParamsMaxplaybackrate),"audioOpusParamsStereo"in k&&(g.audio.opus_params.stereo=k.audioOpusParamsStereo),"audioOpusParamsSpropStereo"in k&&(g.audio.opus_params.sprop_stereo=k.audioOpusParamsSpropStereo),"audioOpusParamsMinptime"in k&&(g.audio.opus_params.minptime=k.audioOpusParamsMinptime),"audioOpusParamsPtime"in k&&(g.audio.opus_params.ptime=k.audioOpusParamsPtime),"audioOpusParamsUseinbandfec"in k&&(g.audio.opus_params.useinbandfec=k.audioOpusParamsUseinbandfec),"audioOpusParamsUsedtx"in k&&(g.audio.opus_params.usedtx=k.audioOpusParamsUsedtx)),void 0!==k.video&&(g.video=k.video);const n=Object.keys(k).some(a=>0<=j.indexOf(a));if(g.video&&n&&(g.video={},"videoCodecType"in k&&(g.video.codec_type=k.videoCodecType),"videoBitRate"in k&&(g.video.bit_rate=k.videoBitRate)),g.simulcast&&!b(g.role,g.video))throw new Error("Simulcast can not be used with this browser");return"e2ee"in f&&(!0===g.video&&(g.video={}),g.video&&(g.video.codec_type="VP8"),g.e2ee=!0),g}function f(a,b,d){let e="";window.performance&&(e="["+(window.performance.now()/1e3).toFixed(3)+"]"),a&&(e=e+"["+a+"]"),c()?console.log(e+" "+b+"\n",d):console.info(e+" "+b+"\n",d)}var g="undefined"==typeof globalThis?"undefined"==typeof window?"undefined"==typeof global?"undefined"==typeof self?{}:self:global:window:globalThis,h=function(a,b){return b={exports:{}},a(b,b.exports),b.exports}(function(c){(function(d,a){c.exports=a()})(g,function(){return class{constructor(c){const a=!!RTCRtpSender.prototype.createEncodedStreams;if(!a)throw new Error("E2EE is not supported in this browser");this.worker=null,this.masterKey=new TextEncoder().encode(c),this.onWorkerDisconnect=null}startWorker(){const b=atob("bGV0IG1hc3RlcktleSxtYXRlcmlhbDtjb25zdCBkZXJpdmVLZXlNYXA9bmV3IE1hcCxzZXFOdW1NYXA9bmV3IE1hcCx3cml0ZUlWTWFwPW5ldyBNYXAsc2VxTnVtTGVuZ3RoPTQsc3NyY0xlbmd0aD00LHBhZGRpbmdMZW5ndGg9OCx1bmVuY3J5cHRlZEJ5dGVzPXtrZXk6MTAsZGVsdGE6Myx1bmRlZmluZWQ6MX07ZnVuY3Rpb24gZ2V0U2VxTnVtKGEpe3JldHVybiBzZXFOdW1NYXAuZ2V0KGEpfHwwfWZ1bmN0aW9uIHNldFNlcU51bShhLGIpe3Nl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ml0ZUlWTWFwLmNsZWFyKCkpfTsK");this.worker=new Worker(URL.createObjectURL(new Blob([b],{type:"application/javascript"}))),this.worker.onmessage=c=>{const{operation:a}=c.data;"disconnect"===a&&"function"==typeof this.onWorkerDisconnect&&this.onWorkerDisconnect()},this.worker.postMessage({operation:"setKey",masterKey:this.masterKey})}terminateWorker(){this.worker&&this.worker.terminate()}setupSenderTransform(c){if(c.track){const a=c.createEncodedStreams();this.worker&&this.worker.postMessage({operation:"encrypt",readableStream:a.readableStream,writableStream:a.writableStream},[a.readableStream,a.writableStream])}}setupReceiverTransform(c){const a=c.createEncodedStreams();this.worker&&this.worker.postMessage({operation:"decrypt",readableStream:a.readableStream,writableStream:a.writableStream},[a.readableStream,a.writableStream])}static version(){return"2020.2.0"}}})});class i{constructor(a,b,c,d,e,f){this.role=b,this.channelId=c,this.metadata=d,this.signalingUrl=a,this.options=e,this.constraints=null,this.debug=f,this.clientId=null,this.connectionId=null,this.remoteConnectionIds=[],this.stream=null,this.ws=null,this.pc=null,this.callbacks={disconnect:()=>{},push:()=>{},addstream:()=>{},track:()=>{},removestream:()=>{},removetrack:()=>{},notify:()=>{},log:()=>{},timeout:()=>{}},this.authMetadata=null,this.e2ee=null}on(a,b){"addstream"===a?console.warn("@deprecated addstream callback will be removed in a future version. Use track callback."):"removestream"==a&&console.warn("@deprecated removestream callback will be removed in a future version. Use removetrack callback."),a in this.callbacks&&(this.callbacks[a]=b)}disconnect(){this.clientId=null,this.connectionId=null,this.authMetadata=null,this.remoteConnectionIds=[];const a=new Promise(a=>(this.debug&&console.warn("@deprecated closing MediaStream in disconnect will be removed in a future version. Close every track in the MediaStream by yourself."),!this.stream)?a():(this.stream.getTracks().forEach(a=>{a.stop()}),this.stream=null,a())),b=new Promise((a,b)=>{if(!this.ws)return a();this.ws.onclose=null;let c=5;const d=setInterval(()=>this.ws?3===this.ws.readyState?(this.ws=null,clearInterval(d),a()):(--c,0>c)?(clearInterval(d),b("WebSocket Closing Error")):void 0:(clearInterval(d),b("WebSocket Closing Error")),1e3);this.ws.close()}),c=new Promise((a,b)=>{if(d()&&this.pc)return this.pc.oniceconnectionstatechange=null,this.pc.close(),this.pc=null,a();if(!this.pc||"closed"===this.pc.signalingState)return a();let c=5;const e=setInterval(()=>this.pc?"closed"===this.pc.signalingState?(clearInterval(e),this.pc.oniceconnectionstatechange=null,this.pc=null,a()):(--c,0>c)?(clearInterval(e),b("PeerConnection Closing Error")):void 0:(clearInterval(e),b("PeerConnection Closing Error")),1e3);this.pc.close()});return this.e2ee&&(this.e2ee.terminateWorker(),this.e2ee=null),Promise.all([a,b,c])}startE2EE(){"e2ee"in this.options&&"string"==typeof this.options.e2ee&&(this.e2ee=new h(this.options.e2ee),this.e2ee.onWorkerDisconnect=()=>{this.disconnect()},this.e2ee.startWorker())}signaling(a){return this.trace("CREATE OFFER SDP",a),new Promise((b,c)=>{const d=e(a.sdp||"",this.role,this.channelId,this.metadata,this.options);null===this.ws&&(this.ws=new WebSocket(this.signalingUrl)),this.ws.onclose=a=>{c(a)},this.ws.onopen=()=>{this.trace("SIGNALING CONNECT MESSAGE",d),this.ws&&this.ws.send(JSON.stringify(d))},this.ws.onmessage=a=>{const c=JSON.parse(a.data);"offer"==c.type?(this.clientId=c.client_id,this.connectionId=c.connection_id,this.ws&&(this.ws.onclose=a=>{this.disconnect().then(()=>{this.callbacks.disconnect(a)})},this.ws.onerror=null),"metadata"in c&&(this.authMetadata=c.metadata),this.trace("SIGNALING OFFER MESSAGE",c),this.trace("OFFER SDP",c.sdp),b(c)):"update"==c.type?(this.trace("UPDATE SDP",c.sdp),this.update(c)):"ping"==c.type?c.stats?this.getStats().then(a=>{this.ws&&this.ws.send(JSON.stringify({type:"pong",stats:a}))}):this.ws&&this.ws.send(JSON.stringify({type:"pong"})):"push"==c.type?this.callbacks.push(c):"notify"==c.type&&this.callbacks.notify(c)}})}async createOffer(){const a=new window.RTCPeerConnection({iceServers:[]});if(d()){a.addTransceiver("video",{direction:"recvonly"}),a.addTransceiver("audio",{direction:"recvonly"});const b=await a.createOffer();return a.close(),b}const b=await a.createOffer({offerToReceiveAudio:!0,offerToReceiveVideo:!0});return a.close(),b}async connectPeerConnection(a){const b=a.config||{};let c=b;if(this.e2ee&&(c.encodedInsertableStreams=!0),void 0!==window.RTCPeerConnection.generateCertificate){const a=await window.RTCPeerConnection.generateCertificate({name:"ECDSA",namedCurve:"P-256"});c=Object.assign({certificates:[a]},b)}return this.trace("PEER CONNECTION CONFIG",c),this.pc=new window.RTCPeerConnection(c,this.constraints),void(this.pc.oniceconnectionstatechange=()=>{this.pc&&this.trace("ONICECONNECTIONSTATECHANGE ICECONNECTIONSTATE",this.pc.iceConnectionState)})}async setRemoteDescription(a){this.pc&&(await this.pc.setRemoteDescription(new RTCSessionDescription({type:"offer",sdp:a.sdp})))}async createAnswer(a){if(this.pc){if(this.options.simulcast&&("upstream"===this.role||"sendrecv"===this.role||"sendonly"===this.role)&&a.encodings){const b=this.pc.getTransceivers().find(a=>{if(a.mid&&0<=a.mid.indexOf("video")&&null==a.currentDirection)return a});if(!b)throw new Error("Simulcast Error");await this.setSenderParameters(b,a.encodings)}const b=await this.pc.createAnswer();await this.pc.setLocalDescription(b)}}sendAnswer(){this.pc&&this.ws&&this.pc.localDescription&&(this.trace("ANSWER SDP",this.pc.localDescription.sdp),this.ws.send(JSON.stringify({type:"answer",sdp:this.pc.localDescription.sdp})))}sendUpdateAnswer(){this.pc&&this.ws&&this.pc.localDescription&&(this.trace("ANSWER SDP",this.pc.localDescription.sdp),this.ws.send(JSON.stringify({type:"update",sdp:this.pc.localDescription.sdp})))}onIceCandidate(){return new Promise((a,b)=>{const c=setInterval(()=>{if(null===this.pc){clearInterval(c);const a=new Error;a.message="ICECANDIDATE TIMEOUT",b(a)}else this.pc&&"connected"===this.pc.iceConnectionState&&(clearInterval(c),a())},100);this.pc&&(this.pc.onicecandidate=b=>{if(this.pc&&this.trace("ONICECANDIDATE ICEGATHERINGSTATE",this.pc.iceGatheringState),null===b.candidate)clearInterval(c),a();else{const a=b.candidate.toJSON(),c=Object.assign(a,{type:"candidate"});this.trace("ONICECANDIDATE CANDIDATE MESSAGE",c),this.ws&&this.ws.send(JSON.stringify(c))}})})}trace(a,b){this.callbacks.log(a,b);this.debug&&f(this.clientId,a,b)}async update(a){await this.setRemoteDescription(a),await this.createAnswer(a),this.sendUpdateAnswer()}setSenderParameters(a,b){const c=a.sender.getParameters();return c.encodings=b,a.sender.setParameters(c)}async getStats(){const a=[];if(!this.pc)return a;const b=await this.pc.getStats();return b.forEach(b=>{a.push(b)}),a}}class j extends i{connect(a){return this.options.multistream?this.multiStream(a):this.singleStream(a)}async singleStream(a){let b=0;this.options.timeout&&0{const a=new Error;a.message="CONNECTION TIMEOUT",this.callbacks.timeout(),this.disconnect(),Promise.reject(a)},this.options.timeout)),await this.disconnect(),this.startE2EE();const c=await this.createOffer(),d=await this.signaling(c);return await this.connectPeerConnection(d),await this.setRemoteDescription(d),a.getTracks().forEach(b=>{this.pc&&this.pc.addTrack(b,a)}),this.stream=a,await this.createAnswer(d),this.sendAnswer(),this.pc&&this.e2ee&&this.pc.getSenders().forEach(a=>{this.e2ee&&this.e2ee.setupSenderTransform(a)}),await this.onIceCandidate(),clearTimeout(b),a}async multiStream(a){let b=0;this.options.timeout&&0{const a=new Error;a.message="CONNECTION TIMEOUT",this.callbacks.timeout(),this.disconnect(),Promise.reject(a)},this.options.timeout)),await this.disconnect(),this.startE2EE();const c=await this.createOffer(),d=await this.signaling(c);return await this.connectPeerConnection(d),this.pc&&(this.pc.ontrack=a=>{const b=a.streams[0];b&&"default"!==b.id&&b.id!==this.connectionId&&(this.e2ee&&this.e2ee.setupReceiverTransform(a.receiver),this.callbacks.track(a),b.onremovetrack=a=>{if(this.callbacks.removetrack(a),a.target){const b=this.remoteConnectionIds.indexOf(a.target.id);-1{this.pc&&this.pc.addTrack(b,a)}),this.stream=a,await this.createAnswer(d),this.sendAnswer(),this.pc&&this.e2ee&&this.pc.getSenders().forEach(a=>{this.e2ee&&this.e2ee.setupSenderTransform(a)}),await this.onIceCandidate(),clearTimeout(b),a}}class k extends i{connect(){return this.options.multistream?this.multiStream():this.singleStream()}async singleStream(){let a=0;this.options.timeout&&0{const a=new Error;a.message="CONNECTION TIMEOUT",this.callbacks.timeout(),this.disconnect(),Promise.reject(a)},this.options.timeout)),await this.disconnect(),this.startE2EE();const b=await this.createOffer(),c=await this.signaling(b);return await this.connectPeerConnection(c),this.pc&&(this.pc.ontrack=a=>{this.stream=a.streams[0];const b=this.stream.id;"default"!==b&&(this.e2ee&&this.e2ee.setupReceiverTransform(a.receiver),this.callbacks.track(a),this.stream.onremovetrack=a=>{if(this.callbacks.removetrack(a),a.target){const b=this.remoteConnectionIds.indexOf(a.target.id);-1{const a=new Error;a.message="CONNECTION TIMEOUT",this.callbacks.timeout(),this.disconnect(),Promise.reject(a)},this.options.timeout)),await this.disconnect(),this.startE2EE();const b=await this.createOffer(),c=await this.signaling(b);return await this.connectPeerConnection(c),this.pc&&(this.pc.ontrack=a=>{const b=a.streams[0];"default"!==b.id&&b.id!==this.connectionId&&(this.e2ee&&this.e2ee.setupReceiverTransform(a.receiver),this.callbacks.track(a),b.onremovetrack=a=>{if(this.callbacks.removetrack(a),a.target){const b=this.remoteConnectionIds.indexOf(a.target.id);-1{"audio"===a&&"boolean"==typeof k[a]||"video"===a&&"boolean"==typeof k[a]||0<=h.indexOf(a)&&null!==k[a]||0<=i.indexOf(a)&&null!==k[a]||0<=j.indexOf(a)&&null!==k[a]||delete k[a]}),void 0!==k.audio&&(g.audio=k.audio);const l=Object.keys(k).some(a=>0<=h.indexOf(a));g.audio&&l&&(g.audio={},"audioCodecType"in k&&(g.audio.codec_type=k.audioCodecType),"audioBitRate"in k&&(g.audio.bit_rate=k.audioBitRate));const m=Object.keys(k).some(a=>0<=i.indexOf(a));g.audio&&m&&("object"!=typeof g.audio&&(g.audio={}),g.audio.opus_params={},"audioOpusParamsChannels"in k&&(g.audio.opus_params.channels=k.audioOpusParamsChannels),"audioOpusParamsClockRate"in k&&(g.audio.opus_params.clock_rate=k.audioOpusParamsClockRate),"audioOpusParamsMaxplaybackrate"in k&&(g.audio.opus_params.maxplaybackrate=k.audioOpusParamsMaxplaybackrate),"audioOpusParamsStereo"in k&&(g.audio.opus_params.stereo=k.audioOpusParamsStereo),"audioOpusParamsSpropStereo"in k&&(g.audio.opus_params.sprop_stereo=k.audioOpusParamsSpropStereo),"audioOpusParamsMinptime"in k&&(g.audio.opus_params.minptime=k.audioOpusParamsMinptime),"audioOpusParamsPtime"in k&&(g.audio.opus_params.ptime=k.audioOpusParamsPtime),"audioOpusParamsUseinbandfec"in k&&(g.audio.opus_params.useinbandfec=k.audioOpusParamsUseinbandfec),"audioOpusParamsUsedtx"in k&&(g.audio.opus_params.usedtx=k.audioOpusParamsUsedtx)),void 0!==k.video&&(g.video=k.video);const n=Object.keys(k).some(a=>0<=j.indexOf(a));if(g.video&&n&&(g.video={},"videoCodecType"in k&&(g.video.codec_type=k.videoCodecType),"videoBitRate"in k&&(g.video.bit_rate=k.videoBitRate)),g.simulcast&&!b(g.role,g.video))throw new Error("Simulcast can not be used with this browser");return"e2ee"in f&&(!0===g.video&&(g.video={}),g.video&&(g.video.codec_type="VP8"),g.e2ee=!0),g}function f(a,b,d){let e="";window.performance&&(e="["+(window.performance.now()/1e3).toFixed(3)+"]"),a&&(e=e+"["+a+"]"),c()?console.log(e+" "+b+"\n",d):console.info(e+" "+b+"\n",d)}var g="undefined"==typeof globalThis?"undefined"==typeof window?"undefined"==typeof global?"undefined"==typeof self?{}:self:global:window:globalThis,h=function(a,b){return b={exports:{}},a(b,b.exports),b.exports}(function(c){(function(d,a){c.exports=a()})(g,function(){return class{constructor(c){const a=!!RTCRtpSender.prototype.createEncodedStreams;if(!a)throw new Error("E2EE is not supported in this browser");this.worker=null,this.masterKey=new TextEncoder().encode(c),this.onWorkerDisconnect=null}startWorker(){const b=atob("bGV0IG1hc3RlcktleSxtYXRlcmlhbDtjb25zdCBk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0aW9ufSk7Yi5waXBlVGhyb3VnaChkKS5waXBlVG8oYyl9ZWxzZSJzZXRLZXkiPT09Yj8obWFzdGVyS2V5PWEuZGF0YS5tYXN0ZXJLZXksbWF0ZXJpYWw9YXdhaXQgY3J5cHRvLnN1YnRsZS5pbXBvcnRLZXkoInJhdyIsbWFzdGVyS2V5LCJQQktERjIiLCExLFsiZGVyaXZlQml0cyIsImRlcml2ZUtleSJdKSk6ImNsZWFyIj09PWImJihkZXJpdmVLZXlNYXAuY2xlYXIoKSxzZXFOdW1NYXAuY2xlYXIoKSx3cml0ZUlWTWFwLmNsZWFyKCkpfTsK");this.worker=new Worker(URL.createObjectURL(new Blob([b],{type:"application/javascript"}))),this.worker.onmessage=c=>{const{operation:a}=c.data;"disconnect"===a&&"function"==typeof this.onWorkerDisconnect&&this.onWorkerDisconnect()},this.worker.postMessage({operation:"setKey",masterKey:this.masterKey})}terminateWorker(){this.worker&&this.worker.terminate()}setupSenderTransform(c){if(c.track){const a=c.createEncodedStreams();this.worker&&this.worker.postMessage({operation:"encrypt",readableStream:a.readableStream,writableStream:a.writableStream},[a.readableStream,a.writableStream])}}setupReceiverTransform(c){const a=c.createEncodedStreams();this.worker&&this.worker.postMessage({operation:"decrypt",readableStream:a.readableStream,writableStream:a.writableStream},[a.readableStream,a.writableStream])}static version(){return"2020.2.0"}}})});class i{constructor(a,b,c,d,e,f){this.role=b,this.channelId=c,this.metadata=d,this.signalingUrl=a,this.options=e,this.constraints=null,this.debug=f,this.clientId=null,this.connectionId=null,this.remoteConnectionIds=[],this.stream=null,this.ws=null,this.pc=null,this.callbacks={disconnect:()=>{},push:()=>{},addstream:()=>{},track:()=>{},removestream:()=>{},removetrack:()=>{},notify:()=>{},log:()=>{},timeout:()=>{}},this.authMetadata=null,this.e2ee=null}on(a,b){"addstream"===a?console.warn("@deprecated addstream callback will be removed in a future version. Use track callback."):"removestream"==a&&console.warn("@deprecated removestream callback will be removed in a future version. Use removetrack callback."),a in this.callbacks&&(this.callbacks[a]=b)}disconnect(){this.clientId=null,this.connectionId=null,this.authMetadata=null,this.remoteConnectionIds=[];const a=new Promise(a=>(this.debug&&console.warn("@deprecated closing MediaStream in disconnect will be removed in a future version. Close every track in the MediaStream by yourself."),!this.stream)?a():(this.stream.getTracks().forEach(a=>{a.stop()}),this.stream=null,a())),b=new Promise((a,b)=>{if(!this.ws)return a();let c=5;const d=setInterval(()=>this.ws?3===this.ws.readyState?(this.ws=null,clearInterval(d),a()):(--c,0>c)?(clearInterval(d),b("WebSocket Closing Error")):void 0:(clearInterval(d),a()),1e3);this.ws.close()}),c=new Promise((a,b)=>{if(d()&&this.pc)return this.pc.oniceconnectionstatechange=null,this.pc.close(),this.pc=null,a();if(!this.pc||"closed"===this.pc.signalingState)return a();let c=5;const e=setInterval(()=>this.pc?"closed"===this.pc.signalingState?(clearInterval(e),this.pc.oniceconnectionstatechange=null,this.pc=null,a()):(--c,0>c)?(clearInterval(e),b("PeerConnection Closing Error")):void 0:(clearInterval(e),a()),1e3);this.pc.close()});return this.e2ee&&(this.e2ee.terminateWorker(),this.e2ee=null),Promise.all([a,b,c])}startE2EE(){"e2ee"in this.options&&"string"==typeof this.options.e2ee&&(this.e2ee=new h(this.options.e2ee),this.e2ee.onWorkerDisconnect=()=>{this.disconnect()},this.e2ee.startWorker())}signaling(a){return this.trace("CREATE OFFER SDP",a),new Promise((b,c)=>{const d=e(a.sdp||"",this.role,this.channelId,this.metadata,this.options);null===this.ws&&(this.ws=new WebSocket(this.signalingUrl)),this.ws.onclose=a=>{c(a)},this.ws.onopen=()=>{this.trace("SIGNALING CONNECT MESSAGE",d),this.ws&&this.ws.send(JSON.stringify(d))},this.ws.onmessage=a=>{const c=JSON.parse(a.data);"offer"==c.type?(this.clientId=c.client_id,this.connectionId=c.connection_id,this.ws&&(this.ws.onclose=a=>{this.callbacks.disconnect(a),this.disconnect()},this.ws.onerror=null),"metadata"in c&&(this.authMetadata=c.metadata),this.trace("SIGNALING OFFER MESSAGE",c),this.trace("OFFER SDP",c.sdp),b(c)):"update"==c.type?(this.trace("UPDATE SDP",c.sdp),this.update(c)):"ping"==c.type?c.stats?this.getStats().then(a=>{this.ws&&this.ws.send(JSON.stringify({type:"pong",stats:a}))}):this.ws&&this.ws.send(JSON.stringify({type:"pong"})):"push"==c.type?this.callbacks.push(c):"notify"==c.type&&this.callbacks.notify(c)}})}async createOffer(){const a=new window.RTCPeerConnection({iceServers:[]});if(d()){a.addTransceiver("video",{direction:"recvonly"}),a.addTransceiver("audio",{direction:"recvonly"});const b=await a.createOffer();return a.close(),b}const b=await a.createOffer({offerToReceiveAudio:!0,offerToReceiveVideo:!0});return a.close(),b}async connectPeerConnection(a){const b=a.config||{};let c=b;if(this.e2ee&&(c.encodedInsertableStreams=!0),void 0!==window.RTCPeerConnection.generateCertificate){const a=await window.RTCPeerConnection.generateCertificate({name:"ECDSA",namedCurve:"P-256"});c=Object.assign({certificates:[a]},b)}return this.trace("PEER CONNECTION CONFIG",c),this.pc=new window.RTCPeerConnection(c,this.constraints),void(this.pc.oniceconnectionstatechange=()=>{this.pc&&this.trace("ONICECONNECTIONSTATECHANGE ICECONNECTIONSTATE",this.pc.iceConnectionState)})}async setRemoteDescription(a){this.pc&&(await this.pc.setRemoteDescription(new RTCSessionDescription({type:"offer",sdp:a.sdp})))}async createAnswer(a){if(this.pc){if(this.options.simulcast&&("upstream"===this.role||"sendrecv"===this.role||"sendonly"===this.role)&&a.encodings){const b=this.pc.getTransceivers().find(a=>{if(a.mid&&0<=a.mid.indexOf("video")&&null==a.currentDirection)return a});if(!b)throw new Error("Simulcast Error");await this.setSenderParameters(b,a.encodings)}const b=await this.pc.createAnswer();await this.pc.setLocalDescription(b)}}sendAnswer(){this.pc&&this.ws&&this.pc.localDescription&&(this.trace("ANSWER SDP",this.pc.localDescription.sdp),this.ws.send(JSON.stringify({type:"answer",sdp:this.pc.localDescription.sdp})))}sendUpdateAnswer(){this.pc&&this.ws&&this.pc.localDescription&&(this.trace("ANSWER SDP",this.pc.localDescription.sdp),this.ws.send(JSON.stringify({type:"update",sdp:this.pc.localDescription.sdp})))}onIceCandidate(){return new Promise((a,b)=>{const c=setInterval(()=>{if(null===this.pc){clearInterval(c);const a=new Error;a.message="ICECANDIDATE TIMEOUT",b(a)}else this.pc&&"connected"===this.pc.iceConnectionState&&(clearInterval(c),a())},100);this.pc&&(this.pc.onicecandidate=b=>{if(this.pc&&this.trace("ONICECANDIDATE ICEGATHERINGSTATE",this.pc.iceGatheringState),null===b.candidate)clearInterval(c),a();else{const a=b.candidate.toJSON(),c=Object.assign(a,{type:"candidate"});this.trace("ONICECANDIDATE CANDIDATE MESSAGE",c),this.ws&&this.ws.send(JSON.stringify(c))}})})}trace(a,b){this.callbacks.log(a,b);this.debug&&f(this.clientId,a,b)}async update(a){await this.setRemoteDescription(a),await this.createAnswer(a),this.sendUpdateAnswer()}setSenderParameters(a,b){const c=a.sender.getParameters();return c.encodings=b,a.sender.setParameters(c)}async getStats(){const a=[];if(!this.pc)return a;const b=await this.pc.getStats();return b.forEach(b=>{a.push(b)}),a}}class j extends i{connect(a){return this.options.multistream?this.multiStream(a):this.singleStream(a)}async singleStream(a){let b=0;this.options.timeout&&0{const a=new Error;a.message="CONNECTION TIMEOUT",this.callbacks.timeout(),this.disconnect(),Promise.reject(a)},this.options.timeout)),await this.disconnect(),this.startE2EE();const c=await this.createOffer(),d=await this.signaling(c);return await this.connectPeerConnection(d),await this.setRemoteDescription(d),a.getTracks().forEach(b=>{this.pc&&this.pc.addTrack(b,a)}),this.stream=a,await this.createAnswer(d),this.sendAnswer(),this.pc&&this.e2ee&&this.pc.getSenders().forEach(a=>{this.e2ee&&this.e2ee.setupSenderTransform(a)}),await this.onIceCandidate(),clearTimeout(b),a}async multiStream(a){let b=0;this.options.timeout&&0{const a=new Error;a.message="CONNECTION TIMEOUT",this.callbacks.timeout(),this.disconnect(),Promise.reject(a)},this.options.timeout)),await this.disconnect(),this.startE2EE();const c=await this.createOffer(),d=await this.signaling(c);return await this.connectPeerConnection(d),this.pc&&(this.pc.ontrack=a=>{const b=a.streams[0];b&&"default"!==b.id&&b.id!==this.connectionId&&(this.e2ee&&this.e2ee.setupReceiverTransform(a.receiver),this.callbacks.track(a),b.onremovetrack=a=>{if(this.callbacks.removetrack(a),a.target){const b=this.remoteConnectionIds.indexOf(a.target.id);-1{this.pc&&this.pc.addTrack(b,a)}),this.stream=a,await this.createAnswer(d),this.sendAnswer(),this.pc&&this.e2ee&&this.pc.getSenders().forEach(a=>{this.e2ee&&this.e2ee.setupSenderTransform(a)}),await this.onIceCandidate(),clearTimeout(b),a}}class k extends i{connect(){return this.options.multistream?this.multiStream():this.singleStream()}async singleStream(){let a=0;this.options.timeout&&0{const a=new Error;a.message="CONNECTION TIMEOUT",this.callbacks.timeout(),this.disconnect(),Promise.reject(a)},this.options.timeout)),await this.disconnect(),this.startE2EE();const b=await this.createOffer(),c=await this.signaling(b);return await this.connectPeerConnection(c),this.pc&&(this.pc.ontrack=a=>{this.stream=a.streams[0];const b=this.stream.id;"default"!==b&&(this.e2ee&&this.e2ee.setupReceiverTransform(a.receiver),this.callbacks.track(a),this.stream.onremovetrack=a=>{if(this.callbacks.removetrack(a),a.target){const b=this.remoteConnectionIds.indexOf(a.target.id);-1{const a=new Error;a.message="CONNECTION TIMEOUT",this.callbacks.timeout(),this.disconnect(),Promise.reject(a)},this.options.timeout)),await this.disconnect(),this.startE2EE();const b=await this.createOffer(),c=await this.signaling(b);return await this.connectPeerConnection(c),this.pc&&(this.pc.ontrack=a=>{const b=a.streams[0];"default"!==b.id&&b.id!==this.connectionId&&(this.e2ee&&this.e2ee.setupReceiverTransform(a.receiver),this.callbacks.track(a),b.onremovetrack=a=>{if(this.callbacks.removetrack(a),a.target){const b=this.remoteConnectionIds.indexOf(a.target.id);-1 Date: Thu, 27 Aug 2020 11:25:57 +0900 Subject: [PATCH 12/18] =?UTF-8?q?CHANGELOG=20=E3=82=92=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGES.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 2b825c32..bb48f157 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -13,6 +13,8 @@ - [UPDATE] sora-e2ee を 2020.2.0 に上げる - @voluntas +- [FIX] disconnect() を複数回実行した場合に例外が発生しないようにする + - @yuitowest ## 2020.1.5 From a9060d4b913cd3bbf9a5856a7e7fa54a18ce81c7 Mon Sep 17 00:00:00 2001 From: Yuki Ito Date: Wed, 5 Aug 2020 11:17:27 +0900 Subject: [PATCH 13/18] =?UTF-8?q?spotlight=20=E3=81=AE=20type=20=E3=82=92?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/types.d.ts | 4 ++-- src/types.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dist/types.d.ts b/dist/types.d.ts index e5c26301..5c77b06b 100644 --- a/dist/types.d.ts +++ b/dist/types.d.ts @@ -42,7 +42,7 @@ export declare type SignalingConnectMessage = { metadata?: Json; signaling_notify_metadata?: Json; multistream?: boolean; - spotlight?: number; + spotlight?: number | boolean; simulcast?: Simulcast; audio: SignalingAudio; video: SignalingVideo; @@ -82,7 +82,7 @@ export declare type ConnectionOptions = { videoCodecType?: VideoCodecType; videoBitRate?: number; multistream?: boolean; - spotlight?: number; + spotlight?: boolean | number; simulcast?: boolean; simulcastQuality?: SimulcastQuality; clientId?: string; diff --git a/src/types.ts b/src/types.ts index cd740d4a..489d7533 100644 --- a/src/types.ts +++ b/src/types.ts @@ -52,7 +52,7 @@ export type SignalingConnectMessage = { metadata?: Json; signaling_notify_metadata?: Json; multistream?: boolean; - spotlight?: number; + spotlight?: number | boolean; simulcast?: Simulcast; audio: SignalingAudio; video: SignalingVideo; @@ -95,7 +95,7 @@ export type ConnectionOptions = { videoCodecType?: VideoCodecType; videoBitRate?: number; multistream?: boolean; - spotlight?: number; + spotlight?: boolean | number; simulcast?: boolean; simulcastQuality?: SimulcastQuality; clientId?: string; From 9d9ca37b35332c6494b92c7db80d41f9ae9eaef1 Mon Sep 17 00:00:00 2001 From: Yuki Ito Date: Fri, 7 Aug 2020 15:18:37 +0900 Subject: [PATCH 14/18] =?UTF-8?q?spotlight=20number=20=E3=82=92=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/sora.js | 4 ++++ dist/sora.min.js | 2 +- dist/sora.min.js.map | 2 +- dist/types.d.ts | 2 ++ src/types.ts | 2 ++ src/utils.ts | 5 ++++- 6 files changed, 14 insertions(+), 3 deletions(-) diff --git a/dist/sora.js b/dist/sora.js index 54bf65c4..f421679f 100644 --- a/dist/sora.js +++ b/dist/sora.js @@ -119,6 +119,10 @@ // spotlight if ("spotlight" in options) { message.spotlight = options.spotlight; + if ("spotlightNumber" in options) { + // eslint-disable-next-line @typescript-eslint/camelcase + message.spotlight_number = options.spotlightNumber; + } } } if ("simulcast" in options || "simulcastQuality" in options) { diff --git a/dist/sora.min.js b/dist/sora.min.js index 6ec2154d..3f24067e 100644 --- a/dist/sora.min.js +++ b/dist/sora.min.js @@ -4,5 +4,5 @@ * @version: 2020.1.5-dev * @author: Shiguredo Inc. * @license: Apache-2.0 - **/(function(a,b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):(a="undefined"==typeof globalThis?a||self:globalThis,a.Sora=b())})(this,function(){'use strict';function a(){const a=window.navigator.userAgent.toLocaleLowerCase();if(-1!==a.indexOf("edge"))return"edge";return-1!==a.indexOf("chrome")&&-1===a.indexOf("edge")?"chrome":-1!==a.indexOf("safari")&&-1===a.indexOf("chrome")?"safari":-1===a.indexOf("opera")?-1===a.indexOf("firefox")?null:"firefox":"opera"}function b(b,c){if("boolean"!=typeof c&&"VP9"===c.codec_type)return!1;if(("upstream"===b||"sendrecv"===b||"sendonly"===b)&&"firefox"===a())return!1;if(("upstream"===b||"sendrecv"===b||"sendonly"===b)&&"safari"===a())return!1;if(("downstream"===b||"recvonly"===b)&&"safari"===a()){const a=window.navigator.appVersion.toLowerCase(),b=/version\/([\d.]+)/.exec(a);if(!b)return!1;const d=b.pop();return!!(d&&12{"audio"===a&&"boolean"==typeof k[a]||"video"===a&&"boolean"==typeof k[a]||0<=h.indexOf(a)&&null!==k[a]||0<=i.indexOf(a)&&null!==k[a]||0<=j.indexOf(a)&&null!==k[a]||delete k[a]}),void 0!==k.audio&&(g.audio=k.audio);const l=Object.keys(k).some(a=>0<=h.indexOf(a));g.audio&&l&&(g.audio={},"audioCodecType"in k&&(g.audio.codec_type=k.audioCodecType),"audioBitRate"in k&&(g.audio.bit_rate=k.audioBitRate));const m=Object.keys(k).some(a=>0<=i.indexOf(a));g.audio&&m&&("object"!=typeof g.audio&&(g.audio={}),g.audio.opus_params={},"audioOpusParamsChannels"in k&&(g.audio.opus_params.channels=k.audioOpusParamsChannels),"audioOpusParamsClockRate"in k&&(g.audio.opus_params.clock_rate=k.audioOpusParamsClockRate),"audioOpusParamsMaxplaybackrate"in k&&(g.audio.opus_params.maxplaybackrate=k.audioOpusParamsMaxplaybackrate),"audioOpusParamsStereo"in k&&(g.audio.opus_params.stereo=k.audioOpusParamsStereo),"audioOpusParamsSpropStereo"in k&&(g.audio.opus_params.sprop_stereo=k.audioOpusParamsSpropStereo),"audioOpusParamsMinptime"in k&&(g.audio.opus_params.minptime=k.audioOpusParamsMinptime),"audioOpusParamsPtime"in k&&(g.audio.opus_params.ptime=k.audioOpusParamsPtime),"audioOpusParamsUseinbandfec"in k&&(g.audio.opus_params.useinbandfec=k.audioOpusParamsUseinbandfec),"audioOpusParamsUsedtx"in k&&(g.audio.opus_params.usedtx=k.audioOpusParamsUsedtx)),void 0!==k.video&&(g.video=k.video);const n=Object.keys(k).some(a=>0<=j.indexOf(a));if(g.video&&n&&(g.video={},"videoCodecType"in k&&(g.video.codec_type=k.videoCodecType),"videoBitRate"in k&&(g.video.bit_rate=k.videoBitRate)),g.simulcast&&!b(g.role,g.video))throw new Error("Simulcast can not be used with this browser");return"e2ee"in f&&(!0===g.video&&(g.video={}),g.video&&(g.video.codec_type="VP8"),g.e2ee=!0),g}function f(a,b,d){let e="";window.performance&&(e="["+(window.performance.now()/1e3).toFixed(3)+"]"),a&&(e=e+"["+a+"]"),c()?console.log(e+" "+b+"\n",d):console.info(e+" "+b+"\n",d)}var g="undefined"==typeof globalThis?"undefined"==typeof window?"undefined"==typeof global?"undefined"==typeof self?{}:self:global:window:globalThis,h=function(a,b){return b={exports:{}},a(b,b.exports),b.exports}(function(c){(function(d,a){c.exports=a()})(g,function(){return class{constructor(c){const a=!!RTCRtpSender.prototype.createEncodedStreams;if(!a)throw new Error("E2EE is not supported in this browser");this.worker=null,this.masterKey=new TextEncoder().encode(c),this.onWorkerDisconnect=null}startWorker(){const b=atob("bGV0IG1hc3RlcktleSxtYXRlcmlhbDtjb25zdCBkZXJpdmVLZXlNYXA9bmV3IE1hcCxzZXFOdW1NYXA9bmV3IE1hcCx3cml0ZUlWTWFwPW5ldyBNYXAsc2VxTnVtTGVuZ3RoPTQsc3NyY0xlbmd0aD00LHBhZGRpbmdMZW5ndGg9OCx1bmVuY3J5cHRlZEJ5dGVzPXtrZXk6MTAsZGVsdGE6Myx1bmRlZmluZWQ6MX07ZnVuY3Rpb24gZ2V0U2VxTnVtKGEpe3JldHVybiBzZXFOdW1NYXAuZ2V0KGEpfHwwfWZ1bmN0aW9uIHNldFNlcU51bShhLGIpe3NlcU51bU1hcC5zZXQoYSxiKX1hc3luYyBmdW5jdGlvbiBnZW5lcmF0ZURlcml2ZUtleShhLGIpe2xldCBjPWRlcml2ZUtleU1hcC5nZXQoYSk7cmV0dXJuIGN8fChjP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YS50eXBlXSttLmJ5dGVMZW5ndGgpLG89bmV3IFVpbnQ4QXJyYXkobik7by5zZXQobmV3IFVpbnQ4QXJyYXkoYS5kYXRhLDAsdW5lbmNyeXB0ZWRCeXRlc1thLnR5cGVdKSksby5zZXQobmV3IFVpbnQ4QXJyYXkobSksdW5lbmNyeXB0ZWRCeXRlc1thLnR5cGVdKSxhLmRhdGE9bixiLmVucXVldWUoYSl9b25tZXNzYWdlPWFzeW5jIGE9Pntjb25zdHtvcGVyYXRpb246Yn09YS5kYXRhO2lmKCJlbmNyeXB0Ij09PWIpe2NvbnN0e3JlYWRhYmxlU3RyZWFtOmIsd3JpdGFibGVTdHJlYW06Y309YS5kYXRhLGQ9bmV3IFRyYW5zZm9ybVN0cmVhbSh7dHJhbnNmb3JtOmVuY3J5cHRGdW5jdGlvbn0pO2IucGlwZVRocm91Z2goZCkucGlwZVRvKGMpfWVsc2UgaWYoImRlY3J5cHQiPT09Yil7Y29uc3R7cmVhZGFibGVTdHJlYW06Yix3cml0YWJsZVN0cmVhbTpjfT1hLmRhdGEsZD1uZXcgVHJhbnNmb3JtU3RyZWFtKHt0cmFuc2Zvcm06ZGVjcnlwdEZ1bmN0aW9ufSk7Yi5waXBlVGhyb3VnaChkKS5waXBlVG8oYyl9ZWxzZSJzZXRLZXkiPT09Yj8obWFzdGVyS2V5PWEuZGF0YS5tYXN0ZXJLZXksbWF0ZXJpYWw9YXdhaXQgY3J5cHRvLnN1YnRsZS5pbXBvcnRLZXkoInJhdyIsbWFzdGVyS2V5LCJQQktERjIiLCExLFsiZGVyaXZlQml0cyIsImRlcml2ZUtleSJdKSk6ImNsZWFyIj09PWImJihkZXJpdmVLZXlNYXAuY2xlYXIoKSxzZXFOdW1NYXAuY2xlYXIoKSx3cml0ZUlWTWFwLmNsZWFyKCkpfTsK");this.worker=new Worker(URL.createObjectURL(new Blob([b],{type:"application/javascript"}))),this.worker.onmessage=c=>{const{operation:a}=c.data;"disconnect"===a&&"function"==typeof this.onWorkerDisconnect&&this.onWorkerDisconnect()},this.worker.postMessage({operation:"setKey",masterKey:this.masterKey})}terminateWorker(){this.worker&&this.worker.terminate()}setupSenderTransform(c){if(c.track){const a=c.createEncodedStreams();this.worker&&this.worker.postMessage({operation:"encrypt",readableStream:a.readableStream,writableStream:a.writableStream},[a.readableStream,a.writableStream])}}setupReceiverTransform(c){const a=c.createEncodedStreams();this.worker&&this.worker.postMessage({operation:"decrypt",readableStream:a.readableStream,writableStream:a.writableStream},[a.readableStream,a.writableStream])}static version(){return"2020.2.0"}}})});class i{constructor(a,b,c,d,e,f){this.role=b,this.channelId=c,this.metadata=d,this.signalingUrl=a,this.options=e,this.constraints=null,this.debug=f,this.clientId=null,this.connectionId=null,this.remoteConnectionIds=[],this.stream=null,this.ws=null,this.pc=null,this.callbacks={disconnect:()=>{},push:()=>{},addstream:()=>{},track:()=>{},removestream:()=>{},removetrack:()=>{},notify:()=>{},log:()=>{},timeout:()=>{}},this.authMetadata=null,this.e2ee=null}on(a,b){"addstream"===a?console.warn("@deprecated addstream callback will be removed in a future version. Use track callback."):"removestream"==a&&console.warn("@deprecated removestream callback will be removed in a future version. Use removetrack callback."),a in this.callbacks&&(this.callbacks[a]=b)}disconnect(){this.clientId=null,this.connectionId=null,this.authMetadata=null,this.remoteConnectionIds=[];const a=new Promise(a=>(this.debug&&console.warn("@deprecated closing MediaStream in disconnect will be removed in a future version. Close every track in the MediaStream by yourself."),!this.stream)?a():(this.stream.getTracks().forEach(a=>{a.stop()}),this.stream=null,a())),b=new Promise((a,b)=>{if(!this.ws)return a();let c=5;const d=setInterval(()=>this.ws?3===this.ws.readyState?(this.ws=null,clearInterval(d),a()):(--c,0>c)?(clearInterval(d),b("WebSocket Closing Error")):void 0:(clearInterval(d),a()),1e3);this.ws.close()}),c=new Promise((a,b)=>{if(d()&&this.pc)return this.pc.oniceconnectionstatechange=null,this.pc.close(),this.pc=null,a();if(!this.pc||"closed"===this.pc.signalingState)return a();let c=5;const e=setInterval(()=>this.pc?"closed"===this.pc.signalingState?(clearInterval(e),this.pc.oniceconnectionstatechange=null,this.pc=null,a()):(--c,0>c)?(clearInterval(e),b("PeerConnection Closing Error")):void 0:(clearInterval(e),a()),1e3);this.pc.close()});return this.e2ee&&(this.e2ee.terminateWorker(),this.e2ee=null),Promise.all([a,b,c])}startE2EE(){"e2ee"in this.options&&"string"==typeof this.options.e2ee&&(this.e2ee=new h(this.options.e2ee),this.e2ee.onWorkerDisconnect=()=>{this.disconnect()},this.e2ee.startWorker())}signaling(a){return this.trace("CREATE OFFER SDP",a),new Promise((b,c)=>{const d=e(a.sdp||"",this.role,this.channelId,this.metadata,this.options);null===this.ws&&(this.ws=new WebSocket(this.signalingUrl)),this.ws.onclose=a=>{c(a)},this.ws.onopen=()=>{this.trace("SIGNALING CONNECT MESSAGE",d),this.ws&&this.ws.send(JSON.stringify(d))},this.ws.onmessage=a=>{const c=JSON.parse(a.data);"offer"==c.type?(this.clientId=c.client_id,this.connectionId=c.connection_id,this.ws&&(this.ws.onclose=a=>{this.callbacks.disconnect(a),this.disconnect()},this.ws.onerror=null),"metadata"in c&&(this.authMetadata=c.metadata),this.trace("SIGNALING OFFER MESSAGE",c),this.trace("OFFER SDP",c.sdp),b(c)):"update"==c.type?(this.trace("UPDATE SDP",c.sdp),this.update(c)):"ping"==c.type?c.stats?this.getStats().then(a=>{this.ws&&this.ws.send(JSON.stringify({type:"pong",stats:a}))}):this.ws&&this.ws.send(JSON.stringify({type:"pong"})):"push"==c.type?this.callbacks.push(c):"notify"==c.type&&this.callbacks.notify(c)}})}async createOffer(){const a=new window.RTCPeerConnection({iceServers:[]});if(d()){a.addTransceiver("video",{direction:"recvonly"}),a.addTransceiver("audio",{direction:"recvonly"});const b=await a.createOffer();return a.close(),b}const b=await a.createOffer({offerToReceiveAudio:!0,offerToReceiveVideo:!0});return a.close(),b}async connectPeerConnection(a){const b=a.config||{};let c=b;if(this.e2ee&&(c.encodedInsertableStreams=!0),void 0!==window.RTCPeerConnection.generateCertificate){const a=await window.RTCPeerConnection.generateCertificate({name:"ECDSA",namedCurve:"P-256"});c=Object.assign({certificates:[a]},b)}return this.trace("PEER CONNECTION CONFIG",c),this.pc=new window.RTCPeerConnection(c,this.constraints),void(this.pc.oniceconnectionstatechange=()=>{this.pc&&this.trace("ONICECONNECTIONSTATECHANGE ICECONNECTIONSTATE",this.pc.iceConnectionState)})}async setRemoteDescription(a){this.pc&&(await this.pc.setRemoteDescription(new RTCSessionDescription({type:"offer",sdp:a.sdp})))}async createAnswer(a){if(this.pc){if(this.options.simulcast&&("upstream"===this.role||"sendrecv"===this.role||"sendonly"===this.role)&&a.encodings){const b=this.pc.getTransceivers().find(a=>{if(a.mid&&0<=a.mid.indexOf("video")&&null==a.currentDirection)return a});if(!b)throw new Error("Simulcast Error");await this.setSenderParameters(b,a.encodings)}const b=await this.pc.createAnswer();await this.pc.setLocalDescription(b)}}sendAnswer(){this.pc&&this.ws&&this.pc.localDescription&&(this.trace("ANSWER SDP",this.pc.localDescription.sdp),this.ws.send(JSON.stringify({type:"answer",sdp:this.pc.localDescription.sdp})))}sendUpdateAnswer(){this.pc&&this.ws&&this.pc.localDescription&&(this.trace("ANSWER SDP",this.pc.localDescription.sdp),this.ws.send(JSON.stringify({type:"update",sdp:this.pc.localDescription.sdp})))}onIceCandidate(){return new Promise((a,b)=>{const c=setInterval(()=>{if(null===this.pc){clearInterval(c);const a=new Error;a.message="ICECANDIDATE TIMEOUT",b(a)}else this.pc&&"connected"===this.pc.iceConnectionState&&(clearInterval(c),a())},100);this.pc&&(this.pc.onicecandidate=b=>{if(this.pc&&this.trace("ONICECANDIDATE ICEGATHERINGSTATE",this.pc.iceGatheringState),null===b.candidate)clearInterval(c),a();else{const a=b.candidate.toJSON(),c=Object.assign(a,{type:"candidate"});this.trace("ONICECANDIDATE CANDIDATE MESSAGE",c),this.ws&&this.ws.send(JSON.stringify(c))}})})}trace(a,b){this.callbacks.log(a,b);this.debug&&f(this.clientId,a,b)}async update(a){await this.setRemoteDescription(a),await this.createAnswer(a),this.sendUpdateAnswer()}setSenderParameters(a,b){const c=a.sender.getParameters();return c.encodings=b,a.sender.setParameters(c)}async getStats(){const a=[];if(!this.pc)return a;const b=await this.pc.getStats();return b.forEach(b=>{a.push(b)}),a}}class j extends i{connect(a){return this.options.multistream?this.multiStream(a):this.singleStream(a)}async singleStream(a){let b=0;this.options.timeout&&0{const a=new Error;a.message="CONNECTION TIMEOUT",this.callbacks.timeout(),this.disconnect(),Promise.reject(a)},this.options.timeout)),await this.disconnect(),this.startE2EE();const c=await this.createOffer(),d=await this.signaling(c);return await this.connectPeerConnection(d),await this.setRemoteDescription(d),a.getTracks().forEach(b=>{this.pc&&this.pc.addTrack(b,a)}),this.stream=a,await this.createAnswer(d),this.sendAnswer(),this.pc&&this.e2ee&&this.pc.getSenders().forEach(a=>{this.e2ee&&this.e2ee.setupSenderTransform(a)}),await this.onIceCandidate(),clearTimeout(b),a}async multiStream(a){let b=0;this.options.timeout&&0{const a=new Error;a.message="CONNECTION TIMEOUT",this.callbacks.timeout(),this.disconnect(),Promise.reject(a)},this.options.timeout)),await this.disconnect(),this.startE2EE();const c=await this.createOffer(),d=await this.signaling(c);return await this.connectPeerConnection(d),this.pc&&(this.pc.ontrack=a=>{const b=a.streams[0];b&&"default"!==b.id&&b.id!==this.connectionId&&(this.e2ee&&this.e2ee.setupReceiverTransform(a.receiver),this.callbacks.track(a),b.onremovetrack=a=>{if(this.callbacks.removetrack(a),a.target){const b=this.remoteConnectionIds.indexOf(a.target.id);-1{this.pc&&this.pc.addTrack(b,a)}),this.stream=a,await this.createAnswer(d),this.sendAnswer(),this.pc&&this.e2ee&&this.pc.getSenders().forEach(a=>{this.e2ee&&this.e2ee.setupSenderTransform(a)}),await this.onIceCandidate(),clearTimeout(b),a}}class k extends i{connect(){return this.options.multistream?this.multiStream():this.singleStream()}async singleStream(){let a=0;this.options.timeout&&0{const a=new Error;a.message="CONNECTION TIMEOUT",this.callbacks.timeout(),this.disconnect(),Promise.reject(a)},this.options.timeout)),await this.disconnect(),this.startE2EE();const b=await this.createOffer(),c=await this.signaling(b);return await this.connectPeerConnection(c),this.pc&&(this.pc.ontrack=a=>{this.stream=a.streams[0];const b=this.stream.id;"default"!==b&&(this.e2ee&&this.e2ee.setupReceiverTransform(a.receiver),this.callbacks.track(a),this.stream.onremovetrack=a=>{if(this.callbacks.removetrack(a),a.target){const b=this.remoteConnectionIds.indexOf(a.target.id);-1{const a=new Error;a.message="CONNECTION TIMEOUT",this.callbacks.timeout(),this.disconnect(),Promise.reject(a)},this.options.timeout)),await this.disconnect(),this.startE2EE();const b=await this.createOffer(),c=await this.signaling(b);return await this.connectPeerConnection(c),this.pc&&(this.pc.ontrack=a=>{const b=a.streams[0];"default"!==b.id&&b.id!==this.connectionId&&(this.e2ee&&this.e2ee.setupReceiverTransform(a.receiver),this.callbacks.track(a),b.onremovetrack=a=>{if(this.callbacks.removetrack(a),a.target){const b=this.remoteConnectionIds.indexOf(a.target.id);-1{"audio"===a&&"boolean"==typeof k[a]||"video"===a&&"boolean"==typeof k[a]||0<=h.indexOf(a)&&null!==k[a]||0<=i.indexOf(a)&&null!==k[a]||0<=j.indexOf(a)&&null!==k[a]||delete k[a]}),void 0!==k.audio&&(g.audio=k.audio);const l=Object.keys(k).some(a=>0<=h.indexOf(a));g.audio&&l&&(g.audio={},"audioCodecType"in k&&(g.audio.codec_type=k.audioCodecType),"audioBitRate"in k&&(g.audio.bit_rate=k.audioBitRate));const m=Object.keys(k).some(a=>0<=i.indexOf(a));g.audio&&m&&("object"!=typeof g.audio&&(g.audio={}),g.audio.opus_params={},"audioOpusParamsChannels"in k&&(g.audio.opus_params.channels=k.audioOpusParamsChannels),"audioOpusParamsClockRate"in k&&(g.audio.opus_params.clock_rate=k.audioOpusParamsClockRate),"audioOpusParamsMaxplaybackrate"in k&&(g.audio.opus_params.maxplaybackrate=k.audioOpusParamsMaxplaybackrate),"audioOpusParamsStereo"in k&&(g.audio.opus_params.stereo=k.audioOpusParamsStereo),"audioOpusParamsSpropStereo"in k&&(g.audio.opus_params.sprop_stereo=k.audioOpusParamsSpropStereo),"audioOpusParamsMinptime"in k&&(g.audio.opus_params.minptime=k.audioOpusParamsMinptime),"audioOpusParamsPtime"in k&&(g.audio.opus_params.ptime=k.audioOpusParamsPtime),"audioOpusParamsUseinbandfec"in k&&(g.audio.opus_params.useinbandfec=k.audioOpusParamsUseinbandfec),"audioOpusParamsUsedtx"in k&&(g.audio.opus_params.usedtx=k.audioOpusParamsUsedtx)),void 0!==k.video&&(g.video=k.video);const n=Object.keys(k).some(a=>0<=j.indexOf(a));if(g.video&&n&&(g.video={},"videoCodecType"in k&&(g.video.codec_type=k.videoCodecType),"videoBitRate"in k&&(g.video.bit_rate=k.videoBitRate)),g.simulcast&&!b(g.role,g.video))throw new Error("Simulcast can not be used with this browser");return"e2ee"in f&&(!0===g.video&&(g.video={}),g.video&&(g.video.codec_type="VP8"),g.e2ee=!0),g}function f(a,b,d){let e="";window.performance&&(e="["+(window.performance.now()/1e3).toFixed(3)+"]"),a&&(e=e+"["+a+"]"),c()?console.log(e+" "+b+"\n",d):console.info(e+" "+b+"\n",d)}var g="undefined"==typeof globalThis?"undefined"==typeof window?"undefined"==typeof global?"undefined"==typeof self?{}:self:global:window:globalThis,h=function(a,b){return b={exports:{}},a(b,b.exports),b.exports}(function(c){(function(d,a){c.exports=a()})(g,function(){return class{constructor(c){const a=!!RTCRtpSender.prototype.createEncodedStreams;if(!a)throw new Error("E2EE is not supported in this browser");this.worker=null,this.masterKey=new TextEncoder().encode(c),this.onWorkerDisconnect=null}startWorker(){const b=atob("bGV0IG1hc3RlcktleSxtYXRlcmlhbDtjb25zdCBkZXJpdmVLZXlNYXA9bmV3IE1hcCxzZXFOdW1NYXA9bmV3IE1hcCx3cml0ZUlWTWFwPW5ldyBNYXAsc2VxTnVtTGVuZ3RoPTQsc3NyY0xlbmd0aD00LHBhZGRpbmdMZW5ndGg9OCx1bmVuY3J5cHRlZEJ5dGVzPX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dyIsbWFzdGVyS2V5LCJQQktERjIiLCExLFsiZGVyaXZlQml0cyIsImRlcml2ZUtleSJdKSk6ImNsZWFyIj09PWImJihkZXJpdmVLZXlNYXAuY2xlYXIoKSxzZXFOdW1NYXAuY2xlYXIoKSx3cml0ZUlWTWFwLmNsZWFyKCkpfTsK");this.worker=new Worker(URL.createObjectURL(new Blob([b],{type:"application/javascript"}))),this.worker.onmessage=c=>{const{operation:a}=c.data;"disconnect"===a&&"function"==typeof this.onWorkerDisconnect&&this.onWorkerDisconnect()},this.worker.postMessage({operation:"setKey",masterKey:this.masterKey})}terminateWorker(){this.worker&&this.worker.terminate()}setupSenderTransform(c){if(c.track){const a=c.createEncodedStreams();this.worker&&this.worker.postMessage({operation:"encrypt",readableStream:a.readableStream,writableStream:a.writableStream},[a.readableStream,a.writableStream])}}setupReceiverTransform(c){const a=c.createEncodedStreams();this.worker&&this.worker.postMessage({operation:"decrypt",readableStream:a.readableStream,writableStream:a.writableStream},[a.readableStream,a.writableStream])}static version(){return"2020.2.0"}}})});class i{constructor(a,b,c,d,e,f){this.role=b,this.channelId=c,this.metadata=d,this.signalingUrl=a,this.options=e,this.constraints=null,this.debug=f,this.clientId=null,this.connectionId=null,this.remoteConnectionIds=[],this.stream=null,this.ws=null,this.pc=null,this.callbacks={disconnect:()=>{},push:()=>{},addstream:()=>{},track:()=>{},removestream:()=>{},removetrack:()=>{},notify:()=>{},log:()=>{},timeout:()=>{}},this.authMetadata=null,this.e2ee=null}on(a,b){"addstream"===a?console.warn("@deprecated addstream callback will be removed in a future version. Use track callback."):"removestream"==a&&console.warn("@deprecated removestream callback will be removed in a future version. Use removetrack callback."),a in this.callbacks&&(this.callbacks[a]=b)}disconnect(){this.clientId=null,this.connectionId=null,this.authMetadata=null,this.remoteConnectionIds=[];const a=new Promise(a=>(this.debug&&console.warn("@deprecated closing MediaStream in disconnect will be removed in a future version. Close every track in the MediaStream by yourself."),!this.stream)?a():(this.stream.getTracks().forEach(a=>{a.stop()}),this.stream=null,a())),b=new Promise((a,b)=>{if(!this.ws)return a();let c=5;const d=setInterval(()=>this.ws?3===this.ws.readyState?(this.ws=null,clearInterval(d),a()):(--c,0>c)?(clearInterval(d),b("WebSocket Closing Error")):void 0:(clearInterval(d),a()),1e3);this.ws.close()}),c=new Promise((a,b)=>{if(d()&&this.pc)return this.pc.oniceconnectionstatechange=null,this.pc.close(),this.pc=null,a();if(!this.pc||"closed"===this.pc.signalingState)return a();let c=5;const e=setInterval(()=>this.pc?"closed"===this.pc.signalingState?(clearInterval(e),this.pc.oniceconnectionstatechange=null,this.pc=null,a()):(--c,0>c)?(clearInterval(e),b("PeerConnection Closing Error")):void 0:(clearInterval(e),a()),1e3);this.pc.close()});return this.e2ee&&(this.e2ee.terminateWorker(),this.e2ee=null),Promise.all([a,b,c])}startE2EE(){"e2ee"in this.options&&"string"==typeof this.options.e2ee&&(this.e2ee=new h(this.options.e2ee),this.e2ee.onWorkerDisconnect=()=>{this.disconnect()},this.e2ee.startWorker())}signaling(a){return this.trace("CREATE OFFER SDP",a),new Promise((b,c)=>{const d=e(a.sdp||"",this.role,this.channelId,this.metadata,this.options);null===this.ws&&(this.ws=new WebSocket(this.signalingUrl)),this.ws.onclose=a=>{c(a)},this.ws.onopen=()=>{this.trace("SIGNALING CONNECT MESSAGE",d),this.ws&&this.ws.send(JSON.stringify(d))},this.ws.onmessage=a=>{const c=JSON.parse(a.data);"offer"==c.type?(this.clientId=c.client_id,this.connectionId=c.connection_id,this.ws&&(this.ws.onclose=a=>{this.callbacks.disconnect(a),this.disconnect()},this.ws.onerror=null),"metadata"in c&&(this.authMetadata=c.metadata),this.trace("SIGNALING OFFER MESSAGE",c),this.trace("OFFER SDP",c.sdp),b(c)):"update"==c.type?(this.trace("UPDATE SDP",c.sdp),this.update(c)):"ping"==c.type?c.stats?this.getStats().then(a=>{this.ws&&this.ws.send(JSON.stringify({type:"pong",stats:a}))}):this.ws&&this.ws.send(JSON.stringify({type:"pong"})):"push"==c.type?this.callbacks.push(c):"notify"==c.type&&this.callbacks.notify(c)}})}async createOffer(){const a=new window.RTCPeerConnection({iceServers:[]});if(d()){a.addTransceiver("video",{direction:"recvonly"}),a.addTransceiver("audio",{direction:"recvonly"});const b=await a.createOffer();return a.close(),b}const b=await a.createOffer({offerToReceiveAudio:!0,offerToReceiveVideo:!0});return a.close(),b}async connectPeerConnection(a){const b=a.config||{};let c=b;if(this.e2ee&&(c.encodedInsertableStreams=!0),void 0!==window.RTCPeerConnection.generateCertificate){const a=await window.RTCPeerConnection.generateCertificate({name:"ECDSA",namedCurve:"P-256"});c=Object.assign({certificates:[a]},b)}return this.trace("PEER CONNECTION CONFIG",c),this.pc=new window.RTCPeerConnection(c,this.constraints),void(this.pc.oniceconnectionstatechange=()=>{this.pc&&this.trace("ONICECONNECTIONSTATECHANGE ICECONNECTIONSTATE",this.pc.iceConnectionState)})}async setRemoteDescription(a){this.pc&&(await this.pc.setRemoteDescription(new RTCSessionDescription({type:"offer",sdp:a.sdp})))}async createAnswer(a){if(this.pc){if(this.options.simulcast&&("upstream"===this.role||"sendrecv"===this.role||"sendonly"===this.role)&&a.encodings){const b=this.pc.getTransceivers().find(a=>{if(a.mid&&0<=a.mid.indexOf("video")&&null==a.currentDirection)return a});if(!b)throw new Error("Simulcast Error");await this.setSenderParameters(b,a.encodings)}const b=await this.pc.createAnswer();await this.pc.setLocalDescription(b)}}sendAnswer(){this.pc&&this.ws&&this.pc.localDescription&&(this.trace("ANSWER SDP",this.pc.localDescription.sdp),this.ws.send(JSON.stringify({type:"answer",sdp:this.pc.localDescription.sdp})))}sendUpdateAnswer(){this.pc&&this.ws&&this.pc.localDescription&&(this.trace("ANSWER SDP",this.pc.localDescription.sdp),this.ws.send(JSON.stringify({type:"update",sdp:this.pc.localDescription.sdp})))}onIceCandidate(){return new Promise((a,b)=>{const c=setInterval(()=>{if(null===this.pc){clearInterval(c);const a=new Error;a.message="ICECANDIDATE TIMEOUT",b(a)}else this.pc&&"connected"===this.pc.iceConnectionState&&(clearInterval(c),a())},100);this.pc&&(this.pc.onicecandidate=b=>{if(this.pc&&this.trace("ONICECANDIDATE ICEGATHERINGSTATE",this.pc.iceGatheringState),null===b.candidate)clearInterval(c),a();else{const a=b.candidate.toJSON(),c=Object.assign(a,{type:"candidate"});this.trace("ONICECANDIDATE CANDIDATE MESSAGE",c),this.ws&&this.ws.send(JSON.stringify(c))}})})}trace(a,b){this.callbacks.log(a,b);this.debug&&f(this.clientId,a,b)}async update(a){await this.setRemoteDescription(a),await this.createAnswer(a),this.sendUpdateAnswer()}setSenderParameters(a,b){const c=a.sender.getParameters();return c.encodings=b,a.sender.setParameters(c)}async getStats(){const a=[];if(!this.pc)return a;const b=await this.pc.getStats();return b.forEach(b=>{a.push(b)}),a}}class j extends i{connect(a){return this.options.multistream?this.multiStream(a):this.singleStream(a)}async singleStream(a){let b=0;this.options.timeout&&0{const a=new Error;a.message="CONNECTION TIMEOUT",this.callbacks.timeout(),this.disconnect(),Promise.reject(a)},this.options.timeout)),await this.disconnect(),this.startE2EE();const c=await this.createOffer(),d=await this.signaling(c);return await this.connectPeerConnection(d),await this.setRemoteDescription(d),a.getTracks().forEach(b=>{this.pc&&this.pc.addTrack(b,a)}),this.stream=a,await this.createAnswer(d),this.sendAnswer(),this.pc&&this.e2ee&&this.pc.getSenders().forEach(a=>{this.e2ee&&this.e2ee.setupSenderTransform(a)}),await this.onIceCandidate(),clearTimeout(b),a}async multiStream(a){let b=0;this.options.timeout&&0{const a=new Error;a.message="CONNECTION TIMEOUT",this.callbacks.timeout(),this.disconnect(),Promise.reject(a)},this.options.timeout)),await this.disconnect(),this.startE2EE();const c=await this.createOffer(),d=await this.signaling(c);return await this.connectPeerConnection(d),this.pc&&(this.pc.ontrack=a=>{const b=a.streams[0];b&&"default"!==b.id&&b.id!==this.connectionId&&(this.e2ee&&this.e2ee.setupReceiverTransform(a.receiver),this.callbacks.track(a),b.onremovetrack=a=>{if(this.callbacks.removetrack(a),a.target){const b=this.remoteConnectionIds.indexOf(a.target.id);-1{this.pc&&this.pc.addTrack(b,a)}),this.stream=a,await this.createAnswer(d),this.sendAnswer(),this.pc&&this.e2ee&&this.pc.getSenders().forEach(a=>{this.e2ee&&this.e2ee.setupSenderTransform(a)}),await this.onIceCandidate(),clearTimeout(b),a}}class k extends i{connect(){return this.options.multistream?this.multiStream():this.singleStream()}async singleStream(){let a=0;this.options.timeout&&0{const a=new Error;a.message="CONNECTION TIMEOUT",this.callbacks.timeout(),this.disconnect(),Promise.reject(a)},this.options.timeout)),await this.disconnect(),this.startE2EE();const b=await this.createOffer(),c=await this.signaling(b);return await this.connectPeerConnection(c),this.pc&&(this.pc.ontrack=a=>{this.stream=a.streams[0];const b=this.stream.id;"default"!==b&&(this.e2ee&&this.e2ee.setupReceiverTransform(a.receiver),this.callbacks.track(a),this.stream.onremovetrack=a=>{if(this.callbacks.removetrack(a),a.target){const b=this.remoteConnectionIds.indexOf(a.target.id);-1{const a=new Error;a.message="CONNECTION TIMEOUT",this.callbacks.timeout(),this.disconnect(),Promise.reject(a)},this.options.timeout)),await this.disconnect(),this.startE2EE();const b=await this.createOffer(),c=await this.signaling(b);return await this.connectPeerConnection(c),this.pc&&(this.pc.ontrack=a=>{const b=a.streams[0];"default"!==b.id&&b.id!==this.connectionId&&(this.e2ee&&this.e2ee.setupReceiverTransform(a.receiver),this.callbacks.track(a),b.onremovetrack=a=>{if(this.callbacks.removetrack(a),a.target){const b=this.remoteConnectionIds.indexOf(a.target.id);-1{const{operation:b}=a.data;\"disconnect\"===b&&\"function\"==typeof this.onWorkerDisconnect&&this.onWorkerDisconnect()},this.worker.postMessage({operation:\"setKey\",masterKey:this.masterKey})}terminateWorker(){this.worker&&this.worker.terminate()}setupSenderTransform(a){if(a.track){const b=a.createEncodedStreams();this.worker&&this.worker.postMessage({operation:\"encrypt\",readableStream:b.readableStream,writableStream:b.writableStream},[b.readableStream,b.writableStream])}}setupReceiverTransform(a){const b=a.createEncodedStreams();this.worker&&this.worker.postMessage({operation:\"decrypt\",readableStream:b.readableStream,writableStream:b.writableStream},[b.readableStream,b.writableStream])}static version(){return\"2020.2.0\"}}});\n//# sourceMappingURL=sora_e2ee.min.js.map\n"],"names":["a","b","module","this","constructor","RTCRtpSender","prototype","createEncodedStreams","Error","worker","masterKey","TextEncoder","encode","onWorkerDisconnect","startWorker","atob","Worker","URL","createObjectURL","Blob","type","onmessage","operation","data","postMessage","terminateWorker","terminate","setupSenderTransform","track","readableStream","writableStream","setupReceiverTransform","version"],"mappings":";;;;;;w6IAMI,CAAC,SAASA,CAAT,CAAWC,CAAX,CAAa,CAAsDC,SAAA,CAAeD,CAAC,EAAwH,CAA5M,EAA8ME,CAA9M,CAAmN,UAAU,CAAc,MAAO,MAAO,CAACC,WAAW,CAACJ,CAAD,CAAG,CAAC,KAAMC,CAAAA,CAAC,CAAC,CAAC,CAACI,YAAY,CAACC,SAAb,CAAuBC,oBAAjC,CAAsD,GAAG,CAACN,CAAJ,CAAM,KAAM,IAAIO,CAAAA,KAAJ,CAAU,uCAAV,CAAN,CAAyD,KAAKC,MAAL,CAAY,IAAZ,CAAiB,KAAKC,SAAL,CAAe,GAAIC,CAAAA,WAAJ,GAAkBC,MAAlB,CAAyBZ,CAAzB,CAAhC,CAA4D,KAAKa,kBAAL,CAAwB,IAAK,CAAAC,WAAW,EAAE,CAAC,KAAMd,CAAAA,CAAC,CAACe,IAAI,CAAC,0+IAAD,CAAZ,CAAy/I,KAAKN,MAAL,CAAY,GAAIO,CAAAA,MAAJ,CAAWC,GAAG,CAACC,eAAJ,CAAoB,GAAIC,CAAAA,IAAJ,CAAS,CAACnB,CAAD,CAAT,CAAa,CAACoB,IAAI,CAAC,wBAAN,CAAb,CAApB,CAAX,CAAZ,CAA2F,KAAKX,MAAL,CAAYY,SAAZ,CAAsBrB,CAAC,EAAE,CAAC,KAAK,CAACsB,SAAS,CAACrB,CAAX,EAAcD,CAAC,CAACuB,IAArB,CAA0B,eAAetB,CAAf,EAAkB,YAAY,MAAO,MAAKY,kBAA1C,EAA8D,KAAKA,kBAAL,EAA0B,CAAvO,CAAwO,KAAKJ,MAAL,CAAYe,WAAZ,CAAwB,CAACF,SAAS,CAAC,QAAX,CAAoBZ,SAAS,CAAC,KAAKA,SAAnC,CAAxB,CAAuE,CAAAe,eAAe,EAAE,CAAC,KAAKhB,MAAL,EAAa,KAAKA,MAAL,CAAYiB,SAAZ,EAAwB,CAAAC,oBAAoB,CAAC3B,CAAD,CAAG,CAAC,GAAGA,CAAC,CAAC4B,KAAL,CAAW,CAAC,KAAM3B,CAAAA,CAAC,CAACD,CAAC,CAACO,oBAAF,EAAR,CAAiC,KAAKE,MAAL,EAAa,KAAKA,MAAL,CAAYe,WAAZ,CAAwB,CAACF,SAAS,CAAC,SAAX,CAAqBO,cAAc,CAAC5B,CAAC,CAAC4B,cAAtC,CAAqDC,cAAc,CAAC7B,CAAC,CAAC6B,cAAtE,CAAxB,CAA8G,CAAC7B,CAAC,CAAC4B,cAAH,CAAkB5B,CAAC,CAAC6B,cAApB,CAA9G,CAAmJ,CAAC,CAAAC,sBAAsB,CAAC/B,CAAD,CAAG,CAAC,KAAMC,CAAAA,CAAC,CAACD,CAAC,CAACO,oBAAF,EAAR,CAAiC,KAAKE,MAAL,EAAa,KAAKA,MAAL,CAAYe,WAAZ,CAAwB,CAACF,SAAS,CAAC,SAAX,CAAqBO,cAAc,CAAC5B,CAAC,CAAC4B,cAAtC,CAAqDC,cAAc,CAAC7B,CAAC,CAAC6B,cAAtE,CAAxB,CAA8G,CAAC7B,CAAC,CAAC4B,cAAH,CAAkB5B,CAAC,CAAC6B,cAApB,CAA9G,CAAmJ,OAAOE,CAAAA,OAAP,EAAgB,CAAC,MAAM,UAAW,CAA9iL,CAAgjL,CAAzyL"} \ No newline at end of file +{"version":3,"file":"sora.min.js","sources":["../node_modules/sora-e2ee/dist/sora_e2ee.min.js"],"sourcesContent":["/**\n * sora-e2ee\n * WebRTC SFU Sora JavaScript E2EE Library\n * @version: 2020.2.0\n * @author: Shiguredo Inc.\n * @license: Apache-2.0\n **/(function(a,b){\"object\"==typeof exports&&\"undefined\"!=typeof module?module.exports=b():\"function\"==typeof define&&define.amd?define(b):(a=\"undefined\"==typeof globalThis?a||self:globalThis,a.SoraE2EE=b())})(this,function(){'use strict';return class a{constructor(a){const b=!!RTCRtpSender.prototype.createEncodedStreams;if(!b)throw new Error(\"E2EE is not supported in this browser\");this.worker=null,this.masterKey=new TextEncoder().encode(a),this.onWorkerDisconnect=null}startWorker(){const a=atob(\"bGV0IG1hc3RlcktleSxtYXRlcmlhbDtjb25zdCBkZXJpdmVLZXlNYXA9bmV3IE1hcCxzZXFOdW1NYXA9bmV3IE1hcCx3cml0ZUlWTWFwPW5ldyBNYXAsc2VxTnVtTGVuZ3RoPTQsc3NyY0xlbmd0aD00LHBhZGRpbmdMZW5ndGg9OCx1bmVuY3J5cHRlZEJ5dGVzPXtrZXk6MTAsZGVsdGE6Myx1bmRlZmluZWQ6MX07ZnVuY3Rpb24gZ2V0U2VxTnVtKGEpe3JldHVybiBzZXFOdW1NYXAuZ2V0KGEpfHwwfWZ1bmN0aW9uIHNldFNlcU51bShhLGIpe3NlcU51bU1hcC5zZXQoYSxiKX1hc3luYyBmdW5jdGlvbiBnZW5lcmF0ZURlcml2ZUtleShhLGIpe2xldCBjPWRlcml2ZUtleU1hcC5nZXQoYSk7cmV0dXJuIGN8fChjPWF3YWl0IGNyeXB0by5zdWJ0bGUuZGVyaXZlS2V5KHtuYW1lOiJQQktERjIiLHNhbHQ6YixpdGVyYXRpb25zOjFlNCxoYXNoOiJTSEEtMjU2In0sbWF0ZXJpYWwse25hbWU6IkFFUy1HQ00iLGxlbmd0aDoxMjh9LCExLFsiZW5jcnlwdCIsImRlY3J5cHQiXSksZGVyaXZlS2V5TWFwLnNldChhLGMpKSxjfWFzeW5jIGZ1bmN0aW9uIGdlbmVyYXRlSVYoYSxiLGMpe2xldCBkPXdyaXRlSVZNYXAuZ2V0KGEpO2lmKCFkKXtjb25zdCB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hYmxlU3RyZWFtOmIsd3JpdGFibGVTdHJlYW06Y309YS5kYXRhLGQ9bmV3IFRyYW5zZm9ybVN0cmVhbSh7dHJhbnNmb3JtOmVuY3J5cHRGdW5jdGlvbn0pO2IucGlwZVRocm91Z2goZCkucGlwZVRvKGMpfWVsc2UgaWYoImRlY3J5cHQiPT09Yil7Y29uc3R7cmVhZGFibGVTdHJlYW06Yix3cml0YWJsZVN0cmVhbTpjfT1hLmRhdGEsZD1uZXcgVHJhbnNmb3JtU3RyZWFtKHt0cmFuc2Zvcm06ZGVjcnlwdEZ1bmN0aW9ufSk7Yi5waXBlVGhyb3VnaChkKS5waXBlVG8oYyl9ZWxzZSJzZXRLZXkiPT09Yj8obWFzdGVyS2V5PWEuZGF0YS5tYXN0ZXJLZXksbWF0ZXJpYWw9YXdhaXQgY3J5cHRvLnN1YnRsZS5pbXBvcnRLZXkoInJhdyIsbWFzdGVyS2V5LCJQQktERjIiLCExLFsiZGVyaXZlQml0cyIsImRlcml2ZUtleSJdKSk6ImNsZWFyIj09PWImJihkZXJpdmVLZXlNYXAuY2xlYXIoKSxzZXFOdW1NYXAuY2xlYXIoKSx3cml0ZUlWTWFwLmNsZWFyKCkpfTsK\");this.worker=new Worker(URL.createObjectURL(new Blob([a],{type:\"application/javascript\"}))),this.worker.onmessage=a=>{const{operation:b}=a.data;\"disconnect\"===b&&\"function\"==typeof this.onWorkerDisconnect&&this.onWorkerDisconnect()},this.worker.postMessage({operation:\"setKey\",masterKey:this.masterKey})}terminateWorker(){this.worker&&this.worker.terminate()}setupSenderTransform(a){if(a.track){const b=a.createEncodedStreams();this.worker&&this.worker.postMessage({operation:\"encrypt\",readableStream:b.readableStream,writableStream:b.writableStream},[b.readableStream,b.writableStream])}}setupReceiverTransform(a){const b=a.createEncodedStreams();this.worker&&this.worker.postMessage({operation:\"decrypt\",readableStream:b.readableStream,writableStream:b.writableStream},[b.readableStream,b.writableStream])}static version(){return\"2020.2.0\"}}});\n//# sourceMappingURL=sora_e2ee.min.js.map\n"],"names":["a","b","module","this","constructor","RTCRtpSender","prototype","createEncodedStreams","Error","worker","masterKey","TextEncoder","encode","onWorkerDisconnect","startWorker","atob","Worker","URL","createObjectURL","Blob","type","onmessage","operation","data","postMessage","terminateWorker","terminate","setupSenderTransform","track","readableStream","writableStream","setupReceiverTransform","version"],"mappings":";;;;;;s+IAMI,CAAC,SAASA,CAAT,CAAWC,CAAX,CAAa,CAAsDC,SAAA,CAAeD,CAAC,EAAwH,CAA5M,EAA8ME,CAA9M,CAAmN,UAAU,CAAc,MAAO,MAAO,CAACC,WAAW,CAACJ,CAAD,CAAG,CAAC,KAAMC,CAAAA,CAAC,CAAC,CAAC,CAACI,YAAY,CAACC,SAAb,CAAuBC,oBAAjC,CAAsD,GAAG,CAACN,CAAJ,CAAM,KAAM,IAAIO,CAAAA,KAAJ,CAAU,uCAAV,CAAN,CAAyD,KAAKC,MAAL,CAAY,IAAZ,CAAiB,KAAKC,SAAL,CAAe,GAAIC,CAAAA,WAAJ,GAAkBC,MAAlB,CAAyBZ,CAAzB,CAAhC,CAA4D,KAAKa,kBAAL,CAAwB,IAAK,CAAAC,WAAW,EAAE,CAAC,KAAMd,CAAAA,CAAC,CAACe,IAAI,CAAC,0+IAAD,CAAZ,CAAy/I,KAAKN,MAAL,CAAY,GAAIO,CAAAA,MAAJ,CAAWC,GAAG,CAACC,eAAJ,CAAoB,GAAIC,CAAAA,IAAJ,CAAS,CAACnB,CAAD,CAAT,CAAa,CAACoB,IAAI,CAAC,wBAAN,CAAb,CAApB,CAAX,CAAZ,CAA2F,KAAKX,MAAL,CAAYY,SAAZ,CAAsBrB,CAAC,EAAE,CAAC,KAAK,CAACsB,SAAS,CAACrB,CAAX,EAAcD,CAAC,CAACuB,IAArB,CAA0B,eAAetB,CAAf,EAAkB,YAAY,MAAO,MAAKY,kBAA1C,EAA8D,KAAKA,kBAAL,EAA0B,CAAvO,CAAwO,KAAKJ,MAAL,CAAYe,WAAZ,CAAwB,CAACF,SAAS,CAAC,QAAX,CAAoBZ,SAAS,CAAC,KAAKA,SAAnC,CAAxB,CAAuE,CAAAe,eAAe,EAAE,CAAC,KAAKhB,MAAL,EAAa,KAAKA,MAAL,CAAYiB,SAAZ,EAAwB,CAAAC,oBAAoB,CAAC3B,CAAD,CAAG,CAAC,GAAGA,CAAC,CAAC4B,KAAL,CAAW,CAAC,KAAM3B,CAAAA,CAAC,CAACD,CAAC,CAACO,oBAAF,EAAR,CAAiC,KAAKE,MAAL,EAAa,KAAKA,MAAL,CAAYe,WAAZ,CAAwB,CAACF,SAAS,CAAC,SAAX,CAAqBO,cAAc,CAAC5B,CAAC,CAAC4B,cAAtC,CAAqDC,cAAc,CAAC7B,CAAC,CAAC6B,cAAtE,CAAxB,CAA8G,CAAC7B,CAAC,CAAC4B,cAAH,CAAkB5B,CAAC,CAAC6B,cAApB,CAA9G,CAAmJ,CAAC,CAAAC,sBAAsB,CAAC/B,CAAD,CAAG,CAAC,KAAMC,CAAAA,CAAC,CAACD,CAAC,CAACO,oBAAF,EAAR,CAAiC,KAAKE,MAAL,EAAa,KAAKA,MAAL,CAAYe,WAAZ,CAAwB,CAACF,SAAS,CAAC,SAAX,CAAqBO,cAAc,CAAC5B,CAAC,CAAC4B,cAAtC,CAAqDC,cAAc,CAAC7B,CAAC,CAAC6B,cAAtE,CAAxB,CAA8G,CAAC7B,CAAC,CAAC4B,cAAH,CAAkB5B,CAAC,CAAC6B,cAApB,CAA9G,CAAmJ,OAAOE,CAAAA,OAAP,EAAgB,CAAC,MAAM,UAAW,CAA9iL,CAAgjL,CAAzyL"} \ No newline at end of file diff --git a/dist/types.d.ts b/dist/types.d.ts index 5c77b06b..36e48286 100644 --- a/dist/types.d.ts +++ b/dist/types.d.ts @@ -43,6 +43,7 @@ export declare type SignalingConnectMessage = { signaling_notify_metadata?: Json; multistream?: boolean; spotlight?: number | boolean; + spotlight_number?: number; simulcast?: Simulcast; audio: SignalingAudio; video: SignalingVideo; @@ -83,6 +84,7 @@ export declare type ConnectionOptions = { videoBitRate?: number; multistream?: boolean; spotlight?: boolean | number; + spotlightNumber?: number; simulcast?: boolean; simulcastQuality?: SimulcastQuality; clientId?: string; diff --git a/src/types.ts b/src/types.ts index 489d7533..30ae3821 100644 --- a/src/types.ts +++ b/src/types.ts @@ -53,6 +53,7 @@ export type SignalingConnectMessage = { signaling_notify_metadata?: Json; multistream?: boolean; spotlight?: number | boolean; + spotlight_number?: number; simulcast?: Simulcast; audio: SignalingAudio; video: SignalingVideo; @@ -96,6 +97,7 @@ export type ConnectionOptions = { videoBitRate?: number; multistream?: boolean; spotlight?: boolean | number; + spotlightNumber?: number; simulcast?: boolean; simulcastQuality?: SimulcastQuality; clientId?: string; diff --git a/src/utils.ts b/src/utils.ts index 15768093..6d974676 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -115,13 +115,16 @@ export function createSignalingMessage( // eslint-disable-next-line @typescript-eslint/camelcase message.signaling_notify_metadata = options.signalingNotifyMetadata; } - if ("multistream" in options && options.multistream === true) { // multistream message.multistream = true; // spotlight if ("spotlight" in options) { message.spotlight = options.spotlight; + if ("spotlightNumber" in options) { + // eslint-disable-next-line @typescript-eslint/camelcase + message.spotlight_number = options.spotlightNumber; + } } } From 76776b050d7dfbb6c2adc86bb8f11c885235bcde Mon Sep 17 00:00:00 2001 From: Yuki Ito Date: Thu, 27 Aug 2020 15:35:05 +0900 Subject: [PATCH 15/18] =?UTF-8?q?=E3=83=86=E3=82=B9=E3=83=88=E3=82=92?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/utils.test.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/utils.test.ts b/tests/utils.test.ts index a5d10ec3..2fbc0ff8 100644 --- a/tests/utils.test.ts +++ b/tests/utils.test.ts @@ -98,6 +98,20 @@ test("createSignalingMessage multistream option", () => { expect(createSignalingMessage(sdp, role, channelId, null, options2)).toEqual( Object.assign({}, baseExpectedMessage, diff2) ); + // multistream new spotlight + const options3 = { + multistream: true, + spotlight: true, + spotlightNumber: 2, + }; + const diff3 = { + multistream: true, + spotlight: true, + spotlight_number: 2, + }; + expect(createSignalingMessage(sdp, role, channelId, null, options3)).toEqual( + Object.assign({}, baseExpectedMessage, diff3) + ); }); test("createSignalingMessage simulcast option", () => { From 8f15c1f3a3f0596b00ce2fcd11062323127fa9d2 Mon Sep 17 00:00:00 2001 From: Yuki Ito Date: Thu, 27 Aug 2020 15:44:17 +0900 Subject: [PATCH 16/18] =?UTF-8?q?CHANGELOG=20=E3=82=92=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGES.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index bb48f157..9a103176 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -15,6 +15,10 @@ - @voluntas - [FIX] disconnect() を複数回実行した場合に例外が発生しないようにする - @yuitowest +- [UPDATE] 新スポットライトに対応する + - ConnectionOptions に spotlightNumber を追加する + - ConnectionOptions の spotlight に boolean を受け取れるよう修正する + - @yuitowest ## 2020.1.5 From 001c9f968b2568b55f9fb99591a2ebe156e9ed04 Mon Sep 17 00:00:00 2001 From: Yuki Ito Date: Tue, 8 Sep 2020 16:41:32 +0900 Subject: [PATCH 17/18] =?UTF-8?q?CHANGELOG=20=E3=82=92=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 9a103176..0b92211f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -9,7 +9,7 @@ - FIX - バグ修正 -## develop +## 2020.2.0 - [UPDATE] sora-e2ee を 2020.2.0 に上げる - @voluntas From c40938e7cb4f8977ee19a4d957b89eeeb9ce6dd7 Mon Sep 17 00:00:00 2001 From: Yuki Ito Date: Tue, 8 Sep 2020 16:41:51 +0900 Subject: [PATCH 18/18] =?UTF-8?q?=E3=83=90=E3=83=BC=E3=82=B8=E3=83=A7?= =?UTF-8?q?=E3=83=B3=E3=82=92=E6=9B=B4=E6=96=B0=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dist/sora.js | 6 +++--- dist/sora.min.js | 4 ++-- dist/sora.min.js.map | 2 +- package.json | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dist/sora.js b/dist/sora.js index f421679f..35e09908 100644 --- a/dist/sora.js +++ b/dist/sora.js @@ -1,7 +1,7 @@ /** * sora-js-sdk * WebRTC SFU Sora JavaScript SDK - * @version: 2020.1.5-dev + * @version: 2020.2.0 * @author: Shiguredo Inc. * @license: Apache-2.0 **/ @@ -97,7 +97,7 @@ type: "connect", // @ts-ignore // eslint-disable-next-line @typescript-eslint/camelcase - sora_client: `Sora JavaScript SDK ${'2020.1.5-dev'}`, + sora_client: `Sora JavaScript SDK ${'2020.2.0'}`, environment: window.navigator.userAgent, role: role, // eslint-disable-next-line @typescript-eslint/camelcase @@ -889,7 +889,7 @@ }, version: function () { // @ts-ignore - return '2020.1.5-dev'; + return '2020.2.0'; }, }; diff --git a/dist/sora.min.js b/dist/sora.min.js index 3f24067e..f051e19b 100644 --- a/dist/sora.min.js +++ b/dist/sora.min.js @@ -1,8 +1,8 @@ /** * sora-js-sdk * WebRTC SFU Sora JavaScript SDK - * @version: 2020.1.5-dev + * @version: 2020.2.0 * @author: Shiguredo Inc. * @license: Apache-2.0 - **/(function(a,b){"object"==typeof exports&&"undefined"!=typeof module?module.exports=b():"function"==typeof define&&define.amd?define(b):(a="undefined"==typeof globalThis?a||self:globalThis,a.Sora=b())})(this,function(){'use strict';function a(){const a=window.navigator.userAgent.toLocaleLowerCase();if(-1!==a.indexOf("edge"))return"edge";return-1!==a.indexOf("chrome")&&-1===a.indexOf("edge")?"chrome":-1!==a.indexOf("safari")&&-1===a.indexOf("chrome")?"safari":-1===a.indexOf("opera")?-1===a.indexOf("firefox")?null:"firefox":"opera"}function b(b,c){if("boolean"!=typeof c&&"VP9"===c.codec_type)return!1;if(("upstream"===b||"sendrecv"===b||"sendonly"===b)&&"firefox"===a())return!1;if(("upstream"===b||"sendrecv"===b||"sendonly"===b)&&"safari"===a())return!1;if(("downstream"===b||"recvonly"===b)&&"safari"===a()){const a=window.navigator.appVersion.toLowerCase(),b=/version\/([\d.]+)/.exec(a);if(!b)return!1;const d=b.pop();return!!(d&&12{"audio"===a&&"boolean"==typeof k[a]||"video"===a&&"boolean"==typeof k[a]||0<=h.indexOf(a)&&null!==k[a]||0<=i.indexOf(a)&&null!==k[a]||0<=j.indexOf(a)&&null!==k[a]||delete k[a]}),void 0!==k.audio&&(g.audio=k.audio);const l=Object.keys(k).some(a=>0<=h.indexOf(a));g.audio&&l&&(g.audio={},"audioCodecType"in k&&(g.audio.codec_type=k.audioCodecType),"audioBitRate"in k&&(g.audio.bit_rate=k.audioBitRate));const m=Object.keys(k).some(a=>0<=i.indexOf(a));g.audio&&m&&("object"!=typeof g.audio&&(g.audio={}),g.audio.opus_params={},"audioOpusParamsChannels"in k&&(g.audio.opus_params.channels=k.audioOpusParamsChannels),"audioOpusParamsClockRate"in k&&(g.audio.opus_params.clock_rate=k.audioOpusParamsClockRate),"audioOpusParamsMaxplaybackrate"in k&&(g.audio.opus_params.maxplaybackrate=k.audioOpusParamsMaxplaybackrate),"audioOpusParamsStereo"in k&&(g.audio.opus_params.stereo=k.audioOpusParamsStereo),"audioOpusParamsSpropStereo"in k&&(g.audio.opus_params.sprop_stereo=k.audioOpusParamsSpropStereo),"audioOpusParamsMinptime"in k&&(g.audio.opus_params.minptime=k.audioOpusParamsMinptime),"audioOpusParamsPtime"in k&&(g.audio.opus_params.ptime=k.audioOpusParamsPtime),"audioOpusParamsUseinbandfec"in k&&(g.audio.opus_params.useinbandfec=k.audioOpusParamsUseinbandfec),"audioOpusParamsUsedtx"in k&&(g.audio.opus_params.usedtx=k.audioOpusParamsUsedtx)),void 0!==k.video&&(g.video=k.video);const n=Object.keys(k).some(a=>0<=j.indexOf(a));if(g.video&&n&&(g.video={},"videoCodecType"in k&&(g.video.codec_type=k.videoCodecType),"videoBitRate"in k&&(g.video.bit_rate=k.videoBitRate)),g.simulcast&&!b(g.role,g.video))throw new Error("Simulcast can not be used with this browser");return"e2ee"in f&&(!0===g.video&&(g.video={}),g.video&&(g.video.codec_type="VP8"),g.e2ee=!0),g}function f(a,b,d){let e="";window.performance&&(e="["+(window.performance.now()/1e3).toFixed(3)+"]"),a&&(e=e+"["+a+"]"),c()?console.log(e+" "+b+"\n",d):console.info(e+" "+b+"\n",d)}var g="undefined"==typeof globalThis?"undefined"==typeof window?"undefined"==typeof global?"undefined"==typeof self?{}:self:global:window:globalThis,h=function(a,b){return b={exports:{}},a(b,b.exports),b.exports}(function(c){(function(d,a){c.exports=a()})(g,function(){return class{constructor(c){const a=!!RTCRtpSender.prototype.createEncodedStreams;if(!a)throw new Error("E2EE is not supported in this browser");this.worker=null,this.masterKey=new TextEncoder().encode(c),this.onWorkerDisconnect=null}startWorker(){const b=atob("bGV0IG1hc3RlcktleSxtYXRlcmlhbDtjb25zdCBkZXJpdmVLZXlNYXA9bmV3IE1hcCxzZXFOdW1NYXA9bmV3IE1hcCx3cml0ZUlWTWFwPW5ldyBNYXAsc2VxTnVtTGVuZ3RoPTQsc3NyY0xlbmd0aD00LHBhZGRpbmdMZW5ndGg9OCx1bmVuY3J5cHRlZEJ5dGVzPXtrZXk6MTAsZGVsdGE6Myx1bmRlZmluZWQ6MX07ZnVuY3Rpb24gZ2V0U2VxTnVtKGEpe3JldHVybiBzZXFOdW1NYXAuZ2V0KGEpfHwwfW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XIoKSxzZXFOdW1NYXAuY2xlYXIoKSx3cml0ZUlWTWFwLmNsZWFyKCkpfTsK");this.worker=new Worker(URL.createObjectURL(new Blob([b],{type:"application/javascript"}))),this.worker.onmessage=c=>{const{operation:a}=c.data;"disconnect"===a&&"function"==typeof this.onWorkerDisconnect&&this.onWorkerDisconnect()},this.worker.postMessage({operation:"setKey",masterKey:this.masterKey})}terminateWorker(){this.worker&&this.worker.terminate()}setupSenderTransform(c){if(c.track){const a=c.createEncodedStreams();this.worker&&this.worker.postMessage({operation:"encrypt",readableStream:a.readableStream,writableStream:a.writableStream},[a.readableStream,a.writableStream])}}setupReceiverTransform(c){const a=c.createEncodedStreams();this.worker&&this.worker.postMessage({operation:"decrypt",readableStream:a.readableStream,writableStream:a.writableStream},[a.readableStream,a.writableStream])}static version(){return"2020.2.0"}}})});class i{constructor(a,b,c,d,e,f){this.role=b,this.channelId=c,this.metadata=d,this.signalingUrl=a,this.options=e,this.constraints=null,this.debug=f,this.clientId=null,this.connectionId=null,this.remoteConnectionIds=[],this.stream=null,this.ws=null,this.pc=null,this.callbacks={disconnect:()=>{},push:()=>{},addstream:()=>{},track:()=>{},removestream:()=>{},removetrack:()=>{},notify:()=>{},log:()=>{},timeout:()=>{}},this.authMetadata=null,this.e2ee=null}on(a,b){"addstream"===a?console.warn("@deprecated addstream callback will be removed in a future version. Use track callback."):"removestream"==a&&console.warn("@deprecated removestream callback will be removed in a future version. Use removetrack callback."),a in this.callbacks&&(this.callbacks[a]=b)}disconnect(){this.clientId=null,this.connectionId=null,this.authMetadata=null,this.remoteConnectionIds=[];const a=new Promise(a=>(this.debug&&console.warn("@deprecated closing MediaStream in disconnect will be removed in a future version. Close every track in the MediaStream by yourself."),!this.stream)?a():(this.stream.getTracks().forEach(a=>{a.stop()}),this.stream=null,a())),b=new Promise((a,b)=>{if(!this.ws)return a();let c=5;const d=setInterval(()=>this.ws?3===this.ws.readyState?(this.ws=null,clearInterval(d),a()):(--c,0>c)?(clearInterval(d),b("WebSocket Closing Error")):void 0:(clearInterval(d),a()),1e3);this.ws.close()}),c=new Promise((a,b)=>{if(d()&&this.pc)return this.pc.oniceconnectionstatechange=null,this.pc.close(),this.pc=null,a();if(!this.pc||"closed"===this.pc.signalingState)return a();let c=5;const e=setInterval(()=>this.pc?"closed"===this.pc.signalingState?(clearInterval(e),this.pc.oniceconnectionstatechange=null,this.pc=null,a()):(--c,0>c)?(clearInterval(e),b("PeerConnection Closing Error")):void 0:(clearInterval(e),a()),1e3);this.pc.close()});return this.e2ee&&(this.e2ee.terminateWorker(),this.e2ee=null),Promise.all([a,b,c])}startE2EE(){"e2ee"in this.options&&"string"==typeof this.options.e2ee&&(this.e2ee=new h(this.options.e2ee),this.e2ee.onWorkerDisconnect=()=>{this.disconnect()},this.e2ee.startWorker())}signaling(a){return this.trace("CREATE OFFER SDP",a),new Promise((b,c)=>{const d=e(a.sdp||"",this.role,this.channelId,this.metadata,this.options);null===this.ws&&(this.ws=new WebSocket(this.signalingUrl)),this.ws.onclose=a=>{c(a)},this.ws.onopen=()=>{this.trace("SIGNALING CONNECT MESSAGE",d),this.ws&&this.ws.send(JSON.stringify(d))},this.ws.onmessage=a=>{const c=JSON.parse(a.data);"offer"==c.type?(this.clientId=c.client_id,this.connectionId=c.connection_id,this.ws&&(this.ws.onclose=a=>{this.callbacks.disconnect(a),this.disconnect()},this.ws.onerror=null),"metadata"in c&&(this.authMetadata=c.metadata),this.trace("SIGNALING OFFER MESSAGE",c),this.trace("OFFER SDP",c.sdp),b(c)):"update"==c.type?(this.trace("UPDATE SDP",c.sdp),this.update(c)):"ping"==c.type?c.stats?this.getStats().then(a=>{this.ws&&this.ws.send(JSON.stringify({type:"pong",stats:a}))}):this.ws&&this.ws.send(JSON.stringify({type:"pong"})):"push"==c.type?this.callbacks.push(c):"notify"==c.type&&this.callbacks.notify(c)}})}async createOffer(){const a=new window.RTCPeerConnection({iceServers:[]});if(d()){a.addTransceiver("video",{direction:"recvonly"}),a.addTransceiver("audio",{direction:"recvonly"});const b=await a.createOffer();return a.close(),b}const b=await a.createOffer({offerToReceiveAudio:!0,offerToReceiveVideo:!0});return a.close(),b}async connectPeerConnection(a){const b=a.config||{};let c=b;if(this.e2ee&&(c.encodedInsertableStreams=!0),void 0!==window.RTCPeerConnection.generateCertificate){const a=await window.RTCPeerConnection.generateCertificate({name:"ECDSA",namedCurve:"P-256"});c=Object.assign({certificates:[a]},b)}return this.trace("PEER CONNECTION CONFIG",c),this.pc=new window.RTCPeerConnection(c,this.constraints),void(this.pc.oniceconnectionstatechange=()=>{this.pc&&this.trace("ONICECONNECTIONSTATECHANGE ICECONNECTIONSTATE",this.pc.iceConnectionState)})}async setRemoteDescription(a){this.pc&&(await this.pc.setRemoteDescription(new RTCSessionDescription({type:"offer",sdp:a.sdp})))}async createAnswer(a){if(this.pc){if(this.options.simulcast&&("upstream"===this.role||"sendrecv"===this.role||"sendonly"===this.role)&&a.encodings){const b=this.pc.getTransceivers().find(a=>{if(a.mid&&0<=a.mid.indexOf("video")&&null==a.currentDirection)return a});if(!b)throw new Error("Simulcast Error");await this.setSenderParameters(b,a.encodings)}const b=await this.pc.createAnswer();await this.pc.setLocalDescription(b)}}sendAnswer(){this.pc&&this.ws&&this.pc.localDescription&&(this.trace("ANSWER SDP",this.pc.localDescription.sdp),this.ws.send(JSON.stringify({type:"answer",sdp:this.pc.localDescription.sdp})))}sendUpdateAnswer(){this.pc&&this.ws&&this.pc.localDescription&&(this.trace("ANSWER SDP",this.pc.localDescription.sdp),this.ws.send(JSON.stringify({type:"update",sdp:this.pc.localDescription.sdp})))}onIceCandidate(){return new Promise((a,b)=>{const c=setInterval(()=>{if(null===this.pc){clearInterval(c);const a=new Error;a.message="ICECANDIDATE TIMEOUT",b(a)}else this.pc&&"connected"===this.pc.iceConnectionState&&(clearInterval(c),a())},100);this.pc&&(this.pc.onicecandidate=b=>{if(this.pc&&this.trace("ONICECANDIDATE ICEGATHERINGSTATE",this.pc.iceGatheringState),null===b.candidate)clearInterval(c),a();else{const a=b.candidate.toJSON(),c=Object.assign(a,{type:"candidate"});this.trace("ONICECANDIDATE CANDIDATE MESSAGE",c),this.ws&&this.ws.send(JSON.stringify(c))}})})}trace(a,b){this.callbacks.log(a,b);this.debug&&f(this.clientId,a,b)}async update(a){await this.setRemoteDescription(a),await this.createAnswer(a),this.sendUpdateAnswer()}setSenderParameters(a,b){const c=a.sender.getParameters();return c.encodings=b,a.sender.setParameters(c)}async getStats(){const a=[];if(!this.pc)return a;const b=await this.pc.getStats();return b.forEach(b=>{a.push(b)}),a}}class j extends i{connect(a){return this.options.multistream?this.multiStream(a):this.singleStream(a)}async singleStream(a){let b=0;this.options.timeout&&0{const a=new Error;a.message="CONNECTION TIMEOUT",this.callbacks.timeout(),this.disconnect(),Promise.reject(a)},this.options.timeout)),await this.disconnect(),this.startE2EE();const c=await this.createOffer(),d=await this.signaling(c);return await this.connectPeerConnection(d),await this.setRemoteDescription(d),a.getTracks().forEach(b=>{this.pc&&this.pc.addTrack(b,a)}),this.stream=a,await this.createAnswer(d),this.sendAnswer(),this.pc&&this.e2ee&&this.pc.getSenders().forEach(a=>{this.e2ee&&this.e2ee.setupSenderTransform(a)}),await this.onIceCandidate(),clearTimeout(b),a}async multiStream(a){let b=0;this.options.timeout&&0{const a=new Error;a.message="CONNECTION TIMEOUT",this.callbacks.timeout(),this.disconnect(),Promise.reject(a)},this.options.timeout)),await this.disconnect(),this.startE2EE();const c=await this.createOffer(),d=await this.signaling(c);return await this.connectPeerConnection(d),this.pc&&(this.pc.ontrack=a=>{const b=a.streams[0];b&&"default"!==b.id&&b.id!==this.connectionId&&(this.e2ee&&this.e2ee.setupReceiverTransform(a.receiver),this.callbacks.track(a),b.onremovetrack=a=>{if(this.callbacks.removetrack(a),a.target){const b=this.remoteConnectionIds.indexOf(a.target.id);-1{this.pc&&this.pc.addTrack(b,a)}),this.stream=a,await this.createAnswer(d),this.sendAnswer(),this.pc&&this.e2ee&&this.pc.getSenders().forEach(a=>{this.e2ee&&this.e2ee.setupSenderTransform(a)}),await this.onIceCandidate(),clearTimeout(b),a}}class k extends i{connect(){return this.options.multistream?this.multiStream():this.singleStream()}async singleStream(){let a=0;this.options.timeout&&0{const a=new Error;a.message="CONNECTION TIMEOUT",this.callbacks.timeout(),this.disconnect(),Promise.reject(a)},this.options.timeout)),await this.disconnect(),this.startE2EE();const b=await this.createOffer(),c=await this.signaling(b);return await this.connectPeerConnection(c),this.pc&&(this.pc.ontrack=a=>{this.stream=a.streams[0];const b=this.stream.id;"default"!==b&&(this.e2ee&&this.e2ee.setupReceiverTransform(a.receiver),this.callbacks.track(a),this.stream.onremovetrack=a=>{if(this.callbacks.removetrack(a),a.target){const b=this.remoteConnectionIds.indexOf(a.target.id);-1{const a=new Error;a.message="CONNECTION TIMEOUT",this.callbacks.timeout(),this.disconnect(),Promise.reject(a)},this.options.timeout)),await this.disconnect(),this.startE2EE();const b=await this.createOffer(),c=await this.signaling(b);return await this.connectPeerConnection(c),this.pc&&(this.pc.ontrack=a=>{const b=a.streams[0];"default"!==b.id&&b.id!==this.connectionId&&(this.e2ee&&this.e2ee.setupReceiverTransform(a.receiver),this.callbacks.track(a),b.onremovetrack=a=>{if(this.callbacks.removetrack(a),a.target){const b=this.remoteConnectionIds.indexOf(a.target.id);-1{"audio"===a&&"boolean"==typeof k[a]||"video"===a&&"boolean"==typeof k[a]||0<=h.indexOf(a)&&null!==k[a]||0<=i.indexOf(a)&&null!==k[a]||0<=j.indexOf(a)&&null!==k[a]||delete k[a]}),void 0!==k.audio&&(g.audio=k.audio);const l=Object.keys(k).some(a=>0<=h.indexOf(a));g.audio&&l&&(g.audio={},"audioCodecType"in k&&(g.audio.codec_type=k.audioCodecType),"audioBitRate"in k&&(g.audio.bit_rate=k.audioBitRate));const m=Object.keys(k).some(a=>0<=i.indexOf(a));g.audio&&m&&("object"!=typeof g.audio&&(g.audio={}),g.audio.opus_params={},"audioOpusParamsChannels"in k&&(g.audio.opus_params.channels=k.audioOpusParamsChannels),"audioOpusParamsClockRate"in k&&(g.audio.opus_params.clock_rate=k.audioOpusParamsClockRate),"audioOpusParamsMaxplaybackrate"in k&&(g.audio.opus_params.maxplaybackrate=k.audioOpusParamsMaxplaybackrate),"audioOpusParamsStereo"in k&&(g.audio.opus_params.stereo=k.audioOpusParamsStereo),"audioOpusParamsSpropStereo"in k&&(g.audio.opus_params.sprop_stereo=k.audioOpusParamsSpropStereo),"audioOpusParamsMinptime"in k&&(g.audio.opus_params.minptime=k.audioOpusParamsMinptime),"audioOpusParamsPtime"in k&&(g.audio.opus_params.ptime=k.audioOpusParamsPtime),"audioOpusParamsUseinbandfec"in k&&(g.audio.opus_params.useinbandfec=k.audioOpusParamsUseinbandfec),"audioOpusParamsUsedtx"in k&&(g.audio.opus_params.usedtx=k.audioOpusParamsUsedtx)),void 0!==k.video&&(g.video=k.video);const n=Object.keys(k).some(a=>0<=j.indexOf(a));if(g.video&&n&&(g.video={},"videoCodecType"in k&&(g.video.codec_type=k.videoCodecType),"videoBitRate"in k&&(g.video.bit_rate=k.videoBitRate)),g.simulcast&&!b(g.role,g.video))throw new Error("Simulcast can not be used with this browser");return"e2ee"in f&&(!0===g.video&&(g.video={}),g.video&&(g.video.codec_type="VP8"),g.e2ee=!0),g}function f(a,b,d){let e="";window.performance&&(e="["+(window.performance.now()/1e3).toFixed(3)+"]"),a&&(e=e+"["+a+"]"),c()?console.log(e+" "+b+"\n",d):console.info(e+" "+b+"\n",d)}var g="undefined"==typeof globalThis?"undefined"==typeof window?"undefined"==typeof global?"undefined"==typeof self?{}:self:global:window:globalThis,h=function(a,b){return b={exports:{}},a(b,b.exports),b.exports}(function(c){(function(d,a){c.exports=a()})(g,function(){return class{constructor(c){const a=!!RTCRtpSender.prototype.createEncodedStreams;if(!a)throw new Error("E2EE is not supported in this browser");this.worker=null,this.masterKey=new TextEncoder().encode(c),this.onWorkerDisconnect=null}startWorker(){const b=atob("bGV0IG1hc3RlcktleSxtYXRlcmlhbDtjb25zdCBkZXJpdmVLZ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Yi5waXBlVGhyb3VnaChkKS5waXBlVG8oYyl9ZWxzZSJzZXRLZXkiPT09Yj8obWFzdGVyS2V5PWEuZGF0YS5tYXN0ZXJLZXksbWF0ZXJpYWw9YXdhaXQgY3J5cHRvLnN1YnRsZS5pbXBvcnRLZXkoInJhdyIsbWFzdGVyS2V5LCJQQktERjIiLCExLFsiZGVyaXZlQml0cyIsImRlcml2ZUtleSJdKSk6ImNsZWFyIj09PWImJihkZXJpdmVLZXlNYXAuY2xlYXIoKSxzZXFOdW1NYXAuY2xlYXIoKSx3cml0ZUlWTWFwLmNsZWFyKCkpfTsK");this.worker=new Worker(URL.createObjectURL(new Blob([b],{type:"application/javascript"}))),this.worker.onmessage=c=>{const{operation:a}=c.data;"disconnect"===a&&"function"==typeof this.onWorkerDisconnect&&this.onWorkerDisconnect()},this.worker.postMessage({operation:"setKey",masterKey:this.masterKey})}terminateWorker(){this.worker&&this.worker.terminate()}setupSenderTransform(c){if(c.track){const a=c.createEncodedStreams();this.worker&&this.worker.postMessage({operation:"encrypt",readableStream:a.readableStream,writableStream:a.writableStream},[a.readableStream,a.writableStream])}}setupReceiverTransform(c){const a=c.createEncodedStreams();this.worker&&this.worker.postMessage({operation:"decrypt",readableStream:a.readableStream,writableStream:a.writableStream},[a.readableStream,a.writableStream])}static version(){return"2020.2.0"}}})});class i{constructor(a,b,c,d,e,f){this.role=b,this.channelId=c,this.metadata=d,this.signalingUrl=a,this.options=e,this.constraints=null,this.debug=f,this.clientId=null,this.connectionId=null,this.remoteConnectionIds=[],this.stream=null,this.ws=null,this.pc=null,this.callbacks={disconnect:()=>{},push:()=>{},addstream:()=>{},track:()=>{},removestream:()=>{},removetrack:()=>{},notify:()=>{},log:()=>{},timeout:()=>{}},this.authMetadata=null,this.e2ee=null}on(a,b){"addstream"===a?console.warn("@deprecated addstream callback will be removed in a future version. Use track callback."):"removestream"==a&&console.warn("@deprecated removestream callback will be removed in a future version. Use removetrack callback."),a in this.callbacks&&(this.callbacks[a]=b)}disconnect(){this.clientId=null,this.connectionId=null,this.authMetadata=null,this.remoteConnectionIds=[];const a=new Promise(a=>(this.debug&&console.warn("@deprecated closing MediaStream in disconnect will be removed in a future version. Close every track in the MediaStream by yourself."),!this.stream)?a():(this.stream.getTracks().forEach(a=>{a.stop()}),this.stream=null,a())),b=new Promise((a,b)=>{if(!this.ws)return a();let c=5;const d=setInterval(()=>this.ws?3===this.ws.readyState?(this.ws=null,clearInterval(d),a()):(--c,0>c)?(clearInterval(d),b("WebSocket Closing Error")):void 0:(clearInterval(d),a()),1e3);this.ws.close()}),c=new Promise((a,b)=>{if(d()&&this.pc)return this.pc.oniceconnectionstatechange=null,this.pc.close(),this.pc=null,a();if(!this.pc||"closed"===this.pc.signalingState)return a();let c=5;const e=setInterval(()=>this.pc?"closed"===this.pc.signalingState?(clearInterval(e),this.pc.oniceconnectionstatechange=null,this.pc=null,a()):(--c,0>c)?(clearInterval(e),b("PeerConnection Closing Error")):void 0:(clearInterval(e),a()),1e3);this.pc.close()});return this.e2ee&&(this.e2ee.terminateWorker(),this.e2ee=null),Promise.all([a,b,c])}startE2EE(){"e2ee"in this.options&&"string"==typeof this.options.e2ee&&(this.e2ee=new h(this.options.e2ee),this.e2ee.onWorkerDisconnect=()=>{this.disconnect()},this.e2ee.startWorker())}signaling(a){return this.trace("CREATE OFFER SDP",a),new Promise((b,c)=>{const d=e(a.sdp||"",this.role,this.channelId,this.metadata,this.options);null===this.ws&&(this.ws=new WebSocket(this.signalingUrl)),this.ws.onclose=a=>{c(a)},this.ws.onopen=()=>{this.trace("SIGNALING CONNECT MESSAGE",d),this.ws&&this.ws.send(JSON.stringify(d))},this.ws.onmessage=a=>{const c=JSON.parse(a.data);"offer"==c.type?(this.clientId=c.client_id,this.connectionId=c.connection_id,this.ws&&(this.ws.onclose=a=>{this.callbacks.disconnect(a),this.disconnect()},this.ws.onerror=null),"metadata"in c&&(this.authMetadata=c.metadata),this.trace("SIGNALING OFFER MESSAGE",c),this.trace("OFFER SDP",c.sdp),b(c)):"update"==c.type?(this.trace("UPDATE SDP",c.sdp),this.update(c)):"ping"==c.type?c.stats?this.getStats().then(a=>{this.ws&&this.ws.send(JSON.stringify({type:"pong",stats:a}))}):this.ws&&this.ws.send(JSON.stringify({type:"pong"})):"push"==c.type?this.callbacks.push(c):"notify"==c.type&&this.callbacks.notify(c)}})}async createOffer(){const a=new window.RTCPeerConnection({iceServers:[]});if(d()){a.addTransceiver("video",{direction:"recvonly"}),a.addTransceiver("audio",{direction:"recvonly"});const b=await a.createOffer();return a.close(),b}const b=await a.createOffer({offerToReceiveAudio:!0,offerToReceiveVideo:!0});return a.close(),b}async connectPeerConnection(a){const b=a.config||{};let c=b;if(this.e2ee&&(c.encodedInsertableStreams=!0),void 0!==window.RTCPeerConnection.generateCertificate){const a=await window.RTCPeerConnection.generateCertificate({name:"ECDSA",namedCurve:"P-256"});c=Object.assign({certificates:[a]},b)}return this.trace("PEER CONNECTION CONFIG",c),this.pc=new window.RTCPeerConnection(c,this.constraints),void(this.pc.oniceconnectionstatechange=()=>{this.pc&&this.trace("ONICECONNECTIONSTATECHANGE ICECONNECTIONSTATE",this.pc.iceConnectionState)})}async setRemoteDescription(a){this.pc&&(await this.pc.setRemoteDescription(new RTCSessionDescription({type:"offer",sdp:a.sdp})))}async createAnswer(a){if(this.pc){if(this.options.simulcast&&("upstream"===this.role||"sendrecv"===this.role||"sendonly"===this.role)&&a.encodings){const b=this.pc.getTransceivers().find(a=>{if(a.mid&&0<=a.mid.indexOf("video")&&null==a.currentDirection)return a});if(!b)throw new Error("Simulcast Error");await this.setSenderParameters(b,a.encodings)}const b=await this.pc.createAnswer();await this.pc.setLocalDescription(b)}}sendAnswer(){this.pc&&this.ws&&this.pc.localDescription&&(this.trace("ANSWER SDP",this.pc.localDescription.sdp),this.ws.send(JSON.stringify({type:"answer",sdp:this.pc.localDescription.sdp})))}sendUpdateAnswer(){this.pc&&this.ws&&this.pc.localDescription&&(this.trace("ANSWER SDP",this.pc.localDescription.sdp),this.ws.send(JSON.stringify({type:"update",sdp:this.pc.localDescription.sdp})))}onIceCandidate(){return new Promise((a,b)=>{const c=setInterval(()=>{if(null===this.pc){clearInterval(c);const a=new Error;a.message="ICECANDIDATE TIMEOUT",b(a)}else this.pc&&"connected"===this.pc.iceConnectionState&&(clearInterval(c),a())},100);this.pc&&(this.pc.onicecandidate=b=>{if(this.pc&&this.trace("ONICECANDIDATE ICEGATHERINGSTATE",this.pc.iceGatheringState),null===b.candidate)clearInterval(c),a();else{const a=b.candidate.toJSON(),c=Object.assign(a,{type:"candidate"});this.trace("ONICECANDIDATE CANDIDATE MESSAGE",c),this.ws&&this.ws.send(JSON.stringify(c))}})})}trace(a,b){this.callbacks.log(a,b);this.debug&&f(this.clientId,a,b)}async update(a){await this.setRemoteDescription(a),await this.createAnswer(a),this.sendUpdateAnswer()}setSenderParameters(a,b){const c=a.sender.getParameters();return c.encodings=b,a.sender.setParameters(c)}async getStats(){const a=[];if(!this.pc)return a;const b=await this.pc.getStats();return b.forEach(b=>{a.push(b)}),a}}class j extends i{connect(a){return this.options.multistream?this.multiStream(a):this.singleStream(a)}async singleStream(a){let b=0;this.options.timeout&&0{const a=new Error;a.message="CONNECTION TIMEOUT",this.callbacks.timeout(),this.disconnect(),Promise.reject(a)},this.options.timeout)),await this.disconnect(),this.startE2EE();const c=await this.createOffer(),d=await this.signaling(c);return await this.connectPeerConnection(d),await this.setRemoteDescription(d),a.getTracks().forEach(b=>{this.pc&&this.pc.addTrack(b,a)}),this.stream=a,await this.createAnswer(d),this.sendAnswer(),this.pc&&this.e2ee&&this.pc.getSenders().forEach(a=>{this.e2ee&&this.e2ee.setupSenderTransform(a)}),await this.onIceCandidate(),clearTimeout(b),a}async multiStream(a){let b=0;this.options.timeout&&0{const a=new Error;a.message="CONNECTION TIMEOUT",this.callbacks.timeout(),this.disconnect(),Promise.reject(a)},this.options.timeout)),await this.disconnect(),this.startE2EE();const c=await this.createOffer(),d=await this.signaling(c);return await this.connectPeerConnection(d),this.pc&&(this.pc.ontrack=a=>{const b=a.streams[0];b&&"default"!==b.id&&b.id!==this.connectionId&&(this.e2ee&&this.e2ee.setupReceiverTransform(a.receiver),this.callbacks.track(a),b.onremovetrack=a=>{if(this.callbacks.removetrack(a),a.target){const b=this.remoteConnectionIds.indexOf(a.target.id);-1{this.pc&&this.pc.addTrack(b,a)}),this.stream=a,await this.createAnswer(d),this.sendAnswer(),this.pc&&this.e2ee&&this.pc.getSenders().forEach(a=>{this.e2ee&&this.e2ee.setupSenderTransform(a)}),await this.onIceCandidate(),clearTimeout(b),a}}class k extends i{connect(){return this.options.multistream?this.multiStream():this.singleStream()}async singleStream(){let a=0;this.options.timeout&&0{const a=new Error;a.message="CONNECTION TIMEOUT",this.callbacks.timeout(),this.disconnect(),Promise.reject(a)},this.options.timeout)),await this.disconnect(),this.startE2EE();const b=await this.createOffer(),c=await this.signaling(b);return await this.connectPeerConnection(c),this.pc&&(this.pc.ontrack=a=>{this.stream=a.streams[0];const b=this.stream.id;"default"!==b&&(this.e2ee&&this.e2ee.setupReceiverTransform(a.receiver),this.callbacks.track(a),this.stream.onremovetrack=a=>{if(this.callbacks.removetrack(a),a.target){const b=this.remoteConnectionIds.indexOf(a.target.id);-1{const a=new Error;a.message="CONNECTION TIMEOUT",this.callbacks.timeout(),this.disconnect(),Promise.reject(a)},this.options.timeout)),await this.disconnect(),this.startE2EE();const b=await this.createOffer(),c=await this.signaling(b);return await this.connectPeerConnection(c),this.pc&&(this.pc.ontrack=a=>{const b=a.streams[0];"default"!==b.id&&b.id!==this.connectionId&&(this.e2ee&&this.e2ee.setupReceiverTransform(a.receiver),this.callbacks.track(a),b.onremovetrack=a=>{if(this.callbacks.removetrack(a),a.target){const b=this.remoteConnectionIds.indexOf(a.target.id);-1{const{operation:b}=a.data;\"disconnect\"===b&&\"function\"==typeof this.onWorkerDisconnect&&this.onWorkerDisconnect()},this.worker.postMessage({operation:\"setKey\",masterKey:this.masterKey})}terminateWorker(){this.worker&&this.worker.terminate()}setupSenderTransform(a){if(a.track){const b=a.createEncodedStreams();this.worker&&this.worker.postMessage({operation:\"encrypt\",readableStream:b.readableStream,writableStream:b.writableStream},[b.readableStream,b.writableStream])}}setupReceiverTransform(a){const b=a.createEncodedStreams();this.worker&&this.worker.postMessage({operation:\"decrypt\",readableStream:b.readableStream,writableStream:b.writableStream},[b.readableStream,b.writableStream])}static version(){return\"2020.2.0\"}}});\n//# sourceMappingURL=sora_e2ee.min.js.map\n"],"names":["a","b","module","this","constructor","RTCRtpSender","prototype","createEncodedStreams","Error","worker","masterKey","TextEncoder","encode","onWorkerDisconnect","startWorker","atob","Worker","URL","createObjectURL","Blob","type","onmessage","operation","data","postMessage","terminateWorker","terminate","setupSenderTransform","track","readableStream","writableStream","setupReceiverTransform","version"],"mappings":";;;;;;s+IAMI,CAAC,SAASA,CAAT,CAAWC,CAAX,CAAa,CAAsDC,SAAA,CAAeD,CAAC,EAAwH,CAA5M,EAA8ME,CAA9M,CAAmN,UAAU,CAAc,MAAO,MAAO,CAACC,WAAW,CAACJ,CAAD,CAAG,CAAC,KAAMC,CAAAA,CAAC,CAAC,CAAC,CAACI,YAAY,CAACC,SAAb,CAAuBC,oBAAjC,CAAsD,GAAG,CAACN,CAAJ,CAAM,KAAM,IAAIO,CAAAA,KAAJ,CAAU,uCAAV,CAAN,CAAyD,KAAKC,MAAL,CAAY,IAAZ,CAAiB,KAAKC,SAAL,CAAe,GAAIC,CAAAA,WAAJ,GAAkBC,MAAlB,CAAyBZ,CAAzB,CAAhC,CAA4D,KAAKa,kBAAL,CAAwB,IAAK,CAAAC,WAAW,EAAE,CAAC,KAAMd,CAAAA,CAAC,CAACe,IAAI,CAAC,0+IAAD,CAAZ,CAAy/I,KAAKN,MAAL,CAAY,GAAIO,CAAAA,MAAJ,CAAWC,GAAG,CAACC,eAAJ,CAAoB,GAAIC,CAAAA,IAAJ,CAAS,CAACnB,CAAD,CAAT,CAAa,CAACoB,IAAI,CAAC,wBAAN,CAAb,CAAp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AW,CAA9iL,CAAgjL,CAAzyL"} \ No newline at end of file +{"version":3,"file":"sora.min.js","sources":["../node_modules/sora-e2ee/dist/sora_e2ee.min.js"],"sourcesContent":["/**\n * sora-e2ee\n * WebRTC SFU Sora JavaScript E2EE Library\n * @version: 2020.2.0\n * @author: Shiguredo Inc.\n * @license: Apache-2.0\n **/(function(a,b){\"object\"==typeof exports&&\"undefined\"!=typeof module?module.exports=b():\"function\"==typeof define&&define.amd?define(b):(a=\"undefined\"==typeof globalThis?a||self:globalThis,a.SoraE2EE=b())})(this,function(){'use strict';return class a{constructor(a){const b=!!RTCRtpSender.prototype.createEncodedStreams;if(!b)throw new Error(\"E2EE is not supported in this browser\");this.worker=null,this.masterKey=new TextEncoder().encode(a),this.onWorkerDisconnect=null}startWorker(){const a=atob(\"bGV0IG1hc3RlcktleSxtYXRlcmlhbDtjb25zdCBkZXJpdmVLZXlNYXA9bmV3IE1hcCxzZXFOdW1NYXA9bmV3IE1hcCx3cml0ZUlWTWFwPW5ldyBNYXAsc2VxTnVtTGVuZ3RoPTQsc3NyY0xlbmd0aD00LHBhZGRpbmdMZW5ndGg9OCx1bmVuY3J5cHRlZEJ5dGVzPXtrZXk6MTAsZGVsdGE6Myx1bmRlZmluZWQ6MX07ZnVuY3Rpb24gZ2V0U2VxTnVtKGEpe3JldHVybiBzZXFOdW1NYXAuZ2V0KGEpfHwwfWZ1bmN0aW9uIHNldFNlcU51bShhLGIpe3NlcU51bU1hcC5zZXQoYSxiKX1hc3luYyBmdW5jdGlvbiBnZW5lcmF0ZURlcml2ZUtleShhLGIpe2xldCBjPWRlcml2ZUtleU1hcC5nZXQoYSk7cmV0dXJuIGN8fChjPWF3YWl0IGNyeXB0by5zdWJ0bGUuZGVyaXZlS2V5KHtuYW1lOiJQQktERjIiLHNhbHQ6YixpdGVyYXRpb25zOjFlNCxoYXNoOiJTSEEtMjU2In0sbWF0ZXJpYWwse25hbWU6IkFFUy1HQ00iLGxlbmd0aDoxMjh9LCExLFsiZ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NyeXB0ZWRCeXRlc1thLnR5cGVdKSxhLmRhdGE9bixiLmVucXVldWUoYSl9b25tZXNzYWdlPWFzeW5jIGE9Pntjb25zdHtvcGVyYXRpb246Yn09YS5kYXRhO2lmKCJlbmNyeXB0Ij09PWIpe2NvbnN0e3JlYWRhYmxlU3RyZWFtOmIsd3JpdGFibGVTdHJlYW06Y309YS5kYXRhLGQ9bmV3IFRyYW5zZm9ybVN0cmVhbSh7dHJhbnNmb3JtOmVuY3J5cHRGdW5jdGlvbn0pO2IucGlwZVRocm91Z2goZCkucGlwZVRvKGMpfWVsc2UgaWYoImRlY3J5cHQiPT09Yil7Y29uc3R7cmVhZGFibGVTdHJlYW06Yix3cml0YWJsZVN0cmVhbTpjfT1hLmRhdGEsZD1uZXcgVHJhbnNmb3JtU3RyZWFtKHt0cmFuc2Zvcm06ZGVjcnlwdEZ1bmN0aW9ufSk7Yi5waXBlVGhyb3VnaChkKS5waXBlVG8oYyl9ZWxzZSJzZXRLZXkiPT09Yj8obWFzdGVyS2V5PWEuZGF0YS5tYXN0ZXJLZXksbWF0ZXJpYWw9YXdhaXQgY3J5cHRvLnN1YnRsZS5pbXBvcnRLZXkoInJhdyIsbWFzdGVyS2V5LCJQQktERjIiLCExLFsiZGVyaXZlQml0cyIsImRlcml2ZUtleSJdKSk6ImNsZWFyIj09PWImJihkZXJpdmVLZXlNYXAuY2xlYXIoKSxzZXFOdW1NYXAuY2xlYXIoKSx3cml0ZUlWTWFwLmNsZWFyKCkpfTsK\");this.worker=new Worker(URL.createObjectURL(new Blob([a],{type:\"application/javascript\"}))),this.worker.onmessage=a=>{const{operation:b}=a.data;\"disconnect\"===b&&\"function\"==typeof this.onWorkerDisconnect&&this.onWorkerDisconnect()},this.worker.postMessage({operation:\"setKey\",masterKey:this.masterKey})}terminateWorker(){this.worker&&this.worker.terminate()}setupSenderTransform(a){if(a.track){const b=a.createEncodedStreams();this.worker&&this.worker.postMessage({operation:\"encrypt\",readableStream:b.readableStream,writableStream:b.writableStream},[b.readableStream,b.writableStream])}}setupReceiverTransform(a){const b=a.createEncodedStreams();this.worker&&this.worker.postMessage({operation:\"decrypt\",readableStream:b.readableStream,writableStream:b.writableStream},[b.readableStream,b.writableStream])}static version(){return\"2020.2.0\"}}});\n//# sourceMappingURL=sora_e2ee.min.js.map\n"],"names":["a","b","module","this","constructor","RTCRtpSender","prototype","createEncodedStreams","Error","worker","masterKey","TextEncoder","encode","onWorkerDisconnect","startWorker","atob","Worker","URL","createObjectURL","Blob","type","onmessage","operation","data","postMessage","terminateWorker","terminate","setupSenderTransform","track","readableStream","writableStream","setupReceiverTransform","version"],"mappings":";;;;;;k+IAMI,CAAC,SAASA,CAAT,CAAWC,CAAX,CAAa,CAAsDC,SAAA,CAAeD,CAAC,EAAwH,CAA5M,EAA8ME,CAA9M,CAAmN,UAAU,CAAc,MAAO,MAAO,CAACC,WAAW,CAACJ,CAAD,CAAG,CAAC,KAAMC,CAAAA,CAAC,CAAC,CAAC,CAACI,YAAY,CAACC,SAAb,CAAuBC,oBAAjC,CAAsD,GAAG,CAACN,CAAJ,CAAM,KAAM,IAAIO,CAAAA,KAAJ,CAAU,uCAAV,CAAN,CAAyD,KAAKC,MAAL,CAAY,IAAZ,CAAiB,KAAKC,SAAL,CAAe,GAAIC,CAAAA,WAAJ,GAAkBC,MAAlB,CAAyBZ,CAAzB,CAAhC,CAA4D,KAAKa,kBAAL,CAAwB,IAAK,CAAAC,WAAW,EAAE,CAAC,KAAMd,CAAAA,CAAC,CAACe,IAAI,CAAC,0+IAAD,CAAZ,CAAy/I,KAAKN,MAAL,CAAY,GAAIO,CAAAA,MAAJ,CAAWC,GAAG,CAACC,eAAJ,CAAoB,GAAIC,CAAAA,IAAJ,CAAS,CAACnB,CAAD,CAAT,CAAa,CAACoB,IAAI,CAAC,wBAAN,CAAb,CAApB,CAAX,CAAZ,CAA2F,KAAKX,MAAL,CAAYY,SAAZ,CAAsBrB,CAAC,EAAE,CAAC,KAAK,CAACsB,SAAS,CA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 -1,6 +1,6 @@ { "name": "sora-js-sdk", - "version": "2020.1.5", + "version": "2020.2.0", "description": "WebRTC SFU Sora JavaScript SDK", "main": "dist/sora.min.js", "module": "dist/sora.min.js",