trtc-sdk-v5 5.15.0-beta.9 → 5.15.0-wasm.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/assets/av_processing.wasm +0 -0
  2. package/assets/debug-dialog.js +2 -2
  3. package/assets/worker.js +17 -0
  4. package/index.d.ts +15 -0
  5. package/package.json +4 -6
  6. package/plugins/cdn-streaming/cdn-streaming.esm.js +1 -1
  7. package/plugins/cdn-streaming/cdn-streaming.umd.js +1 -1
  8. package/plugins/cdn-streaming/package.json +1 -1
  9. package/plugins/chorus/chorus.esm.d.ts +2 -0
  10. package/plugins/chorus/package.json +1 -1
  11. package/plugins/cross-room/cross-room.esm.d.ts +2 -0
  12. package/plugins/cross-room/package.json +1 -1
  13. package/plugins/custom-encryption/package.json +1 -1
  14. package/plugins/device-detector/package.json +1 -1
  15. package/plugins/lebplayer/package.json +1 -1
  16. package/plugins/small-stream-auto-switcher/package.json +1 -1
  17. package/plugins/video-decoder/package.json +1 -1
  18. package/plugins/video-decoder/video-decoder.esm.d.ts +2 -1
  19. package/plugins/video-decoder/video-decoder.esm.js +1 -1
  20. package/plugins/video-decoder/video-decoder.umd.js +1 -1
  21. package/plugins/video-effect/basic-beauty/package.json +1 -1
  22. package/plugins/video-effect/beauty/package.json +1 -1
  23. package/plugins/video-effect/face-detection/face-detection.esm.d.ts +22 -0
  24. package/plugins/video-effect/face-detection/face-detection.esm.js +1 -0
  25. package/plugins/video-effect/face-detection/face-detection.umd.js +1 -0
  26. package/plugins/{fast-webrtc → video-effect/face-detection}/package.json +8 -8
  27. package/plugins/video-effect/video-mixer/package.json +1 -1
  28. package/plugins/video-effect/virtual-background/package.json +1 -1
  29. package/plugins/video-effect/virtual-background/virtual-background.esm.js +1 -1
  30. package/plugins/video-effect/virtual-background/virtual-background.umd.js +1 -1
  31. package/plugins/video-effect/watermark/package.json +1 -1
  32. package/plugins/voice-changer/package.json +1 -1
  33. package/trtc.esm.js +69 -45
  34. package/trtc.js +1 -1
  35. package/plugins/fast-webrtc/fast-webrtc.esm.d.ts +0 -27
  36. package/plugins/fast-webrtc/fast-webrtc.esm.js +0 -1
  37. package/plugins/fast-webrtc/fast-webrtc.umd.js +0 -1
