@tencentcloud/trtc-cloud-wx 0.0.2 → 0.0.4

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 (2) hide show
  1. package/package.json +1 -1
  2. package/trtc-cloud-wx.js +1682 -1
package/trtc-cloud-wx.js CHANGED
@@ -1 +1,1682 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var _TRTCVideoResolutionM,_TRTCBeautyStyleMap,_TRTCVideoFillModeMap,EventEmitter=require("eventemitter3"),TRTC=require("trtc-wx-sdk");function _iterableToArrayLimit(e,t){var o=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var r,i,n,a,u=[],s=!0,l=!1;try{if(n=(o=o.call(e)).next,0===t){if(Object(o)!==o)return;s=!1}else for(;!(s=(r=n.call(o)).done)&&(u.push(r.value),u.length!==t);s=!0);}catch(e){l=!0,i=e}finally{try{if(!s&&null!=o.return&&(a=o.return(),Object(a)!==a))return}finally{if(l)throw i}}return u}}function _regeneratorRuntime(){_regeneratorRuntime=function(){return a};var a={},e=Object.prototype,s=e.hasOwnProperty,l=Object.defineProperty||function(e,t,o){e[t]=o.value},t="function"==typeof Symbol?Symbol:{},r=t.iterator||"@@iterator",o=t.asyncIterator||"@@asyncIterator",i=t.toStringTag||"@@toStringTag";function n(e,t,o){return Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{n({},"")}catch(e){n=function(e,t,o){return e[t]=o}}function u(e,t,o,r){var i,n,a,u,t=t&&t.prototype instanceof d?t:d,t=Object.create(t.prototype),r=new _(r||[]);return l(t,"_invoke",{value:(i=e,n=o,a=r,u="suspendedStart",function(e,t){if("executing"===u)throw new Error("Generator is already running");if("completed"===u){if("throw"===e)throw t;return b()}for(a.method=e,a.arg=t;;){var o=a.delegate;if(o){o=function e(t,o){var r=o.method,i=t.iterator[r];if(void 0===i)return o.delegate=null,"throw"===r&&t.iterator.return&&(o.method="return",o.arg=void 0,e(t,o),"throw"===o.method)||"return"!==r&&(o.method="throw",o.arg=new TypeError("The iterator does not provide a '"+r+"' method")),c;r=T(i,t.iterator,o.arg);if("throw"===r.type)return o.method="throw",o.arg=r.arg,o.delegate=null,c;i=r.arg;return i?i.done?(o[t.resultName]=i.value,o.next=t.nextLoc,"return"!==o.method&&(o.method="next",o.arg=void 0),o.delegate=null,c):i:(o.method="throw",o.arg=new TypeError("iterator result is not an object"),o.delegate=null,c)}(o,a);if(o){if(o===c)continue;return o}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===u)throw u="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);u="executing";o=T(i,n,a);if("normal"===o.type){if(u=a.done?"completed":"suspendedYield",o.arg===c)continue;return{value:o.arg,done:a.done}}"throw"===o.type&&(u="completed",a.method="throw",a.arg=o.arg)}})}),t}function T(e,t,o){try{return{type:"normal",arg:e.call(t,o)}}catch(e){return{type:"throw",arg:e}}}a.wrap=u;var c={};function d(){}function R(){}function p(){}var t={},f=(n(t,r,function(){return this}),Object.getPrototypeOf),f=f&&f(f(V([]))),h=(f&&f!==e&&s.call(f,r)&&(t=f),p.prototype=d.prototype=Object.create(t));function y(e){["next","throw","return"].forEach(function(t){n(e,t,function(e){return this._invoke(t,e)})})}function m(a,u){var t;l(this,"_invoke",{value:function(o,r){function e(){return new u(function(e,t){!function t(e,o,r,i){var n,e=T(a[e],a,o);if("throw"!==e.type)return(o=(n=e.arg).value)&&"object"==typeof o&&s.call(o,"__await")?u.resolve(o.__await).then(function(e){t("next",e,r,i)},function(e){t("throw",e,r,i)}):u.resolve(o).then(function(e){n.value=e,r(n)},function(e){return t("throw",e,r,i)});i(e.arg)}(o,r,e,t)})}return t=t?t.then(e,e):e()}})}function C(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function v(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function _(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(C,this),this.reset(!0)}function V(t){if(t){var o,e=t[r];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length))return o=-1,(e=function e(){for(;++o<t.length;)if(s.call(t,o))return e.value=t[o],e.done=!1,e;return e.value=void 0,e.done=!0,e}).next=e}return{next:b}}function b(){return{value:void 0,done:!0}}return l(h,"constructor",{value:R.prototype=p,configurable:!0}),l(p,"constructor",{value:R,configurable:!0}),R.displayName=n(p,i,"GeneratorFunction"),a.isGeneratorFunction=function(e){e="function"==typeof e&&e.constructor;return!!e&&(e===R||"GeneratorFunction"===(e.displayName||e.name))},a.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,n(e,i,"GeneratorFunction")),e.prototype=Object.create(h),e},a.awrap=function(e){return{__await:e}},y(m.prototype),n(m.prototype,o,function(){return this}),a.AsyncIterator=m,a.async=function(e,t,o,r,i){void 0===i&&(i=Promise);var n=new m(u(e,t,o,r),i);return a.isGeneratorFunction(t)?n:n.next().then(function(e){return e.done?e.value:n.next()})},y(h),n(h,i,"Generator"),n(h,r,function(){return this}),n(h,"toString",function(){return"[object Generator]"}),a.keys=function(e){var t,o=Object(e),r=[];for(t in o)r.push(t);return r.reverse(),function e(){for(;r.length;){var t=r.pop();if(t in o)return e.value=t,e.done=!1,e}return e.done=!0,e}},a.values=V,_.prototype={constructor:_,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(v),!e)for(var t in this)"t"===t.charAt(0)&&s.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(o){if(this.done)throw o;var r=this;function e(e,t){return n.type="throw",n.arg=o,r.next=e,t&&(r.method="next",r.arg=void 0),!!t}for(var t=this.tryEntries.length-1;0<=t;--t){var i=this.tryEntries[t],n=i.completion;if("root"===i.tryLoc)return e("end");if(i.tryLoc<=this.prev){var a=s.call(i,"catchLoc"),u=s.call(i,"finallyLoc");if(a&&u){if(this.prev<i.catchLoc)return e(i.catchLoc,!0);if(this.prev<i.finallyLoc)return e(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return e(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return e(i.finallyLoc)}}}},abrupt:function(e,t){for(var o=this.tryEntries.length-1;0<=o;--o){var r=this.tryEntries[o];if(r.tryLoc<=this.prev&&s.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}var n=(i=i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc?null:i)?i.completion:{};return n.type=e,n.arg=t,i?(this.method="next",this.next=i.finallyLoc,c):this.complete(n)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),c},finish:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var o=this.tryEntries[t];if(o.finallyLoc===e)return this.complete(o.completion,o.afterLoc),v(o),c}},catch:function(e){for(var t=this.tryEntries.length-1;0<=t;--t){var o,r,i=this.tryEntries[t];if(i.tryLoc===e)return"throw"===(o=i.completion).type&&(r=o.arg,v(i)),r}throw new Error("illegal catch attempt")},delegateYield:function(e,t,o){return this.delegate={iterator:V(e),resultName:t,nextLoc:o},"next"===this.method&&(this.arg=void 0),c}},a}function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var o=0;o<t.length;o++){var r=t[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,_toPropertyKey(r.key),r)}}function _createClass(e,t,o){return t&&_defineProperties(e.prototype,t),o&&_defineProperties(e,o),Object.defineProperty(e,"prototype",{writable:!1}),e}function _defineProperty(e,t,o){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o,e}function _slicedToArray(e,t){return _arrayWithHoles(e)||_iterableToArrayLimit(e,t)||_unsupportedIterableToArray(e,t)||_nonIterableRest()}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayWithHoles(e){if(Array.isArray(e))return e}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _unsupportedIterableToArray(e,t){var o;if(e)return"string"==typeof e?_arrayLikeToArray(e,t):"Map"===(o="Object"===(o=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:o)||"Set"===o?Array.from(e):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?_arrayLikeToArray(e,t):void 0}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var o=0,r=new Array(t);o<t;o++)r[o]=e[o];return r}function _nonIterableSpread(){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 _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _toPrimitive(e,t){if("object"!=typeof e||null===e)return e;var o=e[Symbol.toPrimitive];if(void 0===o)return("string"===t?String:Number)(e);o=o.call(e,t||"default");if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}function _toPropertyKey(e){e=_toPrimitive(e,"string");return"symbol"==typeof e?e:String(e)}function __awaiter(e,a,u,s){return new(u=u||Promise)(function(o,t){function r(e){try{n(s.next(e))}catch(e){t(e)}}function i(e){try{n(s.throw(e))}catch(e){t(e)}}function n(e){var t;e.done?o(e.value):((t=e.value)instanceof u?t:new u(function(e){e(t)})).then(r,i)}n((s=s.apply(e,a||[])).next())})}exports.TRTCAppScene=void 0,function(e){e[e.TRTCAppSceneVideoCall=0]="TRTCAppSceneVideoCall",e[e.TRTCAppSceneLIVE=1]="TRTCAppSceneLIVE",e[e.TRTCAppSceneAudioCall=2]="TRTCAppSceneAudioCall",e[e.TRTCAppSceneVoiceChatRoom=3]="TRTCAppSceneVoiceChatRoom"}(exports.TRTCAppScene||(exports.TRTCAppScene={})),exports.TRTCRoleType=void 0,function(e){e[e.TRTCRoleAnchor=20]="TRTCRoleAnchor",e[e.TRTCRoleAudience=21]="TRTCRoleAudience"}(exports.TRTCRoleType||(exports.TRTCRoleType={})),exports.TRTCVideoStreamType=void 0,function(e){e[e.TRTCVideoStreamTypeBig=0]="TRTCVideoStreamTypeBig",e[e.TRTCVideoStreamTypeSmall=1]="TRTCVideoStreamTypeSmall",e[e.TRTCVideoStreamTypeSub=2]="TRTCVideoStreamTypeSub"}(exports.TRTCVideoStreamType||(exports.TRTCVideoStreamType={})),exports.TRTCVideoResolution=void 0,function(e){e[e.TRTCVideoResolution_120_120=1]="TRTCVideoResolution_120_120",e[e.TRTCVideoResolution_160_160=3]="TRTCVideoResolution_160_160",e[e.TRTCVideoResolution_270_270=5]="TRTCVideoResolution_270_270",e[e.TRTCVideoResolution_480_480=7]="TRTCVideoResolution_480_480",e[e.TRTCVideoResolution_160_120=50]="TRTCVideoResolution_160_120",e[e.TRTCVideoResolution_240_180=52]="TRTCVideoResolution_240_180",e[e.TRTCVideoResolution_280_210=54]="TRTCVideoResolution_280_210",e[e.TRTCVideoResolution_320_240=56]="TRTCVideoResolution_320_240",e[e.TRTCVideoResolution_400_300=58]="TRTCVideoResolution_400_300",e[e.TRTCVideoResolution_480_360=60]="TRTCVideoResolution_480_360",e[e.TRTCVideoResolution_640_480=62]="TRTCVideoResolution_640_480",e[e.TRTCVideoResolution_960_720=64]="TRTCVideoResolution_960_720",e[e.TRTCVideoResolution_160_90=100]="TRTCVideoResolution_160_90",e[e.TRTCVideoResolution_256_144=102]="TRTCVideoResolution_256_144",e[e.TRTCVideoResolution_320_180=104]="TRTCVideoResolution_320_180",e[e.TRTCVideoResolution_480_270=106]="TRTCVideoResolution_480_270",e[e.TRTCVideoResolution_640_360=108]="TRTCVideoResolution_640_360",e[e.TRTCVideoResolution_960_540=110]="TRTCVideoResolution_960_540",e[e.TRTCVideoResolution_1280_720=112]="TRTCVideoResolution_1280_720",e[e.TRTCVideoResolution_1920_1080=114]="TRTCVideoResolution_1920_1080"}(exports.TRTCVideoResolution||(exports.TRTCVideoResolution={})),exports.TRTCVideoResolutionMode=void 0,function(e){e[e.TRTCVideoResolutionModeLandscape=0]="TRTCVideoResolutionModeLandscape",e[e.TRTCVideoResolutionModePortrait=1]="TRTCVideoResolutionModePortrait"}(exports.TRTCVideoResolutionMode||(exports.TRTCVideoResolutionMode={})),exports.TRTCVideoRotation=void 0,function(e){e[e.TRTCVideoRotation0=0]="TRTCVideoRotation0",e[e.TRTCVideoRotation90=1]="TRTCVideoRotation90",e[e.TRTCVideoRotation180=2]="TRTCVideoRotation180",e[e.TRTCVideoRotation270=3]="TRTCVideoRotation270"}(exports.TRTCVideoRotation||(exports.TRTCVideoRotation={})),exports.TRTCVideoFillMode=void 0,function(e){e[e.TRTCVideoFillMode_Fill=0]="TRTCVideoFillMode_Fill",e[e.TRTCVideoFillMode_Fit=1]="TRTCVideoFillMode_Fit"}(exports.TRTCVideoFillMode||(exports.TRTCVideoFillMode={})),exports.TRTCVideoMirrorType=void 0,function(e){e[e.TRTCVideoMirrorType_Auto=0]="TRTCVideoMirrorType_Auto",e[e.TRTCVideoMirrorType_Enable=1]="TRTCVideoMirrorType_Enable",e[e.TRTCVideoMirrorType_Disable=2]="TRTCVideoMirrorType_Disable"}(exports.TRTCVideoMirrorType||(exports.TRTCVideoMirrorType={})),exports.TRTCAudioQuality=void 0,function(e){e[e.TRTCAudioQualityDefault=0]="TRTCAudioQualityDefault",e[e.TRTCAudioQualitySpeech=1]="TRTCAudioQualitySpeech",e[e.TRTCAudioQualityMusic=3]="TRTCAudioQualityMusic"}(exports.TRTCAudioQuality||(exports.TRTCAudioQuality={})),exports.TRTCBeautyStyle=void 0,function(e){e[e.TRTCBeautyStyleSmooth=0]="TRTCBeautyStyleSmooth",e[e.TRTCBeautyStyleNature=1]="TRTCBeautyStyleNature"}(exports.TRTCBeautyStyle||(exports.TRTCBeautyStyle={}));var translateTRTCAppScene=function(e){switch(e){case 0:return"videocall";case 1:return"live";case 2:return"audiocall";case 3:return"voicechatroom";default:return""}},translateTRTCVideoStreamType=function(e){switch(e){case 0:return"main";case 1:return"small";case 2:return"aux";default:return""}},translateTRTCStreamId=function(e,t){return"".concat(e,"_").concat(translateTRTCVideoStreamType(t))},TRTCVideoResolutionMap=(_defineProperty(_TRTCVideoResolutionM={},exports.TRTCVideoResolution.TRTCVideoResolution_120_120,[120,120]),_defineProperty(_TRTCVideoResolutionM,exports.TRTCVideoResolution.TRTCVideoResolution_160_160,[160,160]),_defineProperty(_TRTCVideoResolutionM,exports.TRTCVideoResolution.TRTCVideoResolution_270_270,[270,270]),_defineProperty(_TRTCVideoResolutionM,exports.TRTCVideoResolution.TRTCVideoResolution_480_480,[480,480]),_defineProperty(_TRTCVideoResolutionM,exports.TRTCVideoResolution.TRTCVideoResolution_160_120,[160,120]),_defineProperty(_TRTCVideoResolutionM,exports.TRTCVideoResolution.TRTCVideoResolution_240_180,[240,180]),_defineProperty(_TRTCVideoResolutionM,exports.TRTCVideoResolution.TRTCVideoResolution_280_210,[280,210]),_defineProperty(_TRTCVideoResolutionM,exports.TRTCVideoResolution.TRTCVideoResolution_320_240,[320,240]),_defineProperty(_TRTCVideoResolutionM,exports.TRTCVideoResolution.TRTCVideoResolution_400_300,[400,300]),_defineProperty(_TRTCVideoResolutionM,exports.TRTCVideoResolution.TRTCVideoResolution_480_360,[480,360]),_defineProperty(_TRTCVideoResolutionM,exports.TRTCVideoResolution.TRTCVideoResolution_640_480,[640,480]),_defineProperty(_TRTCVideoResolutionM,exports.TRTCVideoResolution.TRTCVideoResolution_960_720,[960,720]),_defineProperty(_TRTCVideoResolutionM,exports.TRTCVideoResolution.TRTCVideoResolution_160_90,[160,90]),_defineProperty(_TRTCVideoResolutionM,exports.TRTCVideoResolution.TRTCVideoResolution_256_144,[256,144]),_defineProperty(_TRTCVideoResolutionM,exports.TRTCVideoResolution.TRTCVideoResolution_320_180,[320,180]),_defineProperty(_TRTCVideoResolutionM,exports.TRTCVideoResolution.TRTCVideoResolution_480_270,[480,270]),_defineProperty(_TRTCVideoResolutionM,exports.TRTCVideoResolution.TRTCVideoResolution_640_360,[640,360]),_defineProperty(_TRTCVideoResolutionM,exports.TRTCVideoResolution.TRTCVideoResolution_960_540,[960,540]),_defineProperty(_TRTCVideoResolutionM,exports.TRTCVideoResolution.TRTCVideoResolution_1280_720,[1280,720]),_defineProperty(_TRTCVideoResolutionM,exports.TRTCVideoResolution.TRTCVideoResolution_1920_1080,[1920,1080]),_TRTCVideoResolutionM),translateTRTCVideoResolution=function(e){var e=_slicedToArray(TRTCVideoResolutionMap[e],2),t=e[0],e=e[1];return{videoWidth:void 0===t?0:t,videoHeight:void 0===e?0:e}},translateTRTCVideoResolutionMode=function(e){switch(e){case exports.TRTCVideoResolutionMode.TRTCVideoResolutionModeLandscape:return"horizontal";case exports.TRTCVideoResolutionMode.TRTCVideoResolutionModePortrait:return"vertical";default:return""}},translateTRTCVideoRotation=function(e){switch(e){case exports.TRTCVideoRotation.TRTCVideoRotation0:return"vertical";case exports.TRTCVideoRotation.TRTCVideoRotation90:return"horizontal";default:return""}},translateTRTCVideoMirrorType=function(e){switch(e){case exports.TRTCVideoMirrorType.TRTCVideoMirrorType_Auto:return"auto";case exports.TRTCVideoMirrorType.TRTCVideoMirrorType_Enable:return"enable";case exports.TRTCVideoMirrorType.TRTCVideoMirrorType_Disable:return"disable";default:return""}},TRTCBeautyStyleMap=(_defineProperty(_TRTCBeautyStyleMap={},exports.TRTCBeautyStyle.TRTCBeautyStyleSmooth,"smooth"),_defineProperty(_TRTCBeautyStyleMap,exports.TRTCBeautyStyle.TRTCBeautyStyleNature,"nature"),_TRTCBeautyStyleMap),translateBeautyStyle=function(e){return TRTCBeautyStyleMap[e]},TRTCVideoFillModeMap=(_defineProperty(_TRTCVideoFillModeMap={},exports.TRTCVideoFillMode.TRTCVideoFillMode_Fill,"fillCrop"),_defineProperty(_TRTCVideoFillModeMap,exports.TRTCVideoFillMode.TRTCVideoFillMode_Fit,"contain"),_TRTCVideoFillModeMap),translateVideoFillMod=function(e){return TRTCVideoFillModeMap[e]},uniqueFunc=function(e,t){var o=new Map;return e.filter(function(e){return!o.has(e[t])&&o.set(e[t],1)})},isNumber=function(e){return"number"==typeof e};function safelyParse(t){if("string"!=typeof t)return t;try{var e=JSON.parse(t),o="object"===_typeof(e)&&e?e:t}catch(e){o=t}return o}var TRTCCloud=function(){function e(){_classCallCheck(this,e),this.InterfaceEventEmitter=new EventEmitter,this.EventEmitter=new EventEmitter,this.role=exports.TRTCRoleType.TRTCRoleAnchor,this.userId="",this.isEnterRoom=!1,this.isMuted=!1,this.isOpenCamera=!1,this.audioVolumeEvaluation=0,this.allTimer={},this.renderMap=new Map,this.init()}return _createClass(e,[{key:"destroy",value:function(){this.EventEmitter.removeAllListeners(),this.InterfaceEventEmitter.removeAllListeners(),this.trtc.exitRoom()}},{key:"init",value:function(){this.trtc=new TRTC(this),this.TRTC_EVENT=this.trtc.EVENT,this.trtc.createPusher({}),this.bindTRTCEvent(),this.handleNetworkQuality=this.getHandleNetworkQuality(2e3)}},{key:"reset",value:function(){var t=this;this.role=exports.TRTCRoleType.TRTCRoleAnchor,this.userId="",this.isEnterRoom=!1,this.isMuted=!1,this.isOpenCamera=!1,Object.keys(this.allTimer).forEach(function(e){return clearInterval(t.allTimer[e])})}},{key:"bindTRTCEvent",value:function(){var o=this;this.trtc.on(this.TRTC_EVENT.LOCAL_LEAVE,function(e){}),this.trtc.on(this.TRTC_EVENT.ERROR,function(e){var e=e.data,t=e.code,e=e.message;o.emit("onError",t,e)}),this.trtc.on(this.TRTC_EVENT.REMOTE_USER_JOIN,function(e){e=e.data.userID;o.emit("onRemoteUserEnterRoom",e)}),this.trtc.on(this.TRTC_EVENT.REMOTE_USER_LEAVE,function(e){var e=e.data,t=e.userID;e.playerList,o.emit("onRemoteUserLeaveRoom",t,0),o.InterfaceEventEmitter.emit("onRemoteUserLeaveRoom",t,0)}),this.trtc.on(this.TRTC_EVENT.REMOTE_VIDEO_ADD,function(e){e=e.data.player;o.emit("aux"===e.streamType?"onUserSubStreamAvailable":"onUserVideoAvailable",e.userID,1)}),this.trtc.on(this.TRTC_EVENT.REMOTE_VIDEO_REMOVE,function(e){e=e.data.player;o.emit("aux"===e.streamType?"onUserSubStreamAvailable":"onUserVideoAvailable",e.userID,0)}),this.trtc.on(this.TRTC_EVENT.REMOTE_AUDIO_ADD,function(e){e=e.data.player;o.emit("onUserAudioAvailable",e.userID,1),o.muteRemoteAudio(e.userID,!1)}),this.trtc.on(this.TRTC_EVENT.REMOTE_AUDIO_REMOVE,function(e){e=e.data.player;o.emit("onUserAudioAvailable",e.userID,0)}),this.trtc.on(this.TRTC_EVENT.REMOTE_AUDIO_VOLUME_UPDATE,function(e){e=e.data.playerList.map(function(e){return{userId:e.userID,volume:e.volume}});o.handleAudioVolumeUpdate(e)}),this.trtc.on(this.TRTC_EVENT.LOCAL_AUDIO_VOLUME_UPDATE,function(e){e=e.data.pusher,e=[{userId:e.userID,volume:e.volume}];o.handleAudioVolumeUpdate(e)}),this.trtc.on(this.TRTC_EVENT.LOCAL_NET_STATE_UPDATE,function(e){e=e.data.pusher;o.handleNetworkQuality({pusher:e})}),this.trtc.on(this.TRTC_EVENT.REMOTE_NET_STATE_UPDATE,function(e){e=e.data.playerList;o.handleNetworkQuality({playerList:e})})}},{key:"getHandleAudioVolumeUpdate",value:function(t){var e,o,r=this;return null!=(e=this.allTimer)&&e.AudioVolume&&clearInterval(this.allTimer.AudioVolume),0===t?function(){}:(o=[],this.InterfaceEventEmitter.off("onRemoteUserLeaveRoom"),this.InterfaceEventEmitter.on("onRemoteUserLeaveRoom",function(t){o=o.filter(function(e){return e.userId!==t})},this.getHandleAudioVolumeUpdate),function(e){o=uniqueFunc([].concat(_toConsumableArray(e),_toConsumableArray(o)),"userId"),r.allTimer.AudioVolume||(e=setInterval(function(){r.emit("onUserVoiceVolume",o,o.length,0)},t),r.allTimer.AudioVolume=e)})}},{key:"handleAudioVolumeUpdate",value:function(e){}},{key:"getHandleNetworkQuality",value:function(o){var e,r,i=this;return null!=(e=this.allTimer)&&e.networkQuality&&clearInterval(this.allTimer.networkQuality),0===o?function(){}:(r={localQuality:null,remoteQuality:[]},this.on("onRemoteUserLeaveRoom",function(t){r.remoteQuality=r.remoteQuality.filter(function(e){return e.userId!==t})},this),function(e){var t=e.pusher,e=e.playerList;t&&(r.localQuality={userId:t.userID,quality:t.netStatus}),e&&(r.remoteQuality=e.map(function(e){return{userId:e.userID,quality:e.netStatus}})),i.allTimer.networkQuality||(t=setInterval(function(){i.emit("onNetworkQuality",r.localQuality,r.remoteQuality)},o),i.allTimer.networkQuality=t)})}},{key:"handleNetworkQuality",value:function(e){}},{key:"on",value:function(e,t,o){console.log("[TRTCCloud-WX:on]:",e),this.EventEmitter.on(e,t,o)}},{key:"off",value:function(e,t,o){this.EventEmitter.off(e,t,o)}},{key:"emit",value:function(e){for(var t,o=arguments.length,r=new Array(1<o?o-1:0),i=1;i<o;i++)r[i-1]=arguments[i];(t=this.EventEmitter).emit.apply(t,[e].concat(r))}},{key:"enterRoom",value:function(e,t){var o=this,r=(new Date).getTime(),i=e.sdkAppId,n=e.userId,a=e.userSig,u=e.roomId,s=e.strRoomId,l=e.role,e=e.privateMapKey,i=(this.userId=n,this.trtc.createPusher({}),this.trtc.enterRoom({sdkAppID:i,userID:n,userSig:a,roomID:u,strRoomID:s,role:l,privateMapKey:e,scene:translateTRTCAppScene(t),enableMic:!1,enableCamera:!1,videoPreview:!1}));this.InterfaceEventEmitter.emit("pusherAttributesChange",{pusher:i,callback:function(){o.trtc.getPusherInstance().start({success:function(){o.scene=t,o.isEnterRoom=!0;var e=(new Date).getTime();o.emit("onEnterRoom",e-r)},fail:function(){o.emit("onEnterRoom",-1)}})}})}},{key:"exitRoom",value:function(){var e=this,t=this.trtc.exitRoom().pusher;this.InterfaceEventEmitter.emit("pusherAttributesChange",{pusher:t,callback:function(){e.reset(),e.emit("onExitRoom",0)}})}},{key:"switchRoom",value:function(){}},{key:"switchRole",value:function(e){var t=this;this.role===(this.role=e)||e===exports.TRTCRoleType.TRTCRoleAnchor?this.emit("onSwitchRole",0,""):(e=this.trtc.setPusherAttributes({enableCamera:!1,enableMic:!1}),this.InterfaceEventEmitter.emit("pusherAttributesChange",{pusher:e,callback:function(){t.emit("onSwitchRole",0,"")}}))}},{key:"connectOtherRoom",value:function(){}},{key:"disconnectOtherRoom",value:function(){}},{key:"setDefaultStreamRecvMode",value:function(){}},{key:"startLocalPreview",value:function(){var r=this,i=!(0<arguments.length&&void 0!==arguments[0])||arguments[0];return new Promise(function(t,e){var o;r.role!==exports.TRTCRoleType.TRTCRoleAnchor?t(null):(o=r.trtc.setPusherAttributes({videoPreview:!r.isEnterRoom||r.isMuted,enableCamera:!!r.isEnterRoom&&!r.isMuted,frontCamera:i?"front":"back"}),r.InterfaceEventEmitter.emit("pusherAttributesChange",{pusher:o,callback:function(){return __awaiter(r,void 0,void 0,_regeneratorRuntime().mark(function e(){return _regeneratorRuntime().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:this.emit("onFirstVideoFrame","",exports.TRTCVideoStreamType.TRTCVideoStreamTypeBig,o.videoWidth,o.videoHeight),this.isEnterRoom&&this.emit("onSendFirstLocalVideoFrame",exports.TRTCVideoStreamType.TRTCVideoStreamTypeBig),t(null),this.isOpenCamera=!0;case 4:case"end":return e.stop()}},e,this)}))}}))})}},{key:"stopLocalPreview",value:function(){var e=this,t=this.trtc.setPusherAttributes({videoPreview:!1,enableCamera:!1});this.InterfaceEventEmitter.emit("pusherAttributesChange",{pusher:t,callback:function(){e.isOpenCamera=!1,e.emit("onUserVideoAvailable",e.userId,0)}})}},{key:"updateLocalView",value:function(e){null!==e?this.startLocalPreview():this.stopLocalPreview()}},{key:"muteLocalVideo",value:function(r,i){var n=this;return new Promise(function(e,t){if(n.isOpenCamera){var o;switch(i){case exports.TRTCVideoStreamType.TRTCVideoStreamTypeBig:case exports.TRTCVideoStreamType.TRTCVideoStreamTypeSub:n.isMuted=r,o=n.trtc.setPusherAttributes({videoPreview:r,enableCamera:!r}),n.InterfaceEventEmitter.emit("pusherAttributesChange",{pusher:o,callback:function(){e(null)}});break;default:e(null)}}else e(null)})}},{key:"startRemoteView",value:function(e,t,o){var r=this,i=translateTRTCStreamId(e,o),n=this.setTRTCPlayerAttributes(i,{muteVideo:!1,stopVideo:!1});this.renderMap.set(i,t),this.InterfaceEventEmitter.emit("playerAttributesChange",{streamId:i,view:this.renderMap.get(i),playerAttributes:n,callback:function(){r.emit("onFirstVideoFrame",e,o,0,0)}})}},{key:"stopRemoteView",value:function(e,t){e=translateTRTCStreamId(e,t),t=this.setTRTCPlayerAttributes(e,{muteVideo:!0,stopVideo:!0});this.InterfaceEventEmitter.emit("playerAttributesChange",{streamId:e,view:this.renderMap.get(e),playerAttributes:t})}},{key:"updateRemoteView",value:function(e,t,o){null!==t?this.startRemoteView(e,t,o):this.stopRemoteView(e,o)}},{key:"stopAllRemoteView",value:function(){var o=this;this.trtc.getPlayerList().forEach(function(e){var e=e.streamID,t=o.setTRTCPlayerAttributes(e,{muteVideo:!0,stopVideo:!0});o.InterfaceEventEmitter.emit("playerAttributesChange",{streamId:e,view:o.renderMap.get(e),playerAttributes:t})})}},{key:"muteRemoteVideoStream",value:function(e,t,o){e=translateTRTCStreamId(e,o),o=this.setTRTCPlayerAttributes(e,{muteVideo:t});this.InterfaceEventEmitter.emit("playerAttributesChange",{streamId:e,view:this.renderMap.get(e),playerAttributes:o})}},{key:"muteAllRemoteVideoStreams",value:function(o){var r=this;this.trtc.getPlayerList().forEach(function(e){var e=e.streamID,t=r.setTRTCPlayerAttributes(e,{muteVideo:o});r.InterfaceEventEmitter.emit("playerAttributesChange",{streamId:e,view:r.renderMap.get(e),playerAttributes:t})})}},{key:"setTRTCPlayerAttributes",value:function(e,t){return this.trtc.setPlayerAttributes(e,t),this.trtc.getPlayerInstance(e).playerAttributes}},{key:"setVideoEncoderParam",value:function(e){var t=e.videoResolution,o=(e.resMode,e.videoFps),e=(e.videoBitrate,e.minVideoBitrate),t=translateTRTCVideoResolution(t),r=t.videoWidth,t=t.videoHeight,r=this.trtc.setPusherAttributes({videoWidth:r,videoHeight:t,fps:o,minBitrate:e});this.InterfaceEventEmitter.emit("pusherAttributesChange",{pusher:r})}},{key:"setLocalRenderParams",value:function(e){var t=e.rotation,e=(e.fillMode,e.mirrorType),t=translateTRTCVideoRotation(t),e=translateTRTCVideoMirrorType(e),t=this.trtc.setPusherAttributes({videoOrientation:t,localMirror:e});this.InterfaceEventEmitter.emit("pusherAttributesChange",{pusher:t})}},{key:"setRemoteRenderParams",value:function(e,t,o){var r=o.fillMode,i=o.rotation,o=(o.mirrorType,translateTRTCStreamId(e,t)),e=this.setTRTCPlayerAttributes(o,{objectFit:translateVideoFillMod(r),orientation:translateTRTCVideoRotation(i)});this.InterfaceEventEmitter.emit("playerAttributesChange",{streamId:o,view:this.renderMap.get(o),playerAttributes:e})}},{key:"startLocalAudio",value:function(e){var t=this,o=this.trtc.setPusherAttributes({enableMic:!0});this.InterfaceEventEmitter.emit("pusherAttributesChange",{pusher:o,callback:function(){t.emit("onMicDidReady"),t.emit("onUserAudioAvailable",t.userId,1),t.enterRoom&&t.emit("onSendFirstLocalAudioFrame")}})}},{key:"stopLocalAudio",value:function(){var e=this,t=this.trtc.setPusherAttributes({enableMic:!1});this.InterfaceEventEmitter.emit("pusherAttributesChange",{pusher:t,callback:function(){e.emit("onUserAudioAvailable",e.userId,0)}})}},{key:"muteLocalAudio",value:function(e){var t=this,o=this.trtc.setPusherAttributes({enableMic:!e});this.InterfaceEventEmitter.emit("pusherAttributesChange",{pusher:o,callback:function(){t.emit("onUserAudioAvailable",t.userId,!0===e?0:1)}})}},{key:"muteRemoteAudio",value:function(e,t){e=translateTRTCStreamId(e,exports.TRTCVideoStreamType.TRTCVideoStreamTypeBig),t=this.setTRTCPlayerAttributes(e,{muteAudio:t});this.InterfaceEventEmitter.emit("playerAttributesChange",{streamId:e,view:this.renderMap.get(e),playerAttributes:t})}},{key:"muteAllRemoteAudio",value:function(o){var r=this;this.trtc.getPlayerList().forEach(function(e){var e=e.streamID,t=r.setTRTCPlayerAttributes(e,{muteAudio:o});r.InterfaceEventEmitter.emit("playerAttributesChange",{streamId:e,view:r.renderMap.get(e),playerAttributes:t})})}},{key:"enableAudioVolumeEvaluation",value:function(e){this.handleAudioVolumeUpdate=this.getHandleAudioVolumeUpdate(e)}},{key:"switchCamera",value:function(e){var r=this;return e===("front"===this.trtc.getPusherInstance().pusherAttributes.frontCamera)?Promise.resolve():new Promise(function(o,t){wx.createLivePusherContext().switchCamera({success:function(e){var t=r.trtc.setPusherAttributes({frontCamera:!0});r.InterfaceEventEmitter.emit("pusherAttributesChange",{pusher:t}),o(e)},fail:function(e){t(e)}})})}},{key:"setBeautyStyle",value:function(e,t,o,r){e=this.trtc.setPusherAttributes({beautyStyle:e,beautyLevel:t,whitenessLevel:o});this.InterfaceEventEmitter.emit("pusherAttributesChange",{pusher:e})}},{key:"sendSEIMsg",value:function(e){return new Promise(function(t,o){wx.createLivePusherContext().sendMessage({msg:e,success:function(e){t(e)},fail:function(e){o(e)}})})}},{key:"startPlayMusic",value:function(n,e){return new Promise(function(t,o){var e=n.path,r=n.startTimeMS,r=void 0===r?0:r,i=n.endTimeMS,i=void 0===i?0:i;wx.createLivePusherContext().playBGM({url:e,startTimeMs:r,endTimeMs:i,success:function(e){t(e)},fail:function(e){o(e)}})})}},{key:"stopPlayMusic",value:function(){return new Promise(function(t,o){wx.createLivePusherContext().stopBGM({success:function(e){t(e)},fail:function(e){o(e)}})})}},{key:"pausePlayMusic",value:function(){return new Promise(function(t,o){wx.createLivePusherContext().pauseBGM({success:function(e){t(e)},fail:function(e){o(e)}})})}},{key:"resumePlayMusic",value:function(){return new Promise(function(t,o){wx.createLivePusherContext().resumeBGM({success:function(e){t(e)},fail:function(e){o(e)}})})}},{key:"setAllMusicVolume",value:function(r){return new Promise(function(t,o){var e=(r/200).toString();wx.createLivePusherContext().setBGMVolume({volume:e,success:function(e){t(e)},fail:function(e){o(e)}})})}},{key:"enableSmallVideoStream",value:function(e,t){}},{key:"callExperimentalAPI",value:function(e){var t=safelyParse(e);t!==e&&(e=t.api,t=t.params,e)&&t&&"setFramework"===e&&this.handleSetFrameWork(t)}},{key:"handleSetFrameWork",value:function(e){e=e.component;if(isNumber(e))try{wx&&(wx.TUIScene=e,wx.setStorageSync("TUIScene",String(e)))}catch(e){throw e}}}],[{key:"getTRTCShareInstance",value:function(){return e.instance=e.instance?e.instance:new e}},{key:"destroyTRTCShareInstance",value:function(){e.instance&&(e.instance.destroy(),e.instance=null)}}]),e}();exports.TRTCCloud=TRTCCloud,exports.default=TRTCCloud,exports.translateBeautyStyle=translateBeautyStyle,exports.translateTRTCAppScene=translateTRTCAppScene,exports.translateTRTCStreamId=translateTRTCStreamId,exports.translateTRTCVideoMirrorType=translateTRTCVideoMirrorType,exports.translateTRTCVideoResolution=translateTRTCVideoResolution,exports.translateTRTCVideoResolutionMode=translateTRTCVideoResolutionMode,exports.translateTRTCVideoRotation=translateTRTCVideoRotation,exports.translateTRTCVideoStreamType=translateTRTCVideoStreamType,exports.translateVideoFillMod=translateVideoFillMod;
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var EventEmitter = require('eventemitter3');
6
+ var TRTC = require('trtc-wx-sdk');
7
+
8
+ function _iterableToArrayLimit(arr, i) {
9
+ var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
10
+ if (null != _i) {
11
+ var _s,
12
+ _e,
13
+ _x,
14
+ _r,
15
+ _arr = [],
16
+ _n = !0,
17
+ _d = !1;
18
+ try {
19
+ if (_x = (_i = _i.call(arr)).next, 0 === i) {
20
+ if (Object(_i) !== _i) return;
21
+ _n = !1;
22
+ } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0);
23
+ } catch (err) {
24
+ _d = !0, _e = err;
25
+ } finally {
26
+ try {
27
+ if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return;
28
+ } finally {
29
+ if (_d) throw _e;
30
+ }
31
+ }
32
+ return _arr;
33
+ }
34
+ }
35
+ function _regeneratorRuntime() {
36
+ _regeneratorRuntime = function () {
37
+ return exports;
38
+ };
39
+ var exports = {},
40
+ Op = Object.prototype,
41
+ hasOwn = Op.hasOwnProperty,
42
+ defineProperty = Object.defineProperty || function (obj, key, desc) {
43
+ obj[key] = desc.value;
44
+ },
45
+ $Symbol = "function" == typeof Symbol ? Symbol : {},
46
+ iteratorSymbol = $Symbol.iterator || "@@iterator",
47
+ asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
48
+ toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
49
+ function define(obj, key, value) {
50
+ return Object.defineProperty(obj, key, {
51
+ value: value,
52
+ enumerable: !0,
53
+ configurable: !0,
54
+ writable: !0
55
+ }), obj[key];
56
+ }
57
+ try {
58
+ define({}, "");
59
+ } catch (err) {
60
+ define = function (obj, key, value) {
61
+ return obj[key] = value;
62
+ };
63
+ }
64
+ function wrap(innerFn, outerFn, self, tryLocsList) {
65
+ var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
66
+ generator = Object.create(protoGenerator.prototype),
67
+ context = new Context(tryLocsList || []);
68
+ return defineProperty(generator, "_invoke", {
69
+ value: makeInvokeMethod(innerFn, self, context)
70
+ }), generator;
71
+ }
72
+ function tryCatch(fn, obj, arg) {
73
+ try {
74
+ return {
75
+ type: "normal",
76
+ arg: fn.call(obj, arg)
77
+ };
78
+ } catch (err) {
79
+ return {
80
+ type: "throw",
81
+ arg: err
82
+ };
83
+ }
84
+ }
85
+ exports.wrap = wrap;
86
+ var ContinueSentinel = {};
87
+ function Generator() {}
88
+ function GeneratorFunction() {}
89
+ function GeneratorFunctionPrototype() {}
90
+ var IteratorPrototype = {};
91
+ define(IteratorPrototype, iteratorSymbol, function () {
92
+ return this;
93
+ });
94
+ var getProto = Object.getPrototypeOf,
95
+ NativeIteratorPrototype = getProto && getProto(getProto(values([])));
96
+ NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
97
+ var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
98
+ function defineIteratorMethods(prototype) {
99
+ ["next", "throw", "return"].forEach(function (method) {
100
+ define(prototype, method, function (arg) {
101
+ return this._invoke(method, arg);
102
+ });
103
+ });
104
+ }
105
+ function AsyncIterator(generator, PromiseImpl) {
106
+ function invoke(method, arg, resolve, reject) {
107
+ var record = tryCatch(generator[method], generator, arg);
108
+ if ("throw" !== record.type) {
109
+ var result = record.arg,
110
+ value = result.value;
111
+ return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
112
+ invoke("next", value, resolve, reject);
113
+ }, function (err) {
114
+ invoke("throw", err, resolve, reject);
115
+ }) : PromiseImpl.resolve(value).then(function (unwrapped) {
116
+ result.value = unwrapped, resolve(result);
117
+ }, function (error) {
118
+ return invoke("throw", error, resolve, reject);
119
+ });
120
+ }
121
+ reject(record.arg);
122
+ }
123
+ var previousPromise;
124
+ defineProperty(this, "_invoke", {
125
+ value: function (method, arg) {
126
+ function callInvokeWithMethodAndArg() {
127
+ return new PromiseImpl(function (resolve, reject) {
128
+ invoke(method, arg, resolve, reject);
129
+ });
130
+ }
131
+ return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
132
+ }
133
+ });
134
+ }
135
+ function makeInvokeMethod(innerFn, self, context) {
136
+ var state = "suspendedStart";
137
+ return function (method, arg) {
138
+ if ("executing" === state) throw new Error("Generator is already running");
139
+ if ("completed" === state) {
140
+ if ("throw" === method) throw arg;
141
+ return doneResult();
142
+ }
143
+ for (context.method = method, context.arg = arg;;) {
144
+ var delegate = context.delegate;
145
+ if (delegate) {
146
+ var delegateResult = maybeInvokeDelegate(delegate, context);
147
+ if (delegateResult) {
148
+ if (delegateResult === ContinueSentinel) continue;
149
+ return delegateResult;
150
+ }
151
+ }
152
+ if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
153
+ if ("suspendedStart" === state) throw state = "completed", context.arg;
154
+ context.dispatchException(context.arg);
155
+ } else "return" === context.method && context.abrupt("return", context.arg);
156
+ state = "executing";
157
+ var record = tryCatch(innerFn, self, context);
158
+ if ("normal" === record.type) {
159
+ if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
160
+ return {
161
+ value: record.arg,
162
+ done: context.done
163
+ };
164
+ }
165
+ "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
166
+ }
167
+ };
168
+ }
169
+ function maybeInvokeDelegate(delegate, context) {
170
+ var methodName = context.method,
171
+ method = delegate.iterator[methodName];
172
+ if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
173
+ var record = tryCatch(method, delegate.iterator, context.arg);
174
+ if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
175
+ var info = record.arg;
176
+ return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
177
+ }
178
+ function pushTryEntry(locs) {
179
+ var entry = {
180
+ tryLoc: locs[0]
181
+ };
182
+ 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
183
+ }
184
+ function resetTryEntry(entry) {
185
+ var record = entry.completion || {};
186
+ record.type = "normal", delete record.arg, entry.completion = record;
187
+ }
188
+ function Context(tryLocsList) {
189
+ this.tryEntries = [{
190
+ tryLoc: "root"
191
+ }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
192
+ }
193
+ function values(iterable) {
194
+ if (iterable) {
195
+ var iteratorMethod = iterable[iteratorSymbol];
196
+ if (iteratorMethod) return iteratorMethod.call(iterable);
197
+ if ("function" == typeof iterable.next) return iterable;
198
+ if (!isNaN(iterable.length)) {
199
+ var i = -1,
200
+ next = function next() {
201
+ for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
202
+ return next.value = undefined, next.done = !0, next;
203
+ };
204
+ return next.next = next;
205
+ }
206
+ }
207
+ return {
208
+ next: doneResult
209
+ };
210
+ }
211
+ function doneResult() {
212
+ return {
213
+ value: undefined,
214
+ done: !0
215
+ };
216
+ }
217
+ return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
218
+ value: GeneratorFunctionPrototype,
219
+ configurable: !0
220
+ }), defineProperty(GeneratorFunctionPrototype, "constructor", {
221
+ value: GeneratorFunction,
222
+ configurable: !0
223
+ }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
224
+ var ctor = "function" == typeof genFun && genFun.constructor;
225
+ return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
226
+ }, exports.mark = function (genFun) {
227
+ return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
228
+ }, exports.awrap = function (arg) {
229
+ return {
230
+ __await: arg
231
+ };
232
+ }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
233
+ return this;
234
+ }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
235
+ void 0 === PromiseImpl && (PromiseImpl = Promise);
236
+ var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
237
+ return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
238
+ return result.done ? result.value : iter.next();
239
+ });
240
+ }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
241
+ return this;
242
+ }), define(Gp, "toString", function () {
243
+ return "[object Generator]";
244
+ }), exports.keys = function (val) {
245
+ var object = Object(val),
246
+ keys = [];
247
+ for (var key in object) keys.push(key);
248
+ return keys.reverse(), function next() {
249
+ for (; keys.length;) {
250
+ var key = keys.pop();
251
+ if (key in object) return next.value = key, next.done = !1, next;
252
+ }
253
+ return next.done = !0, next;
254
+ };
255
+ }, exports.values = values, Context.prototype = {
256
+ constructor: Context,
257
+ reset: function (skipTempReset) {
258
+ if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
259
+ },
260
+ stop: function () {
261
+ this.done = !0;
262
+ var rootRecord = this.tryEntries[0].completion;
263
+ if ("throw" === rootRecord.type) throw rootRecord.arg;
264
+ return this.rval;
265
+ },
266
+ dispatchException: function (exception) {
267
+ if (this.done) throw exception;
268
+ var context = this;
269
+ function handle(loc, caught) {
270
+ return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
271
+ }
272
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
273
+ var entry = this.tryEntries[i],
274
+ record = entry.completion;
275
+ if ("root" === entry.tryLoc) return handle("end");
276
+ if (entry.tryLoc <= this.prev) {
277
+ var hasCatch = hasOwn.call(entry, "catchLoc"),
278
+ hasFinally = hasOwn.call(entry, "finallyLoc");
279
+ if (hasCatch && hasFinally) {
280
+ if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
281
+ if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
282
+ } else if (hasCatch) {
283
+ if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
284
+ } else {
285
+ if (!hasFinally) throw new Error("try statement without catch or finally");
286
+ if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
287
+ }
288
+ }
289
+ }
290
+ },
291
+ abrupt: function (type, arg) {
292
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
293
+ var entry = this.tryEntries[i];
294
+ if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
295
+ var finallyEntry = entry;
296
+ break;
297
+ }
298
+ }
299
+ finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
300
+ var record = finallyEntry ? finallyEntry.completion : {};
301
+ return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
302
+ },
303
+ complete: function (record, afterLoc) {
304
+ if ("throw" === record.type) throw record.arg;
305
+ return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
306
+ },
307
+ finish: function (finallyLoc) {
308
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
309
+ var entry = this.tryEntries[i];
310
+ if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
311
+ }
312
+ },
313
+ catch: function (tryLoc) {
314
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
315
+ var entry = this.tryEntries[i];
316
+ if (entry.tryLoc === tryLoc) {
317
+ var record = entry.completion;
318
+ if ("throw" === record.type) {
319
+ var thrown = record.arg;
320
+ resetTryEntry(entry);
321
+ }
322
+ return thrown;
323
+ }
324
+ }
325
+ throw new Error("illegal catch attempt");
326
+ },
327
+ delegateYield: function (iterable, resultName, nextLoc) {
328
+ return this.delegate = {
329
+ iterator: values(iterable),
330
+ resultName: resultName,
331
+ nextLoc: nextLoc
332
+ }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
333
+ }
334
+ }, exports;
335
+ }
336
+ function _typeof(obj) {
337
+ "@babel/helpers - typeof";
338
+
339
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
340
+ return typeof obj;
341
+ } : function (obj) {
342
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
343
+ }, _typeof(obj);
344
+ }
345
+ function _classCallCheck(instance, Constructor) {
346
+ if (!(instance instanceof Constructor)) {
347
+ throw new TypeError("Cannot call a class as a function");
348
+ }
349
+ }
350
+ function _defineProperties(target, props) {
351
+ for (var i = 0; i < props.length; i++) {
352
+ var descriptor = props[i];
353
+ descriptor.enumerable = descriptor.enumerable || false;
354
+ descriptor.configurable = true;
355
+ if ("value" in descriptor) descriptor.writable = true;
356
+ Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
357
+ }
358
+ }
359
+ function _createClass(Constructor, protoProps, staticProps) {
360
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
361
+ if (staticProps) _defineProperties(Constructor, staticProps);
362
+ Object.defineProperty(Constructor, "prototype", {
363
+ writable: false
364
+ });
365
+ return Constructor;
366
+ }
367
+ function _defineProperty(obj, key, value) {
368
+ key = _toPropertyKey(key);
369
+ if (key in obj) {
370
+ Object.defineProperty(obj, key, {
371
+ value: value,
372
+ enumerable: true,
373
+ configurable: true,
374
+ writable: true
375
+ });
376
+ } else {
377
+ obj[key] = value;
378
+ }
379
+ return obj;
380
+ }
381
+ function _slicedToArray(arr, i) {
382
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
383
+ }
384
+ function _toConsumableArray(arr) {
385
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
386
+ }
387
+ function _arrayWithoutHoles(arr) {
388
+ if (Array.isArray(arr)) return _arrayLikeToArray(arr);
389
+ }
390
+ function _arrayWithHoles(arr) {
391
+ if (Array.isArray(arr)) return arr;
392
+ }
393
+ function _iterableToArray(iter) {
394
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
395
+ }
396
+ function _unsupportedIterableToArray(o, minLen) {
397
+ if (!o) return;
398
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
399
+ var n = Object.prototype.toString.call(o).slice(8, -1);
400
+ if (n === "Object" && o.constructor) n = o.constructor.name;
401
+ if (n === "Map" || n === "Set") return Array.from(o);
402
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
403
+ }
404
+ function _arrayLikeToArray(arr, len) {
405
+ if (len == null || len > arr.length) len = arr.length;
406
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
407
+ return arr2;
408
+ }
409
+ function _nonIterableSpread() {
410
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
411
+ }
412
+ function _nonIterableRest() {
413
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
414
+ }
415
+ function _toPrimitive(input, hint) {
416
+ if (typeof input !== "object" || input === null) return input;
417
+ var prim = input[Symbol.toPrimitive];
418
+ if (prim !== undefined) {
419
+ var res = prim.call(input, hint || "default");
420
+ if (typeof res !== "object") return res;
421
+ throw new TypeError("@@toPrimitive must return a primitive value.");
422
+ }
423
+ return (hint === "string" ? String : Number)(input);
424
+ }
425
+ function _toPropertyKey(arg) {
426
+ var key = _toPrimitive(arg, "string");
427
+ return typeof key === "symbol" ? key : String(key);
428
+ }
429
+
430
+ /******************************************************************************
431
+ Copyright (c) Microsoft Corporation.
432
+
433
+ Permission to use, copy, modify, and/or distribute this software for any
434
+ purpose with or without fee is hereby granted.
435
+
436
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
437
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
438
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
439
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
440
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
441
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
442
+ PERFORMANCE OF THIS SOFTWARE.
443
+ ***************************************************************************** */
444
+ /* global Reflect, Promise, SuppressedError, Symbol */
445
+
446
+ function __awaiter(thisArg, _arguments, P, generator) {
447
+ function adopt(value) {
448
+ return value instanceof P ? value : new P(function (resolve) {
449
+ resolve(value);
450
+ });
451
+ }
452
+ return new (P || (P = Promise))(function (resolve, reject) {
453
+ function fulfilled(value) {
454
+ try {
455
+ step(generator.next(value));
456
+ } catch (e) {
457
+ reject(e);
458
+ }
459
+ }
460
+ function rejected(value) {
461
+ try {
462
+ step(generator["throw"](value));
463
+ } catch (e) {
464
+ reject(e);
465
+ }
466
+ }
467
+ function step(result) {
468
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
469
+ }
470
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
471
+ });
472
+ }
473
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
474
+ var e = new Error(message);
475
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
476
+ };
477
+
478
+ exports.TRTCAppScene = void 0;
479
+ (function (TRTCAppScene) {
480
+ // web
481
+ // TRTCAppSceneVideoCall = 0,
482
+ // TRTCAppSceneLIVE = 1,
483
+ // TRTCAppSceneAudioCall = 2,
484
+ // TRTCAppSceneVoiceChatRoom = 3,
485
+ // miniprogram
486
+ // TRTCAppSceneVideoCall = 'videocall',
487
+ // TRTCAppSceneLIVE = 'live',
488
+ // TRTCAppSceneAudioCall = 'audiocall',
489
+ // TRTCAppSceneVoiceChatRoom = 'voicechatroom',
490
+ TRTCAppScene[TRTCAppScene["TRTCAppSceneVideoCall"] = 0] = "TRTCAppSceneVideoCall";
491
+ TRTCAppScene[TRTCAppScene["TRTCAppSceneLIVE"] = 1] = "TRTCAppSceneLIVE";
492
+ TRTCAppScene[TRTCAppScene["TRTCAppSceneAudioCall"] = 2] = "TRTCAppSceneAudioCall";
493
+ TRTCAppScene[TRTCAppScene["TRTCAppSceneVoiceChatRoom"] = 3] = "TRTCAppSceneVoiceChatRoom";
494
+ })(exports.TRTCAppScene || (exports.TRTCAppScene = {}));
495
+ exports.TRTCRoleType = void 0;
496
+ (function (TRTCRoleType) {
497
+ TRTCRoleType[TRTCRoleType["TRTCRoleAnchor"] = 20] = "TRTCRoleAnchor";
498
+ TRTCRoleType[TRTCRoleType["TRTCRoleAudience"] = 21] = "TRTCRoleAudience";
499
+ })(exports.TRTCRoleType || (exports.TRTCRoleType = {}));
500
+ exports.TRTCVideoStreamType = void 0;
501
+ (function (TRTCVideoStreamType) {
502
+ TRTCVideoStreamType[TRTCVideoStreamType["TRTCVideoStreamTypeBig"] = 0] = "TRTCVideoStreamTypeBig";
503
+ TRTCVideoStreamType[TRTCVideoStreamType["TRTCVideoStreamTypeSmall"] = 1] = "TRTCVideoStreamTypeSmall";
504
+ TRTCVideoStreamType[TRTCVideoStreamType["TRTCVideoStreamTypeSub"] = 2] = "TRTCVideoStreamTypeSub";
505
+ })(exports.TRTCVideoStreamType || (exports.TRTCVideoStreamType = {}));
506
+ exports.TRTCVideoResolution = void 0;
507
+ (function (TRTCVideoResolution) {
508
+ TRTCVideoResolution[TRTCVideoResolution["TRTCVideoResolution_120_120"] = 1] = "TRTCVideoResolution_120_120";
509
+ TRTCVideoResolution[TRTCVideoResolution["TRTCVideoResolution_160_160"] = 3] = "TRTCVideoResolution_160_160";
510
+ TRTCVideoResolution[TRTCVideoResolution["TRTCVideoResolution_270_270"] = 5] = "TRTCVideoResolution_270_270";
511
+ TRTCVideoResolution[TRTCVideoResolution["TRTCVideoResolution_480_480"] = 7] = "TRTCVideoResolution_480_480";
512
+ TRTCVideoResolution[TRTCVideoResolution["TRTCVideoResolution_160_120"] = 50] = "TRTCVideoResolution_160_120";
513
+ TRTCVideoResolution[TRTCVideoResolution["TRTCVideoResolution_240_180"] = 52] = "TRTCVideoResolution_240_180";
514
+ TRTCVideoResolution[TRTCVideoResolution["TRTCVideoResolution_280_210"] = 54] = "TRTCVideoResolution_280_210";
515
+ TRTCVideoResolution[TRTCVideoResolution["TRTCVideoResolution_320_240"] = 56] = "TRTCVideoResolution_320_240";
516
+ TRTCVideoResolution[TRTCVideoResolution["TRTCVideoResolution_400_300"] = 58] = "TRTCVideoResolution_400_300";
517
+ TRTCVideoResolution[TRTCVideoResolution["TRTCVideoResolution_480_360"] = 60] = "TRTCVideoResolution_480_360";
518
+ TRTCVideoResolution[TRTCVideoResolution["TRTCVideoResolution_640_480"] = 62] = "TRTCVideoResolution_640_480";
519
+ TRTCVideoResolution[TRTCVideoResolution["TRTCVideoResolution_960_720"] = 64] = "TRTCVideoResolution_960_720";
520
+ TRTCVideoResolution[TRTCVideoResolution["TRTCVideoResolution_160_90"] = 100] = "TRTCVideoResolution_160_90";
521
+ TRTCVideoResolution[TRTCVideoResolution["TRTCVideoResolution_256_144"] = 102] = "TRTCVideoResolution_256_144";
522
+ TRTCVideoResolution[TRTCVideoResolution["TRTCVideoResolution_320_180"] = 104] = "TRTCVideoResolution_320_180";
523
+ TRTCVideoResolution[TRTCVideoResolution["TRTCVideoResolution_480_270"] = 106] = "TRTCVideoResolution_480_270";
524
+ TRTCVideoResolution[TRTCVideoResolution["TRTCVideoResolution_640_360"] = 108] = "TRTCVideoResolution_640_360";
525
+ TRTCVideoResolution[TRTCVideoResolution["TRTCVideoResolution_960_540"] = 110] = "TRTCVideoResolution_960_540";
526
+ TRTCVideoResolution[TRTCVideoResolution["TRTCVideoResolution_1280_720"] = 112] = "TRTCVideoResolution_1280_720";
527
+ TRTCVideoResolution[TRTCVideoResolution["TRTCVideoResolution_1920_1080"] = 114] = "TRTCVideoResolution_1920_1080";
528
+ })(exports.TRTCVideoResolution || (exports.TRTCVideoResolution = {}));
529
+ exports.TRTCVideoResolutionMode = void 0;
530
+ (function (TRTCVideoResolutionMode) {
531
+ TRTCVideoResolutionMode[TRTCVideoResolutionMode["TRTCVideoResolutionModeLandscape"] = 0] = "TRTCVideoResolutionModeLandscape";
532
+ TRTCVideoResolutionMode[TRTCVideoResolutionMode["TRTCVideoResolutionModePortrait"] = 1] = "TRTCVideoResolutionModePortrait";
533
+ })(exports.TRTCVideoResolutionMode || (exports.TRTCVideoResolutionMode = {}));
534
+ exports.TRTCVideoRotation = void 0;
535
+ (function (TRTCVideoRotation) {
536
+ TRTCVideoRotation[TRTCVideoRotation["TRTCVideoRotation0"] = 0] = "TRTCVideoRotation0";
537
+ TRTCVideoRotation[TRTCVideoRotation["TRTCVideoRotation90"] = 1] = "TRTCVideoRotation90";
538
+ TRTCVideoRotation[TRTCVideoRotation["TRTCVideoRotation180"] = 2] = "TRTCVideoRotation180";
539
+ TRTCVideoRotation[TRTCVideoRotation["TRTCVideoRotation270"] = 3] = "TRTCVideoRotation270";
540
+ })(exports.TRTCVideoRotation || (exports.TRTCVideoRotation = {}));
541
+ exports.TRTCVideoFillMode = void 0;
542
+ (function (TRTCVideoFillMode) {
543
+ TRTCVideoFillMode[TRTCVideoFillMode["TRTCVideoFillMode_Fill"] = 0] = "TRTCVideoFillMode_Fill";
544
+ TRTCVideoFillMode[TRTCVideoFillMode["TRTCVideoFillMode_Fit"] = 1] = "TRTCVideoFillMode_Fit";
545
+ })(exports.TRTCVideoFillMode || (exports.TRTCVideoFillMode = {}));
546
+ exports.TRTCVideoMirrorType = void 0;
547
+ (function (TRTCVideoMirrorType) {
548
+ TRTCVideoMirrorType[TRTCVideoMirrorType["TRTCVideoMirrorType_Auto"] = 0] = "TRTCVideoMirrorType_Auto";
549
+ TRTCVideoMirrorType[TRTCVideoMirrorType["TRTCVideoMirrorType_Enable"] = 1] = "TRTCVideoMirrorType_Enable";
550
+ TRTCVideoMirrorType[TRTCVideoMirrorType["TRTCVideoMirrorType_Disable"] = 2] = "TRTCVideoMirrorType_Disable";
551
+ })(exports.TRTCVideoMirrorType || (exports.TRTCVideoMirrorType = {}));
552
+ exports.TRTCAudioQuality = void 0;
553
+ (function (TRTCAudioQuality) {
554
+ TRTCAudioQuality[TRTCAudioQuality["TRTCAudioQualityDefault"] = 0] = "TRTCAudioQualityDefault";
555
+ TRTCAudioQuality[TRTCAudioQuality["TRTCAudioQualitySpeech"] = 1] = "TRTCAudioQualitySpeech";
556
+ TRTCAudioQuality[TRTCAudioQuality["TRTCAudioQualityMusic"] = 3] = "TRTCAudioQualityMusic";
557
+ })(exports.TRTCAudioQuality || (exports.TRTCAudioQuality = {}));
558
+ exports.TRTCBeautyStyle = void 0;
559
+ (function (TRTCBeautyStyle) {
560
+ TRTCBeautyStyle[TRTCBeautyStyle["TRTCBeautyStyleSmooth"] = 0] = "TRTCBeautyStyleSmooth";
561
+ TRTCBeautyStyle[TRTCBeautyStyle["TRTCBeautyStyleNature"] = 1] = "TRTCBeautyStyleNature";
562
+ })(exports.TRTCBeautyStyle || (exports.TRTCBeautyStyle = {}));
563
+
564
+ var _TRTCVideoResolutionM, _TRTCBeautyStyleMap, _TRTCVideoFillModeMap;
565
+ var translateTRTCAppScene = function translateTRTCAppScene(scene) {
566
+ switch (scene) {
567
+ case 0:
568
+ return 'videocall';
569
+ case 1:
570
+ return 'live';
571
+ case 2:
572
+ return 'audiocall';
573
+ case 3:
574
+ return 'voicechatroom';
575
+ default:
576
+ return '';
577
+ }
578
+ };
579
+ var translateTRTCVideoStreamType = function translateTRTCVideoStreamType(streamType) {
580
+ switch (streamType) {
581
+ case 0:
582
+ return 'main';
583
+ case 1:
584
+ return 'small';
585
+ case 2:
586
+ return 'aux';
587
+ default:
588
+ return '';
589
+ }
590
+ };
591
+ var translateTRTCStreamId = function translateTRTCStreamId(userId, streamType) {
592
+ return "".concat(userId, "_").concat(translateTRTCVideoStreamType(streamType));
593
+ };
594
+ var TRTCVideoResolutionMap = (_TRTCVideoResolutionM = {}, _defineProperty(_TRTCVideoResolutionM, exports.TRTCVideoResolution.TRTCVideoResolution_120_120, [120, 120]), _defineProperty(_TRTCVideoResolutionM, exports.TRTCVideoResolution.TRTCVideoResolution_160_160, [160, 160]), _defineProperty(_TRTCVideoResolutionM, exports.TRTCVideoResolution.TRTCVideoResolution_270_270, [270, 270]), _defineProperty(_TRTCVideoResolutionM, exports.TRTCVideoResolution.TRTCVideoResolution_480_480, [480, 480]), _defineProperty(_TRTCVideoResolutionM, exports.TRTCVideoResolution.TRTCVideoResolution_160_120, [160, 120]), _defineProperty(_TRTCVideoResolutionM, exports.TRTCVideoResolution.TRTCVideoResolution_240_180, [240, 180]), _defineProperty(_TRTCVideoResolutionM, exports.TRTCVideoResolution.TRTCVideoResolution_280_210, [280, 210]), _defineProperty(_TRTCVideoResolutionM, exports.TRTCVideoResolution.TRTCVideoResolution_320_240, [320, 240]), _defineProperty(_TRTCVideoResolutionM, exports.TRTCVideoResolution.TRTCVideoResolution_400_300, [400, 300]), _defineProperty(_TRTCVideoResolutionM, exports.TRTCVideoResolution.TRTCVideoResolution_480_360, [480, 360]), _defineProperty(_TRTCVideoResolutionM, exports.TRTCVideoResolution.TRTCVideoResolution_640_480, [640, 480]), _defineProperty(_TRTCVideoResolutionM, exports.TRTCVideoResolution.TRTCVideoResolution_960_720, [960, 720]), _defineProperty(_TRTCVideoResolutionM, exports.TRTCVideoResolution.TRTCVideoResolution_160_90, [160, 90]), _defineProperty(_TRTCVideoResolutionM, exports.TRTCVideoResolution.TRTCVideoResolution_256_144, [256, 144]), _defineProperty(_TRTCVideoResolutionM, exports.TRTCVideoResolution.TRTCVideoResolution_320_180, [320, 180]), _defineProperty(_TRTCVideoResolutionM, exports.TRTCVideoResolution.TRTCVideoResolution_480_270, [480, 270]), _defineProperty(_TRTCVideoResolutionM, exports.TRTCVideoResolution.TRTCVideoResolution_640_360, [640, 360]), _defineProperty(_TRTCVideoResolutionM, exports.TRTCVideoResolution.TRTCVideoResolution_960_540, [960, 540]), _defineProperty(_TRTCVideoResolutionM, exports.TRTCVideoResolution.TRTCVideoResolution_1280_720, [1280, 720]), _defineProperty(_TRTCVideoResolutionM, exports.TRTCVideoResolution.TRTCVideoResolution_1920_1080, [1920, 1080]), _TRTCVideoResolutionM);
595
+ var translateTRTCVideoResolution = function translateTRTCVideoResolution(resolution) {
596
+ var _TRTCVideoResolutionM2 = _slicedToArray(TRTCVideoResolutionMap[resolution], 2),
597
+ _TRTCVideoResolutionM3 = _TRTCVideoResolutionM2[0],
598
+ videoWidth = _TRTCVideoResolutionM3 === void 0 ? 0 : _TRTCVideoResolutionM3,
599
+ _TRTCVideoResolutionM4 = _TRTCVideoResolutionM2[1],
600
+ videoHeight = _TRTCVideoResolutionM4 === void 0 ? 0 : _TRTCVideoResolutionM4;
601
+ return {
602
+ videoWidth: videoWidth,
603
+ videoHeight: videoHeight
604
+ };
605
+ };
606
+ var translateTRTCVideoResolutionMode = function translateTRTCVideoResolutionMode(resolutionMode) {
607
+ switch (resolutionMode) {
608
+ case exports.TRTCVideoResolutionMode.TRTCVideoResolutionModeLandscape:
609
+ return 'horizontal';
610
+ case exports.TRTCVideoResolutionMode.TRTCVideoResolutionModePortrait:
611
+ return 'vertical';
612
+ default:
613
+ return '';
614
+ }
615
+ };
616
+ var translateTRTCVideoRotation = function translateTRTCVideoRotation(rotation) {
617
+ switch (rotation) {
618
+ case exports.TRTCVideoRotation.TRTCVideoRotation0:
619
+ return 'vertical';
620
+ case exports.TRTCVideoRotation.TRTCVideoRotation90:
621
+ return 'horizontal';
622
+ default:
623
+ return '';
624
+ }
625
+ };
626
+ var translateTRTCVideoMirrorType = function translateTRTCVideoMirrorType(mirrorType) {
627
+ switch (mirrorType) {
628
+ case exports.TRTCVideoMirrorType.TRTCVideoMirrorType_Auto:
629
+ return 'auto';
630
+ case exports.TRTCVideoMirrorType.TRTCVideoMirrorType_Enable:
631
+ return 'enable';
632
+ case exports.TRTCVideoMirrorType.TRTCVideoMirrorType_Disable:
633
+ return 'disable';
634
+ default:
635
+ return '';
636
+ }
637
+ };
638
+ var TRTCBeautyStyleMap = (_TRTCBeautyStyleMap = {}, _defineProperty(_TRTCBeautyStyleMap, exports.TRTCBeautyStyle.TRTCBeautyStyleSmooth, 'smooth'), _defineProperty(_TRTCBeautyStyleMap, exports.TRTCBeautyStyle.TRTCBeautyStyleNature, 'nature'), _TRTCBeautyStyleMap);
639
+ var translateBeautyStyle = function translateBeautyStyle(beautyStyle) {
640
+ return TRTCBeautyStyleMap[beautyStyle];
641
+ };
642
+ var TRTCVideoFillModeMap = (_TRTCVideoFillModeMap = {}, _defineProperty(_TRTCVideoFillModeMap, exports.TRTCVideoFillMode.TRTCVideoFillMode_Fill, 'fillCrop'), _defineProperty(_TRTCVideoFillModeMap, exports.TRTCVideoFillMode.TRTCVideoFillMode_Fit, 'contain'), _TRTCVideoFillModeMap);
643
+ var translateVideoFillMod = function translateVideoFillMod(videoFillMod) {
644
+ return TRTCVideoFillModeMap[videoFillMod];
645
+ };
646
+
647
+ var uniqueFunc = function uniqueFunc(arr, uniId) {
648
+ var res = new Map();
649
+ return arr.filter(function (item) {
650
+ return !res.has(item[uniId]) && res.set(item[uniId], 1);
651
+ });
652
+ };
653
+ var isNumber = function isNumber(param) {
654
+ return typeof param === 'number';
655
+ };
656
+ /**
657
+ * 安全执行 JSON.parse
658
+ * @param data
659
+ * @returns
660
+ */
661
+ function safelyParse(data) {
662
+ if (typeof data !== 'string') {
663
+ return data;
664
+ }
665
+ var result;
666
+ try {
667
+ var tempData = JSON.parse(data);
668
+ // 规避 JSON.parse('12345') 转化为 12345 的情况
669
+ if (_typeof(tempData) === 'object' && tempData) {
670
+ result = tempData;
671
+ } else {
672
+ result = data;
673
+ }
674
+ } catch (error) {
675
+ result = data;
676
+ }
677
+ return result;
678
+ }
679
+
680
+ var name = "@tencentcloud/trtc-cloud-wx";
681
+ var version = "0.0.4";
682
+ var description = "";
683
+ var main = "dist/trtc-cloud-wx.js";
684
+ var module$1 = "dist/trtc-cloud-wx.js";
685
+ var type = "module";
686
+ var scripts = {
687
+ build: "npm run clear && rollup -c",
688
+ dev: "node ./build/chokidar.js",
689
+ clear: "node ./build/clear.js",
690
+ copy: "node ./build/copy.js",
691
+ doc: "npx typedoc --tsconfig typedoc.json",
692
+ "doc:watch": "typedoc --watch",
693
+ "doc:build": "jsdoc -c jsdoc.json"
694
+ };
695
+ var keywords = [
696
+ ];
697
+ var author = "";
698
+ var license = "ISC";
699
+ var devDependencies = {
700
+ "@babel/core": "^7.21.4",
701
+ "@babel/preset-env": "^7.21.4",
702
+ "@babel/preset-typescript": "^7.21.4",
703
+ "@rollup/plugin-babel": "^6.0.3",
704
+ "@rollup/plugin-json": "^6.0.0",
705
+ "@rollup/plugin-terser": "^0.4.3",
706
+ "@rollup/plugin-typescript": "^11.0.0",
707
+ "@types/node": "^18.15.11",
708
+ "@typescript-eslint/eslint-plugin": "^2.28.0",
709
+ "@typescript-eslint/parser": "^2.28.0",
710
+ "babel-loader": "^9.1.2",
711
+ "better-docs": "^2.7.2",
712
+ chokidar: "^3.5.3",
713
+ "docdash-blue": "^1.1.9",
714
+ eslint: "^5.14.1",
715
+ "eslint-config-airbnb-base": "13.1.0",
716
+ "eslint-loader": "^2.1.2",
717
+ "eslint-plugin-import": "^2.27.5",
718
+ "eslint-plugin-node": "^7.0.1",
719
+ "eslint-plugin-promise": "^3.8.0",
720
+ jsdoc: "^4.0.2",
721
+ rollup: "^3.27.1",
722
+ "rollup-plugin-uglify": "^6.0.4",
723
+ taffydb: "^2.7.3",
724
+ tslib: "^2.5.0",
725
+ typedoc: "^0.24.4",
726
+ "typedoc-theme-hierarchy": "^3.1.0",
727
+ typescript: "^5.0.2"
728
+ };
729
+ var dependencies = {
730
+ eventemitter3: "^5.0.0",
731
+ "trtc-wx-sdk": "^1.1.5"
732
+ };
733
+ var packageJson = {
734
+ name: name,
735
+ version: version,
736
+ description: description,
737
+ main: main,
738
+ module: module$1,
739
+ type: type,
740
+ scripts: scripts,
741
+ keywords: keywords,
742
+ author: author,
743
+ license: license,
744
+ devDependencies: devDependencies,
745
+ dependencies: dependencies
746
+ };
747
+
748
+ /**
749
+ * TRTCCloud
750
+ * @interface
751
+ */
752
+ var TRTCCloud = /*#__PURE__*/function () {
753
+ // private handleAudioVolumeUpdate: (userVolumes: Array<TRTCVolumeInfo>) => void;
754
+ function TRTCCloud() {
755
+ _classCallCheck(this, TRTCCloud);
756
+ this.version = packageJson.version;
757
+ // 内部使用,用于调用接口时UI测监听,完成剩余逻辑
758
+ this.InterfaceEventEmitter = new EventEmitter();
759
+ // 外部使用,用户监听回调事件
760
+ this.EventEmitter = new EventEmitter();
761
+ this.role = exports.TRTCRoleType.TRTCRoleAnchor;
762
+ this.userId = '';
763
+ this.isEnterRoom = false;
764
+ this.isMuted = false;
765
+ this.isOpenCamera = false;
766
+ this.audioVolumeEvaluation = 0;
767
+ this.allTimer = {};
768
+ this.renderMap = new Map();
769
+ this.init();
770
+ }
771
+ /**
772
+ * 获取 TRTCCloud 实例(单例模式)
773
+ * @category Base
774
+ */
775
+ _createClass(TRTCCloud, [{
776
+ key: "getSDKVersion",
777
+ value: function getSDKVersion() {
778
+ return this.version;
779
+ }
780
+ }, {
781
+ key: "destroy",
782
+ value: function destroy() {
783
+ this.EventEmitter.removeAllListeners();
784
+ this.InterfaceEventEmitter.removeAllListeners();
785
+ this.trtc.exitRoom();
786
+ }
787
+ }, {
788
+ key: "init",
789
+ value: function init() {
790
+ this.trtc = new TRTC(this);
791
+ this.TRTC_EVENT = this.trtc.EVENT;
792
+ this.trtc.createPusher({});
793
+ this.bindTRTCEvent();
794
+ this.handleNetworkQuality = this.getHandleNetworkQuality(2000);
795
+ }
796
+ }, {
797
+ key: "reset",
798
+ value: function reset() {
799
+ var _this = this;
800
+ this.role = exports.TRTCRoleType.TRTCRoleAnchor;
801
+ this.userId = '';
802
+ this.isEnterRoom = false;
803
+ this.isMuted = false;
804
+ this.isOpenCamera = false;
805
+ Object.keys(this.allTimer).forEach(function (key) {
806
+ return clearInterval(_this.allTimer[key]);
807
+ });
808
+ }
809
+ }, {
810
+ key: "bindTRTCEvent",
811
+ value: function bindTRTCEvent() {
812
+ var _this2 = this;
813
+ this.trtc.on(this.TRTC_EVENT.LOCAL_LEAVE, function (event) {
814
+ // todo 第二个参数为进房耗时 此处调用start的时候处理
815
+ // this.emit('onEnterRoom', 0)
816
+ });
817
+ this.trtc.on(this.TRTC_EVENT.ERROR, function (event) {
818
+ var _event$data = event.data,
819
+ code = _event$data.code,
820
+ message = _event$data.message;
821
+ _this2.emit('onError', code, message);
822
+ });
823
+ this.trtc.on(this.TRTC_EVENT.REMOTE_USER_JOIN, function (event) {
824
+ var userID = event.data.userID;
825
+ _this2.emit('onRemoteUserEnterRoom', userID);
826
+ });
827
+ // 远端用户退出
828
+ this.trtc.on(this.TRTC_EVENT.REMOTE_USER_LEAVE, function (event) {
829
+ var _event$data2 = event.data,
830
+ userID = _event$data2.userID;
831
+ _event$data2.playerList;
832
+ _this2.emit('onRemoteUserLeaveRoom', userID, 0);
833
+ _this2.InterfaceEventEmitter.emit('onRemoteUserLeaveRoom', userID, 0);
834
+ });
835
+ // 远端用户推送视频
836
+ this.trtc.on(this.TRTC_EVENT.REMOTE_VIDEO_ADD, function (event) {
837
+ var player = event.data.player;
838
+ _this2.emit(player.streamType === 'aux' ? 'onUserSubStreamAvailable' : 'onUserVideoAvailable', player.userID, 1);
839
+ });
840
+ // 远端用户取消推送视频
841
+ this.trtc.on(this.TRTC_EVENT.REMOTE_VIDEO_REMOVE, function (event) {
842
+ var player = event.data.player;
843
+ _this2.emit(player.streamType === 'aux' ? 'onUserSubStreamAvailable' : 'onUserVideoAvailable', player.userID, 0);
844
+ });
845
+ // 远端用户推送音频
846
+ this.trtc.on(this.TRTC_EVENT.REMOTE_AUDIO_ADD, function (event) {
847
+ var player = event.data.player;
848
+ _this2.emit('onUserAudioAvailable', player.userID, 1);
849
+ _this2.muteRemoteAudio(player.userID, false);
850
+ });
851
+ // 远端用户取消推送音频
852
+ this.trtc.on(this.TRTC_EVENT.REMOTE_AUDIO_REMOVE, function (event) {
853
+ var player = event.data.player;
854
+ _this2.emit('onUserAudioAvailable', player.userID, 0);
855
+ });
856
+ this.trtc.on(this.TRTC_EVENT.REMOTE_AUDIO_VOLUME_UPDATE, function (event) {
857
+ var playerList = event.data.playerList;
858
+ var userVolumes = playerList.map(function (player) {
859
+ return {
860
+ userId: player.userID,
861
+ volume: player.volume
862
+ };
863
+ });
864
+ _this2.handleAudioVolumeUpdate(userVolumes);
865
+ });
866
+ this.trtc.on(this.TRTC_EVENT.LOCAL_AUDIO_VOLUME_UPDATE, function (event) {
867
+ var pusher = event.data.pusher;
868
+ var userVolumes = [{
869
+ userId: pusher.userID,
870
+ volume: pusher.volume
871
+ }];
872
+ _this2.handleAudioVolumeUpdate(userVolumes);
873
+ });
874
+ this.trtc.on(this.TRTC_EVENT.LOCAL_NET_STATE_UPDATE, function (event) {
875
+ var pusher = event.data.pusher;
876
+ _this2.handleNetworkQuality({
877
+ pusher: pusher
878
+ });
879
+ });
880
+ this.trtc.on(this.TRTC_EVENT.REMOTE_NET_STATE_UPDATE, function (event) {
881
+ var playerList = event.data.playerList;
882
+ _this2.handleNetworkQuality({
883
+ playerList: playerList
884
+ });
885
+ });
886
+ }
887
+ }, {
888
+ key: "getHandleAudioVolumeUpdate",
889
+ value: function getHandleAudioVolumeUpdate(interval) {
890
+ var _this3 = this;
891
+ var _a;
892
+ if ((_a = this.allTimer) === null || _a === void 0 ? void 0 : _a.AudioVolume) {
893
+ clearInterval(this.allTimer.AudioVolume);
894
+ }
895
+ if (interval === 0) return function () {};
896
+ var tempUserVolumes = [];
897
+ var filterUselessItem = function filterUselessItem(userId) {
898
+ tempUserVolumes = tempUserVolumes.filter(function (userVolume) {
899
+ return userVolume.userId !== userId;
900
+ });
901
+ };
902
+ this.InterfaceEventEmitter.off('onRemoteUserLeaveRoom'); // 防止重复监听
903
+ this.InterfaceEventEmitter.on('onRemoteUserLeaveRoom', filterUselessItem, this.getHandleAudioVolumeUpdate);
904
+ return function (userVolumes) {
905
+ tempUserVolumes = uniqueFunc([].concat(_toConsumableArray(userVolumes), _toConsumableArray(tempUserVolumes)), 'userId');
906
+ if (_this3.allTimer.AudioVolume) return;
907
+ var timer = setInterval(function () {
908
+ _this3.emit('onUserVoiceVolume', tempUserVolumes, tempUserVolumes.length, 0 // todo 此参数无用,暂时废弃
909
+ );
910
+ }, interval);
911
+ _this3.allTimer.AudioVolume = timer;
912
+ };
913
+ }
914
+ }, {
915
+ key: "handleAudioVolumeUpdate",
916
+ value: function handleAudioVolumeUpdate(userVolumes) {}
917
+ }, {
918
+ key: "getHandleNetworkQuality",
919
+ value: function getHandleNetworkQuality(interval) {
920
+ var _this4 = this;
921
+ var _a;
922
+ if ((_a = this.allTimer) === null || _a === void 0 ? void 0 : _a.networkQuality) {
923
+ clearInterval(this.allTimer.networkQuality);
924
+ }
925
+ if (interval === 0) return function () {};
926
+ var resultQuality = {
927
+ localQuality: null,
928
+ remoteQuality: []
929
+ };
930
+ this.on('onRemoteUserLeaveRoom', function (userId) {
931
+ resultQuality.remoteQuality = resultQuality.remoteQuality.filter(function (quality) {
932
+ return quality.userId !== userId;
933
+ });
934
+ }, this);
935
+ return function (data) {
936
+ var pusher = data.pusher,
937
+ playerList = data.playerList;
938
+ if (pusher) resultQuality.localQuality = {
939
+ userId: pusher.userID,
940
+ quality: pusher.netStatus
941
+ };
942
+ if (playerList) {
943
+ resultQuality.remoteQuality = playerList.map(function (player) {
944
+ return {
945
+ userId: player.userID,
946
+ quality: player.netStatus
947
+ };
948
+ });
949
+ }
950
+ if (_this4.allTimer.networkQuality) return;
951
+ var timer = setInterval(function () {
952
+ _this4.emit('onNetworkQuality', resultQuality.localQuality, resultQuality.remoteQuality);
953
+ }, interval);
954
+ _this4.allTimer.networkQuality = timer;
955
+ };
956
+ }
957
+ }, {
958
+ key: "handleNetworkQuality",
959
+ value: function handleNetworkQuality(quality) {}
960
+ /**
961
+ * @category Base
962
+ */
963
+ }, {
964
+ key: "on",
965
+ value: function on(eventName, handler, context) {
966
+ console.log('[TRTCCloud-WX:on]:', eventName);
967
+ this.EventEmitter.on(eventName, handler, context);
968
+ }
969
+ /**
970
+ * @category Base
971
+ */
972
+ }, {
973
+ key: "off",
974
+ value: function off(eventName, handler, context) {
975
+ this.EventEmitter.off(eventName, handler, context);
976
+ }
977
+ /**
978
+ * @category Base
979
+ */
980
+ }, {
981
+ key: "emit",
982
+ value: function emit(eventName) {
983
+ var _this$EventEmitter;
984
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
985
+ args[_key - 1] = arguments[_key];
986
+ }
987
+ (_this$EventEmitter = this.EventEmitter).emit.apply(_this$EventEmitter, [eventName].concat(args));
988
+ }
989
+ /**
990
+ * @category 房间
991
+ */
992
+ }, {
993
+ key: "enterRoom",
994
+ value: function enterRoom(params, scene) {
995
+ var _this5 = this;
996
+ var startTime = new Date().getTime();
997
+ var sdkAppId = params.sdkAppId,
998
+ userId = params.userId,
999
+ userSig = params.userSig,
1000
+ roomId = params.roomId,
1001
+ strRoomId = params.strRoomId,
1002
+ role = params.role,
1003
+ privateMapKey = params.privateMapKey;
1004
+ this.userId = userId;
1005
+ this.trtc.createPusher({});
1006
+ var pusher = this.trtc.enterRoom({
1007
+ sdkAppID: sdkAppId,
1008
+ userID: userId,
1009
+ userSig: userSig,
1010
+ roomID: roomId,
1011
+ strRoomID: strRoomId,
1012
+ role: role,
1013
+ privateMapKey: privateMapKey,
1014
+ scene: translateTRTCAppScene(scene),
1015
+ enableMic: false,
1016
+ enableCamera: false,
1017
+ videoPreview: false
1018
+ });
1019
+ this.InterfaceEventEmitter.emit('pusherAttributesChange', {
1020
+ pusher: pusher,
1021
+ callback: function callback() {
1022
+ _this5.trtc.getPusherInstance().start({
1023
+ success: function success() {
1024
+ _this5.scene = scene;
1025
+ _this5.isEnterRoom = true;
1026
+ var endTime = new Date().getTime();
1027
+ _this5.emit('onEnterRoom', endTime - startTime);
1028
+ },
1029
+ fail: function fail() {
1030
+ _this5.emit('onEnterRoom', -1);
1031
+ }
1032
+ });
1033
+ }
1034
+ });
1035
+ }
1036
+ /**
1037
+ * @category 房间
1038
+ */
1039
+ }, {
1040
+ key: "exitRoom",
1041
+ value: function exitRoom() {
1042
+ var _this6 = this;
1043
+ var _this$trtc$exitRoom = this.trtc.exitRoom(),
1044
+ pusher = _this$trtc$exitRoom.pusher;
1045
+ this.InterfaceEventEmitter.emit('pusherAttributesChange', {
1046
+ pusher: pusher,
1047
+ callback: function callback() {
1048
+ _this6.reset();
1049
+ _this6.emit('onExitRoom', 0);
1050
+ }
1051
+ });
1052
+ }
1053
+ /**
1054
+ * @category 房间
1055
+ */
1056
+ }, {
1057
+ key: "switchRoom",
1058
+ value: function switchRoom() {}
1059
+ /**
1060
+ * 切换角色,仅适用于直播场景(TRTCAppSceneLIVE 和 TRTCAppSceneVoiceChatRoom)
1061
+ * @category 房间
1062
+ */
1063
+ }, {
1064
+ key: "switchRole",
1065
+ value: function switchRole(role) {
1066
+ var _this7 = this;
1067
+ var tempRole = this.role;
1068
+ this.role = role;
1069
+ if (tempRole === role || role === exports.TRTCRoleType.TRTCRoleAnchor) {
1070
+ this.emit('onSwitchRole', 0, '');
1071
+ return;
1072
+ }
1073
+ var pusher = this.trtc.setPusherAttributes({
1074
+ enableCamera: false,
1075
+ enableMic: false
1076
+ });
1077
+ this.InterfaceEventEmitter.emit('pusherAttributesChange', {
1078
+ pusher: pusher,
1079
+ callback: function callback() {
1080
+ _this7.emit('onSwitchRole', 0, '');
1081
+ }
1082
+ });
1083
+ }
1084
+ }, {
1085
+ key: "connectOtherRoom",
1086
+ value: function connectOtherRoom() {}
1087
+ }, {
1088
+ key: "disconnectOtherRoom",
1089
+ value: function disconnectOtherRoom() {}
1090
+ }, {
1091
+ key: "setDefaultStreamRecvMode",
1092
+ value: function setDefaultStreamRecvMode() {}
1093
+ /**
1094
+ * 启动本地摄像头采集和预览
1095
+ * @category 视频
1096
+ */
1097
+ }, {
1098
+ key: "startLocalPreview",
1099
+ value: function startLocalPreview() {
1100
+ var _this8 = this;
1101
+ var frontCamera = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
1102
+ return new Promise(function (resolve, reject) {
1103
+ if (_this8.role !== exports.TRTCRoleType.TRTCRoleAnchor) {
1104
+ resolve(null);
1105
+ return;
1106
+ }
1107
+ var pusher = _this8.trtc.setPusherAttributes({
1108
+ videoPreview: _this8.isEnterRoom ? _this8.isMuted : true,
1109
+ enableCamera: _this8.isEnterRoom ? !_this8.isMuted : false,
1110
+ frontCamera: frontCamera ? 'front' : 'back'
1111
+ });
1112
+ _this8.InterfaceEventEmitter.emit('pusherAttributesChange', {
1113
+ pusher: pusher,
1114
+ callback: function callback() {
1115
+ return __awaiter(_this8, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
1116
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
1117
+ while (1) switch (_context.prev = _context.next) {
1118
+ case 0:
1119
+ this.emit('onFirstVideoFrame', '', exports.TRTCVideoStreamType.TRTCVideoStreamTypeBig, pusher.videoWidth, pusher.videoHeight);
1120
+ if (this.isEnterRoom) {
1121
+ this.emit('onSendFirstLocalVideoFrame', exports.TRTCVideoStreamType.TRTCVideoStreamTypeBig);
1122
+ }
1123
+ resolve(null);
1124
+ this.isOpenCamera = true;
1125
+ case 4:
1126
+ case "end":
1127
+ return _context.stop();
1128
+ }
1129
+ }, _callee, this);
1130
+ }));
1131
+ }
1132
+ });
1133
+ });
1134
+ }
1135
+ /**
1136
+ * 停止本地摄像头采集和预览
1137
+ * @category 视频
1138
+ */
1139
+ }, {
1140
+ key: "stopLocalPreview",
1141
+ value: function stopLocalPreview() {
1142
+ var _this9 = this;
1143
+ var pusher = this.trtc.setPusherAttributes({
1144
+ videoPreview: false,
1145
+ enableCamera: false
1146
+ });
1147
+ this.InterfaceEventEmitter.emit('pusherAttributesChange', {
1148
+ pusher: pusher,
1149
+ callback: function callback() {
1150
+ _this9.isOpenCamera = false;
1151
+ _this9.emit('onUserVideoAvailable', _this9.userId, 0);
1152
+ }
1153
+ });
1154
+ }
1155
+ /**
1156
+ * 修改本地摄像头预览的 HTML 元素,小程序不支持
1157
+ * @category 视频
1158
+ */
1159
+ }, {
1160
+ key: "updateLocalView",
1161
+ value: function updateLocalView(view) {
1162
+ if (view !== null) {
1163
+ this.startLocalPreview();
1164
+ return;
1165
+ }
1166
+ this.stopLocalPreview();
1167
+ }
1168
+ /**
1169
+ * 暂停/恢复发布本地的视频流
1170
+ * @category 视频
1171
+ * @param {boolean} mute true:屏蔽;false:开启,默认值:false
1172
+ * @param {TRTCVideoStreamType} streamType 要暂停/恢复的视频流类型, 仅支持 TRTCVideoStreamTypeBig 和 TRTCVideoStreamTypeSub
1173
+ */
1174
+ }, {
1175
+ key: "muteLocalVideo",
1176
+ value: function muteLocalVideo(mute, streamType) {
1177
+ var _this10 = this;
1178
+ return new Promise(function (resolve, reject) {
1179
+ if (!_this10.isOpenCamera) {
1180
+ resolve(null);
1181
+ return;
1182
+ }
1183
+ var pusher = {};
1184
+ switch (streamType) {
1185
+ case exports.TRTCVideoStreamType.TRTCVideoStreamTypeBig:
1186
+ case exports.TRTCVideoStreamType.TRTCVideoStreamTypeSub:
1187
+ _this10.isMuted = mute;
1188
+ pusher = _this10.trtc.setPusherAttributes({
1189
+ videoPreview: mute,
1190
+ enableCamera: !mute
1191
+ });
1192
+ _this10.InterfaceEventEmitter.emit('pusherAttributesChange', {
1193
+ pusher: pusher,
1194
+ callback: function callback() {
1195
+ resolve(null);
1196
+ }
1197
+ });
1198
+ break;
1199
+ default:
1200
+ resolve(null);
1201
+ }
1202
+ });
1203
+ }
1204
+ /**
1205
+ * 开始显示远端视频画面
1206
+ * @category 视频
1207
+ * @param userId 对方的用户标识
1208
+ * @param view 此参数无效,小程序不支持
1209
+ * @param streamType 视频流类型
1210
+ */
1211
+ }, {
1212
+ key: "startRemoteView",
1213
+ value: function startRemoteView(userId, view, streamType) {
1214
+ var _this11 = this;
1215
+ var streamId = translateTRTCStreamId(userId, streamType);
1216
+ var playerAttributes = this.setTRTCPlayerAttributes(streamId, {
1217
+ muteVideo: false,
1218
+ stopVideo: false
1219
+ });
1220
+ this.renderMap.set(streamId, view);
1221
+ this.InterfaceEventEmitter.emit('playerAttributesChange', {
1222
+ streamId: streamId,
1223
+ view: this.renderMap.get(streamId),
1224
+ playerAttributes: playerAttributes,
1225
+ callback: function callback() {
1226
+ _this11.emit('onFirstVideoFrame', userId, streamType, 0, 0);
1227
+ }
1228
+ });
1229
+ }
1230
+ /**
1231
+ * 停止显示远端视频画面,同时不再拉取该远端用户的视频数据流
1232
+ * @param userId 对方的用户标识
1233
+ * @param streamType 视频流类型
1234
+ */
1235
+ }, {
1236
+ key: "stopRemoteView",
1237
+ value: function stopRemoteView(userId, streamType) {
1238
+ var streamId = translateTRTCStreamId(userId, streamType);
1239
+ var playerAttributes = this.setTRTCPlayerAttributes(streamId, {
1240
+ muteVideo: true,
1241
+ stopVideo: true
1242
+ });
1243
+ this.InterfaceEventEmitter.emit('playerAttributesChange', {
1244
+ streamId: streamId,
1245
+ view: this.renderMap.get(streamId),
1246
+ playerAttributes: playerAttributes
1247
+ });
1248
+ }
1249
+ /**
1250
+ * 修改远端视频渲染的 HTML 元素,小程序不支持
1251
+ * @param userId 远端视频流的用户 ID
1252
+ * @param view
1253
+ * 接受远端视频流渲染的 HTML 元素,传入 null 结束远端视频的渲染
1254
+ * - 传入的 HTML 元素必须时块元素,例如:div
1255
+ * @param streamType
1256
+ * @returns
1257
+ */
1258
+ }, {
1259
+ key: "updateRemoteView",
1260
+ value: function updateRemoteView(userId, view, streamType) {
1261
+ if (view !== null) {
1262
+ this.startRemoteView(userId, view, streamType);
1263
+ return;
1264
+ }
1265
+ this.stopRemoteView(userId, streamType);
1266
+ }
1267
+ // 停止显示所有远端视频画面,同时不再拉取该远端用户的视频数据流
1268
+ }, {
1269
+ key: "stopAllRemoteView",
1270
+ value: function stopAllRemoteView() {
1271
+ var _this12 = this;
1272
+ var playerList = this.trtc.getPlayerList();
1273
+ playerList.forEach(function (player) {
1274
+ var streamId = player.streamID;
1275
+ var playerAttributes = _this12.setTRTCPlayerAttributes(streamId, {
1276
+ muteVideo: true,
1277
+ stopVideo: true
1278
+ });
1279
+ _this12.InterfaceEventEmitter.emit('playerAttributesChange', {
1280
+ streamId: streamId,
1281
+ view: _this12.renderMap.get(streamId),
1282
+ playerAttributes: playerAttributes
1283
+ });
1284
+ });
1285
+ }
1286
+ // 暂停接收指定的远端视频流
1287
+ // 该接口仅停止接收远程用户的视频流,但并不释放显示资源,所以视频画面会冻屏在 mute 前的最后一帧。
1288
+ }, {
1289
+ key: "muteRemoteVideoStream",
1290
+ value: function muteRemoteVideoStream(userId, mute, streamType) {
1291
+ var streamId = translateTRTCStreamId(userId, streamType);
1292
+ var playerAttributes = this.setTRTCPlayerAttributes(streamId, {
1293
+ muteVideo: mute
1294
+ });
1295
+ this.InterfaceEventEmitter.emit('playerAttributesChange', {
1296
+ streamId: streamId,
1297
+ view: this.renderMap.get(streamId),
1298
+ playerAttributes: playerAttributes
1299
+ });
1300
+ }
1301
+ }, {
1302
+ key: "muteAllRemoteVideoStreams",
1303
+ value: function muteAllRemoteVideoStreams(mute) {
1304
+ var _this13 = this;
1305
+ var playerList = this.trtc.getPlayerList();
1306
+ playerList.forEach(function (player) {
1307
+ var streamId = player.streamID;
1308
+ var playerAttributes = _this13.setTRTCPlayerAttributes(streamId, {
1309
+ muteVideo: mute
1310
+ });
1311
+ _this13.InterfaceEventEmitter.emit('playerAttributesChange', {
1312
+ streamId: streamId,
1313
+ view: _this13.renderMap.get(streamId),
1314
+ playerAttributes: playerAttributes
1315
+ });
1316
+ });
1317
+ }
1318
+ }, {
1319
+ key: "setTRTCPlayerAttributes",
1320
+ value: function setTRTCPlayerAttributes(streamId, options) {
1321
+ this.trtc.setPlayerAttributes(streamId, options);
1322
+ var _this$trtc$getPlayerI = this.trtc.getPlayerInstance(streamId),
1323
+ playerAttributes = _this$trtc$getPlayerI.playerAttributes;
1324
+ return playerAttributes;
1325
+ }
1326
+ }, {
1327
+ key: "setVideoEncoderParam",
1328
+ value: function setVideoEncoderParam(params) {
1329
+ var videoResolution = params.videoResolution;
1330
+ params.resMode;
1331
+ var videoFps = params.videoFps;
1332
+ params.videoBitrate;
1333
+ var minVideoBitrate = params.minVideoBitrate;
1334
+ var _translateTRTCVideoRe = translateTRTCVideoResolution(videoResolution),
1335
+ videoWidth = _translateTRTCVideoRe.videoWidth,
1336
+ videoHeight = _translateTRTCVideoRe.videoHeight;
1337
+ // const videoOrientation = translateTRTCVideoResolutionMode(resMode);
1338
+ var pusher = this.trtc.setPusherAttributes({
1339
+ videoWidth: videoWidth,
1340
+ videoHeight: videoHeight,
1341
+ // videoOrientation,
1342
+ fps: videoFps,
1343
+ minBitrate: minVideoBitrate
1344
+ });
1345
+ this.InterfaceEventEmitter.emit('pusherAttributesChange', {
1346
+ pusher: pusher
1347
+ });
1348
+ }
1349
+ }, {
1350
+ key: "setLocalRenderParams",
1351
+ value: function setLocalRenderParams(params) {
1352
+ var rotation = params.rotation;
1353
+ params.fillMode;
1354
+ var mirrorType = params.mirrorType;
1355
+ var videoOrientation = translateTRTCVideoRotation(rotation);
1356
+ var localMirror = translateTRTCVideoMirrorType(mirrorType);
1357
+ var pusher = this.trtc.setPusherAttributes({
1358
+ videoOrientation: videoOrientation,
1359
+ localMirror: localMirror
1360
+ });
1361
+ this.InterfaceEventEmitter.emit('pusherAttributesChange', {
1362
+ pusher: pusher
1363
+ });
1364
+ }
1365
+ /**
1366
+ * 设置远端图像的渲染模式
1367
+ * @param {string} userId
1368
+ * @param {TRTCVideoStreamType} streamType
1369
+ * @param {TRTCRenderParams} params
1370
+ */
1371
+ }, {
1372
+ key: "setRemoteRenderParams",
1373
+ value: function setRemoteRenderParams(userId, streamType, params) {
1374
+ var fillMode = params.fillMode,
1375
+ rotation = params.rotation;
1376
+ params.mirrorType;
1377
+ var streamId = translateTRTCStreamId(userId, streamType); // 音频默认都是主流
1378
+ var playerAttributes = this.setTRTCPlayerAttributes(streamId, {
1379
+ objectFit: translateVideoFillMod(fillMode),
1380
+ orientation: translateTRTCVideoRotation(rotation)
1381
+ });
1382
+ this.InterfaceEventEmitter.emit('playerAttributesChange', {
1383
+ streamId: streamId,
1384
+ view: this.renderMap.get(streamId),
1385
+ playerAttributes: playerAttributes
1386
+ });
1387
+ }
1388
+ }, {
1389
+ key: "startLocalAudio",
1390
+ value: function startLocalAudio(quality) {
1391
+ var _this14 = this;
1392
+ var pusher = this.trtc.setPusherAttributes({
1393
+ enableMic: true
1394
+ });
1395
+ this.InterfaceEventEmitter.emit('pusherAttributesChange', {
1396
+ pusher: pusher,
1397
+ callback: function callback() {
1398
+ _this14.emit('onMicDidReady');
1399
+ _this14.emit('onUserAudioAvailable', _this14.userId, 1);
1400
+ if (_this14.enterRoom) {
1401
+ _this14.emit('onSendFirstLocalAudioFrame');
1402
+ }
1403
+ }
1404
+ });
1405
+ }
1406
+ }, {
1407
+ key: "stopLocalAudio",
1408
+ value: function stopLocalAudio() {
1409
+ var _this15 = this;
1410
+ var pusher = this.trtc.setPusherAttributes({
1411
+ enableMic: false
1412
+ });
1413
+ this.InterfaceEventEmitter.emit('pusherAttributesChange', {
1414
+ pusher: pusher,
1415
+ callback: function callback() {
1416
+ _this15.emit('onUserAudioAvailable', _this15.userId, 0);
1417
+ }
1418
+ });
1419
+ }
1420
+ }, {
1421
+ key: "muteLocalAudio",
1422
+ value: function muteLocalAudio(mute) {
1423
+ var _this16 = this;
1424
+ var pusher = this.trtc.setPusherAttributes({
1425
+ enableMic: !mute
1426
+ });
1427
+ this.InterfaceEventEmitter.emit('pusherAttributesChange', {
1428
+ pusher: pusher,
1429
+ callback: function callback() {
1430
+ _this16.emit('onUserAudioAvailable', _this16.userId, mute === true ? 0 : 1);
1431
+ }
1432
+ });
1433
+ }
1434
+ }, {
1435
+ key: "muteRemoteAudio",
1436
+ value: function muteRemoteAudio(userId, mute) {
1437
+ var streamId = translateTRTCStreamId(userId, exports.TRTCVideoStreamType.TRTCVideoStreamTypeBig); // 音频默认都是主流
1438
+ var playerAttributes = this.setTRTCPlayerAttributes(streamId, {
1439
+ muteAudio: mute
1440
+ });
1441
+ this.InterfaceEventEmitter.emit('playerAttributesChange', {
1442
+ streamId: streamId,
1443
+ view: this.renderMap.get(streamId),
1444
+ playerAttributes: playerAttributes
1445
+ });
1446
+ }
1447
+ }, {
1448
+ key: "muteAllRemoteAudio",
1449
+ value: function muteAllRemoteAudio(mute) {
1450
+ var _this17 = this;
1451
+ var playerList = this.trtc.getPlayerList();
1452
+ playerList.forEach(function (player) {
1453
+ var streamId = player.streamID;
1454
+ var playerAttributes = _this17.setTRTCPlayerAttributes(streamId, {
1455
+ muteAudio: mute
1456
+ });
1457
+ _this17.InterfaceEventEmitter.emit('playerAttributesChange', {
1458
+ streamId: streamId,
1459
+ view: _this17.renderMap.get(streamId),
1460
+ playerAttributes: playerAttributes
1461
+ });
1462
+ });
1463
+ }
1464
+ }, {
1465
+ key: "enableAudioVolumeEvaluation",
1466
+ value: function enableAudioVolumeEvaluation(interval) {
1467
+ this.handleAudioVolumeUpdate = this.getHandleAudioVolumeUpdate(interval);
1468
+ }
1469
+ /**
1470
+ * 切换前后摄像头
1471
+ */
1472
+ }, {
1473
+ key: "switchCamera",
1474
+ value: function switchCamera(frontCamera) {
1475
+ var _this18 = this;
1476
+ var pusher = this.trtc.getPusherInstance();
1477
+ if (frontCamera === (pusher.pusherAttributes.frontCamera === 'front')) return Promise.resolve();
1478
+ return new Promise(function (resolve, reject) {
1479
+ wx.createLivePusherContext().switchCamera({
1480
+ success: function success(event) {
1481
+ var pusher = _this18.trtc.setPusherAttributes({
1482
+ frontCamera: true
1483
+ });
1484
+ _this18.InterfaceEventEmitter.emit('pusherAttributesChange', {
1485
+ pusher: pusher
1486
+ });
1487
+ resolve(event);
1488
+ },
1489
+ fail: function fail(error) {
1490
+ reject(error);
1491
+ }
1492
+ });
1493
+ });
1494
+ }
1495
+ }, {
1496
+ key: "setBeautyStyle",
1497
+ value: function setBeautyStyle(style, beauty, white, ruddiness) {
1498
+ var pusher = this.trtc.setPusherAttributes({
1499
+ beautyStyle: style,
1500
+ beautyLevel: beauty,
1501
+ whitenessLevel: white
1502
+ });
1503
+ this.InterfaceEventEmitter.emit('pusherAttributesChange', {
1504
+ pusher: pusher
1505
+ });
1506
+ }
1507
+ }, {
1508
+ key: "sendSEIMsg",
1509
+ value: function sendSEIMsg(msg) {
1510
+ return new Promise(function (resolve, reject) {
1511
+ wx.createLivePusherContext().sendMessage({
1512
+ msg: msg,
1513
+ success: function success(event) {
1514
+ resolve(event);
1515
+ },
1516
+ fail: function fail(error) {
1517
+ reject(error);
1518
+ }
1519
+ });
1520
+ });
1521
+ }
1522
+ }, {
1523
+ key: "startPlayMusic",
1524
+ value: function startPlayMusic(musicParam, callbackMap) {
1525
+ return new Promise(function (resolve, reject) {
1526
+ var path = musicParam.path,
1527
+ _musicParam$startTime = musicParam.startTimeMS,
1528
+ startTimeMS = _musicParam$startTime === void 0 ? 0 : _musicParam$startTime,
1529
+ _musicParam$endTimeMS = musicParam.endTimeMS,
1530
+ endTimeMS = _musicParam$endTimeMS === void 0 ? 0 : _musicParam$endTimeMS;
1531
+ wx.createLivePusherContext().playBGM({
1532
+ url: path,
1533
+ startTimeMs: startTimeMS,
1534
+ endTimeMs: endTimeMS,
1535
+ success: function success(event) {
1536
+ resolve(event);
1537
+ },
1538
+ fail: function fail(error) {
1539
+ reject(error);
1540
+ }
1541
+ });
1542
+ });
1543
+ }
1544
+ }, {
1545
+ key: "stopPlayMusic",
1546
+ value: function stopPlayMusic() {
1547
+ return new Promise(function (resolve, reject) {
1548
+ wx.createLivePusherContext().stopBGM({
1549
+ success: function success(event) {
1550
+ resolve(event);
1551
+ },
1552
+ fail: function fail(error) {
1553
+ reject(error);
1554
+ }
1555
+ });
1556
+ });
1557
+ }
1558
+ }, {
1559
+ key: "pausePlayMusic",
1560
+ value: function pausePlayMusic() {
1561
+ return new Promise(function (resolve, reject) {
1562
+ wx.createLivePusherContext().pauseBGM({
1563
+ success: function success(event) {
1564
+ resolve(event);
1565
+ },
1566
+ fail: function fail(error) {
1567
+ reject(error);
1568
+ }
1569
+ });
1570
+ });
1571
+ }
1572
+ }, {
1573
+ key: "resumePlayMusic",
1574
+ value: function resumePlayMusic() {
1575
+ return new Promise(function (resolve, reject) {
1576
+ wx.createLivePusherContext().resumeBGM({
1577
+ success: function success(event) {
1578
+ resolve(event);
1579
+ },
1580
+ fail: function fail(error) {
1581
+ reject(error);
1582
+ }
1583
+ });
1584
+ });
1585
+ }
1586
+ // 设置背景音乐的音量大小,播放背景音乐混音时使用,用来控制背景音音量大小
1587
+ }, {
1588
+ key: "setAllMusicVolume",
1589
+ value: function setAllMusicVolume(volume) {
1590
+ return new Promise(function (resolve, reject) {
1591
+ var volumeStr = (volume / 200).toString();
1592
+ wx.createLivePusherContext().setBGMVolume({
1593
+ volume: volumeStr,
1594
+ success: function success(event) {
1595
+ resolve(event);
1596
+ },
1597
+ fail: function fail(error) {
1598
+ reject(error);
1599
+ }
1600
+ });
1601
+ });
1602
+ }
1603
+ // 开启大小画面双路编码模式
1604
+ }, {
1605
+ key: "enableSmallVideoStream",
1606
+ value: function enableSmallVideoStream(enable, params) {
1607
+ // todo 待实现
1608
+ }
1609
+ /**
1610
+ * 调用实验性 API 接口
1611
+ *
1612
+ * 注意:该接口用于调用一些实验性功能, 目前 web 端空实现
1613
+ *
1614
+ * @param {String} jsonStr - 接口及参数描述的 JSON 字符串
1615
+ */
1616
+ }, {
1617
+ key: "callExperimentalAPI",
1618
+ value: function callExperimentalAPI(jsonStr) {
1619
+ var jsonObj = safelyParse(jsonStr);
1620
+ if (jsonObj === jsonStr) {
1621
+ return;
1622
+ }
1623
+ var api = jsonObj.api,
1624
+ params = jsonObj.params;
1625
+ if (!api || !params) {
1626
+ return;
1627
+ }
1628
+ switch (api) {
1629
+ case 'setFramework':
1630
+ this.handleSetFrameWork(params);
1631
+ break;
1632
+ }
1633
+ }
1634
+ }, {
1635
+ key: "handleSetFrameWork",
1636
+ value: function handleSetFrameWork(params) {
1637
+ var component = params.component;
1638
+ if (isNumber(component)) {
1639
+ try {
1640
+ if (wx) {
1641
+ wx.TUIScene = component;
1642
+ wx.setStorageSync('TUIScene', String(component));
1643
+ }
1644
+ } catch (err) {
1645
+ throw err;
1646
+ }
1647
+ }
1648
+ }
1649
+ }], [{
1650
+ key: "getTRTCShareInstance",
1651
+ value: function getTRTCShareInstance() {
1652
+ if (!TRTCCloud.instance) {
1653
+ TRTCCloud.instance = new TRTCCloud();
1654
+ }
1655
+ return TRTCCloud.instance;
1656
+ }
1657
+ /**
1658
+ * 销毁 TRTCCloud 实例(单例模式)
1659
+ * @category Base
1660
+ */
1661
+ }, {
1662
+ key: "destroyTRTCShareInstance",
1663
+ value: function destroyTRTCShareInstance() {
1664
+ if (!TRTCCloud.instance) return;
1665
+ TRTCCloud.instance.destroy();
1666
+ TRTCCloud.instance = null;
1667
+ }
1668
+ }]);
1669
+ return TRTCCloud;
1670
+ }();
1671
+
1672
+ exports.TRTCCloud = TRTCCloud;
1673
+ exports.default = TRTCCloud;
1674
+ exports.translateBeautyStyle = translateBeautyStyle;
1675
+ exports.translateTRTCAppScene = translateTRTCAppScene;
1676
+ exports.translateTRTCStreamId = translateTRTCStreamId;
1677
+ exports.translateTRTCVideoMirrorType = translateTRTCVideoMirrorType;
1678
+ exports.translateTRTCVideoResolution = translateTRTCVideoResolution;
1679
+ exports.translateTRTCVideoResolutionMode = translateTRTCVideoResolutionMode;
1680
+ exports.translateTRTCVideoRotation = translateTRTCVideoRotation;
1681
+ exports.translateTRTCVideoStreamType = translateTRTCVideoStreamType;
1682
+ exports.translateVideoFillMod = translateVideoFillMod;