@@ -1,27 +0,0 @@
1
- export interface StartCrossRoomOption {
2
- roomId?: number,
3
- strRoomId?: string,
4
- userId?: string
5
- }
6
-
7
- interface UpdateCrossRoomOptionItem extends StartCrossRoomOption {
8
- muteAudio: boolean,
9
- muteVideo: boolean,
10
- muteSubStream: boolean,
11
- }
12
-
13
- export interface UpdateCrossRoomOption {
14
- updateList: UpdateCrossRoomOptionItem[]
15
- }
16
-
17
- export interface StopCrossRoomOption {
18
- roomId?: number,
19
- strRoomId?: string,
20
- }
21
-
22
-
23
- export declare class CrossRoom {
24
- start(option: StartCrossRoomOption): Promise<void>;
25
- update(option: UpdateCrossRoomOption): Promise<void>;
26
- stop(option?: StopCrossRoomOption): Promise<void>;
27
- }
@@ -1 +0,0 @@
1
- var __defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,r)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,__spreadValues=(e,t)=>{for(var r in t||(t={}))__hasOwnProp.call(t,r)&&__defNormalProp(e,r,t[r]);if(__getOwnPropSymbols)for(var r of __getOwnPropSymbols(t))__propIsEnum.call(t,r)&&__defNormalProp(e,r,t[r]);return e},__publicField=(e,t,r)=>__defNormalProp(e,"symbol"!=typeof t?t+"":t,r),StartValidateRule={name:"option",required:!0,properties:{view:{type:["string",HTMLElement],required:!0},url:{type:"string",required:!0},licenseConfig:{type:"object",required:!0,properties:{secretKey:{type:"string",required:!0},encrypted:{type:"string",required:!0},signature:{type:"string",required:!0}}}}},updateSdpForFirefox=e=>{if(!navigator.userAgent.includes("Firefox"))return e;const t=e.split("\r\n"),r=[],o=[];t.forEach((e=>{const t=e.toLowerCase();t.includes("a=rtpmap")&&t.includes("h264")&&r.push(e)})),r.length>1&&o.push(...r.slice(1));const s=o.map((e=>{const t=/a=rtpmap:(\d+)\s/.exec(e);return t&&t.length>1?t[1]:null})).filter((e=>null!==e)),i=[];return t.forEach((e=>{let t=e;if(e.includes("a=setup")&&(t="a=setup:passive"),(e.includes("m=audio")||e.includes("m=video"))&&(t=e.split(" ").filter(((e,t)=>t<3||!s.includes(e))).join(" ")),e.includes("a=fmtp")||e.includes("a=rtcp-fb")||e.includes("a=rtpmap")){const t=/a=(?:fmtp|rtcp-fb|rtpmap):(\d+)\s/.exec(e);if(t&&t.length>1&&s.includes(t[1]))return}i.push(t)})),i.join("\r\n")},updateSdpRestriction=e=>{const t=e.split("\r\n"),r=[];t.forEach((e=>{const t=e.toLowerCase();t.includes("a=rtpmap")&&t.includes("h264")&&r.push(e)}));const o=r.map((e=>{const t=/a=rtpmap:(\d+)\s/.exec(e);return t&&t.length>1?t[1]:null})).filter((e=>null!==e)),s=[];t.forEach((e=>{let t=e;if(e.includes("a=fmtp:111")&&(t=`${e};stereo=1`),e.includes("a=fmtp")){const r=/a=fmtp:(\d+)\s/.exec(e);r&&r.length>1&&o.includes(r[1])&&(t=`${e};sps-pps-idr-in-keyframe=1`)}s.push(t)}));const i=s.join("\r\n");return updateSdpForFirefox(i)},urlAlphabet="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",nanoid=(e=21)=>{let t="",r=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=urlAlphabet[63&r[e]];return t},SIGNAL_DOMAIN_NAME_LIST=["overseas-webrtc.tlivewebrtc.com","oswebrtc-lint.tliveplay.com"],_FastWebRTC=class e{constructor(e){this.core=e,__publicField(this,"disableRandomCall",!0),__publicField(this,"connectedRoomIdSet",new Set),__publicField(this,"updateSeq",0),__publicField(this,"_log"),this._log=this.core.log.createChild({id:`${this.getAlias()}`})}getName(){return e.Name}getAlias(){return"fwrtc"}getGroup(){return""}getValidateRule(e){switch(e){case"start":return StartValidateRule;case"update":case"stop":return{}}}async start(e){const{view:t,url:r,licenseConfig:o}=e}async connect(e){const t=new RTCPeerConnection({iceServers:[],sdpSemantics:"unified-plan",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",tcpCandidatePolicy:"disable",IceTransportsType:"nohost"});t.addTransceiver("audio",{direction:"recvonly"}),t.addTransceiver("video",{direction:"recvonly"});const r=await t.createOffer({offerToReceiveAudio:!0,offerToReceiveVideo:!0,voiceActivityDetection:!1});r.sdp=updateSdpRestriction(r.sdp),await t.setLocalDescription(r);const o={sessionId:nanoid(),streamurl:e,clientinfo:"macos chrome115",localsdp:t.localDescription},{remoteSdp:s,svrSig:i}=await this.core.utils.promiseAny(SIGNAL_DOMAIN_NAME_LIST.map((e=>this.exchangeSDP(e,o,3))));await t.setRemoteDescription(s)}async exchangeSDP(e,t,r){const o=`${e}/webrtc/v1/pullstream`,s=await fetchPost(o,t,{timeout:r}),{errcode:i,errmsg:n,remotesdp:a,svrsig:c}=s;if(0!==i){const e=new Error(`errCode:${i}, errMsg:${n}`);throw e.name="RequestSignalError",e}return{url:e,remoteSdp:a,svrSig:c}}async update(e){}async stop(){}destroy(){}};__publicField(_FastWebRTC,"Name","FastWebRTC");var FastWebRTC=_FastWebRTC,fetchPost=async(e,t,r={})=>{const{timeout:o=10}=r;let s,i=0,n={};window.AbortController&&(s=new window.AbortController,n={signal:s.signal},i=window.setTimeout((()=>s.abort()),1e3*o));const a=await fetch(e,__spreadValues({body:JSON.stringify(t),cache:"no-cache",credentials:"same-origin",headers:{"content-type":"text/plain;charset=utf-8"},method:"POST",mode:"cors"},n));if(i&&window.clearTimeout(i),200!==a.status)throw new Error(`Network Error, status code:${a.status}`);return a.json()},index_default=FastWebRTC;export{index_default as default};export{FastWebRTC};
@@ -1 +0,0 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).FastWebRTC=e()}(this,(function(){"use strict";function t(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function e(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function r(t){return function(){var r=this,n=arguments;return new Promise((function(o,i){var a=t.apply(r,n);function c(t){e(a,o,i,c,u,"next",t)}function u(t){e(a,o,i,c,u,"throw",t)}c(void 0)}))}}function n(t,e,r){return e&&function(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,a(n.key),n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function o(){o=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,i=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},c=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",s=a.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function f(t,e,r,n){var o=e&&e.prototype instanceof g?e:g,a=Object.create(o.prototype),c=new _(n||[]);return i(a,"_invoke",{value:O(t,r,c)}),a}function p(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=f;var h="suspendedStart",y="suspendedYield",d="executing",v="completed",m={};function g(){}function w(){}function b(){}var x={};l(x,c,(function(){return this}));var E=Object.getPrototypeOf,S=E&&E(E(C([])));S&&S!==r&&n.call(S,c)&&(x=S);var L=b.prototype=g.prototype=Object.create(x);function j(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function k(t,e){function r(o,i,a,c){var u=p(t[o],t,i);if("throw"!==u.type){var s=u.arg,l=s.value;return l&&"object"==typeof l&&n.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(l).then((function(t){s.value=t,a(s)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var o;i(this,"_invoke",{value:function(t,n){function i(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(i,i):i()}})}function O(e,r,n){var o=h;return function(i,a){if(o===d)throw Error("Generator is already running");if(o===v){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=T(c,n);if(u){if(u===m)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var s=p(e,r,n);if("normal"===s.type){if(o=n.done?v:y,s.arg===m)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=v,n.method="throw",n.arg=s.arg)}}}function T(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,T(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=p(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,m;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,m):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function P(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function A(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function _(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function C(e){if(e||""===e){var r=e[c];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(typeof e+" is not iterable")}return w.prototype=b,i(L,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:w,configurable:!0}),w.displayName=l(b,s,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,l(t,s,"GeneratorFunction")),t.prototype=Object.create(L),t},e.awrap=function(t){return{__await:t}},j(k.prototype),l(k.prototype,u,(function(){return this})),e.AsyncIterator=k,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new k(f(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},j(L),l(L,s,"Generator"),l(L,c,(function(){return this})),l(L,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=C,_.prototype={constructor:_,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(A),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),s=n.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),A(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;A(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:C(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),m}},e}function i(e){return function(e){if(Array.isArray(e))return t(e)}(e)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(e)||u(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e);if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==typeof e?e:e+""}function c(t){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},c(t)}function u(e,r){if(e){if("string"==typeof e)return t(e,r);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?t(e,r):void 0}}var s=Object.defineProperty,l=Object.getOwnPropertySymbols,f=Object.prototype.hasOwnProperty,p=Object.prototype.propertyIsEnumerable,h=function(t,e,r){return e in t?s(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r},y=function(t,e){for(var r in e||(e={}))f.call(e,r)&&h(t,r,e[r]);if(l){var n,o=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=u(t))||e){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,c=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){c=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(c)throw i}}}}(l(e));try{for(o.s();!(n=o.n()).done;){r=n.value;p.call(e,r)&&h(t,r,e[r])}}catch(t){o.e(t)}finally{o.f()}}return t},d=function(t,e,r){return h(t,"symbol"!==c(e)?e+"":e,r)},v={name:"option",required:!0,properties:{view:{type:["string",HTMLElement],required:!0},url:{type:"string",required:!0},licenseConfig:{type:"object",required:!0,properties:{secretKey:{type:"string",required:!0},encrypted:{type:"string",required:!0},signature:{type:"string",required:!0}}}}},m=function(t){var e=t.split("\r\n"),r=[];e.forEach((function(t){var e=t.toLowerCase();e.includes("a=rtpmap")&&e.includes("h264")&&r.push(t)}));var n=r.map((function(t){var e=/a=rtpmap:(\d+)\s/.exec(t);return e&&e.length>1?e[1]:null})).filter((function(t){return null!==t})),o=[];return e.forEach((function(t){var e=t;if(t.includes("a=fmtp:111")&&(e="".concat(t,";stereo=1")),t.includes("a=fmtp")){var r=/a=fmtp:(\d+)\s/.exec(t);r&&r.length>1&&n.includes(r[1])&&(e="".concat(t,";sps-pps-idr-in-keyframe=1"))}o.push(e)})),function(t){if(!navigator.userAgent.includes("Firefox"))return t;var e=t.split("\r\n"),r=[],n=[];e.forEach((function(t){var e=t.toLowerCase();e.includes("a=rtpmap")&&e.includes("h264")&&r.push(t)})),r.length>1&&n.push.apply(n,i(r.slice(1)));var o=n.map((function(t){var e=/a=rtpmap:(\d+)\s/.exec(t);return e&&e.length>1?e[1]:null})).filter((function(t){return null!==t})),a=[];return e.forEach((function(t){var e=t;if(t.includes("a=setup")&&(e="a=setup:passive"),(t.includes("m=audio")||t.includes("m=video"))&&(e=t.split(" ").filter((function(t,e){return e<3||!o.includes(t)})).join(" ")),t.includes("a=fmtp")||t.includes("a=rtcp-fb")||t.includes("a=rtpmap")){var r=/a=(?:fmtp|rtcp-fb|rtpmap):(\d+)\s/.exec(t);if(r&&r.length>1&&o.includes(r[1]))return}a.push(e)})),a.join("\r\n")}(o.join("\r\n"))},g=function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:21,e="",r=crypto.getRandomValues(new Uint8Array(t|=0));t--;)e+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[63&r[t]];return e},w=["overseas-webrtc.tlivewebrtc.com","oswebrtc-lint.tliveplay.com"],b=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.core=e,d(this,"disableRandomCall",!0),d(this,"connectedRoomIdSet",new Set),d(this,"updateSeq",0),d(this,"_log"),this._log=this.core.log.createChild({id:"".concat(this.getAlias())})}return n(t,[{key:"getName",value:function(){return t.Name}},{key:"getAlias",value:function(){return"fwrtc"}},{key:"getGroup",value:function(){return""}},{key:"getValidateRule",value:function(t){switch(t){case"start":return v;case"update":case"stop":return{}}}},{key:"start",value:(u=r(o().mark((function t(e){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e.view,e.url,e.licenseConfig;case 1:case"end":return t.stop()}}),t)}))),function(t){return u.apply(this,arguments)})},{key:"connect",value:(c=r(o().mark((function t(e){var r,n,i,a,c,u,s=this;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return(r=new RTCPeerConnection({iceServers:[],sdpSemantics:"unified-plan",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",tcpCandidatePolicy:"disable",IceTransportsType:"nohost"})).addTransceiver("audio",{direction:"recvonly"}),r.addTransceiver("video",{direction:"recvonly"}),t.next=5,r.createOffer({offerToReceiveAudio:!0,offerToReceiveVideo:!0,voiceActivityDetection:!1});case 5:return(n=t.sent).sdp=m(n.sdp),t.next=9,r.setLocalDescription(n);case 9:return i=g(),a={sessionId:i,streamurl:e,clientinfo:"macos chrome115",localsdp:r.localDescription},t.next=13,this.core.utils.promiseAny(w.map((function(t){return s.exchangeSDP(t,a,3)})));case 13:return c=t.sent,u=c.remoteSdp,c.svrSig,t.next=18,r.setRemoteDescription(u);case 18:case"end":return t.stop()}}),t,this)}))),function(t){return c.apply(this,arguments)})},{key:"exchangeSDP",value:(a=r(o().mark((function t(e,r,n){var i,a,c,u,s,l,f;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i="".concat(e,"/webrtc/v1/pullstream"),t.next=3,E(i,r,{timeout:n});case 3:if(a=t.sent,c=a.errcode,u=a.errmsg,s=a.remotesdp,l=a.svrsig,0===c){t.next=9;break}throw(f=new Error("errCode:".concat(c,", errMsg:").concat(u))).name="RequestSignalError",f;case 9:return t.abrupt("return",{url:e,remoteSdp:s,svrSig:l});case 10:case"end":return t.stop()}}),t)}))),function(t,e,r){return a.apply(this,arguments)})},{key:"update",value:(i=r(o().mark((function t(e){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:case"end":return t.stop()}}),t)}))),function(t){return i.apply(this,arguments)})},{key:"stop",value:(e=r(o().mark((function t(){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:case"end":return t.stop()}}),t)}))),function(){return e.apply(this,arguments)})},{key:"destroy",value:function(){}}]);var e,i,a,c,u}();d(b,"Name","FastWebRTC");var x=b,E=function(){var t=r(o().mark((function t(e,r){var n,i,a,c,u,s,l=arguments;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=(l.length>2&&void 0!==l[2]?l[2]:{}).timeout,i=void 0===n?10:n,c=0,u={},window.AbortController&&(a=new window.AbortController,u={signal:a.signal},c=window.setTimeout((function(){return a.abort()}),1e3*i)),t.next=7,fetch(e,y({body:JSON.stringify(r),cache:"no-cache",credentials:"same-origin",headers:{"content-type":"text/plain;charset=utf-8"},method:"POST",mode:"cors"},u));case 7:if(s=t.sent,c&&window.clearTimeout(c),200===s.status){t.next=11;break}throw new Error("Network Error, status code:".concat(s.status));case 11:return t.abrupt("return",s.json());case 12:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}();return x}));