trtc-cloud-js-sdk
Advanced tools
Comparing version 2.1.4 to 2.1.5
{ | ||
"name": "trtc-cloud-js-sdk", | ||
"version": "2.1.4", | ||
"version": "2.1.5", | ||
"description": "Tencent Cloud RTC SDK for Web And Electron", | ||
@@ -20,6 +20,4 @@ "main": "trtc-cloud-js-sdk.js", | ||
"dependencies": { | ||
"axios": "^0.21.1", | ||
"rtc-beauty-plugin": "^0.0.5", | ||
"trtc-sdk-v5": "5.0.3" | ||
} | ||
} |
@@ -1,1 +0,1 @@ | ||
var global,factory;global=this,factory=function(e,t,o){function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r,n,a,s,c,u,l,d,T=i(o),h=function(e,t){return h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])},h(e,t)},p=function(){return p=Object.assign||function(e){for(var t,o=1,i=arguments.length;o<i;o++)for(var r in t=arguments[o])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},p.apply(this,arguments)};function R(e,t,o,i){return new(o||(o=Promise))((function(r,n){function a(e){try{c(i.next(e))}catch(t){n(t)}}function s(e){try{c(i.throw(e))}catch(t){n(t)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(a,s)}c((i=i.apply(e,t||[])).next())}))}function f(e,t){var o,i,r,n,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return n={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(n[Symbol.iterator]=function(){return this}),n;function s(s){return function(c){return function(s){if(o)throw new TypeError("Generator is already executing.");for(;n&&(n=0,s[0]&&(a=0)),a;)try{if(o=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,i=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){a.label=s[1];break}if(6===s[0]&&a.label<r[1]){a.label=r[1],r=s;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(s);break}r[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(c){s=[6,c],i=0}finally{o=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}function C(e,t,o){if(o||2===arguments.length)for(var i,r=0,n=t.length;r<n;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}e.TRTCVideoResolution=void 0,(r=e.TRTCVideoResolution||(e.TRTCVideoResolution={}))[r.TRTCVideoResolution_120_120=1]="TRTCVideoResolution_120_120",r[r.TRTCVideoResolution_160_160=3]="TRTCVideoResolution_160_160",r[r.TRTCVideoResolution_270_270=5]="TRTCVideoResolution_270_270",r[r.TRTCVideoResolution_480_480=7]="TRTCVideoResolution_480_480",r[r.TRTCVideoResolution_160_120=50]="TRTCVideoResolution_160_120",r[r.TRTCVideoResolution_240_180=52]="TRTCVideoResolution_240_180",r[r.TRTCVideoResolution_280_210=54]="TRTCVideoResolution_280_210",r[r.TRTCVideoResolution_320_240=56]="TRTCVideoResolution_320_240",r[r.TRTCVideoResolution_400_300=58]="TRTCVideoResolution_400_300",r[r.TRTCVideoResolution_480_360=60]="TRTCVideoResolution_480_360",r[r.TRTCVideoResolution_640_480=62]="TRTCVideoResolution_640_480",r[r.TRTCVideoResolution_960_720=64]="TRTCVideoResolution_960_720",r[r.TRTCVideoResolution_160_90=100]="TRTCVideoResolution_160_90",r[r.TRTCVideoResolution_256_144=102]="TRTCVideoResolution_256_144",r[r.TRTCVideoResolution_320_180=104]="TRTCVideoResolution_320_180",r[r.TRTCVideoResolution_480_270=106]="TRTCVideoResolution_480_270",r[r.TRTCVideoResolution_640_360=108]="TRTCVideoResolution_640_360",r[r.TRTCVideoResolution_960_540=110]="TRTCVideoResolution_960_540",r[r.TRTCVideoResolution_1280_720=112]="TRTCVideoResolution_1280_720",r[r.TRTCVideoResolution_1920_1080=114]="TRTCVideoResolution_1920_1080",e.TRTCVideoStreamType=void 0,(n=e.TRTCVideoStreamType||(e.TRTCVideoStreamType={}))[n.TRTCVideoStreamTypeBig=0]="TRTCVideoStreamTypeBig",n[n.TRTCVideoStreamTypeSmall=1]="TRTCVideoStreamTypeSmall",n[n.TRTCVideoStreamTypeSub=2]="TRTCVideoStreamTypeSub",e.TRTCVideoFillMode=void 0,(a=e.TRTCVideoFillMode||(e.TRTCVideoFillMode={}))[a.TRTCVideoFillMode_Fill=0]="TRTCVideoFillMode_Fill",a[a.TRTCVideoFillMode_Fit=1]="TRTCVideoFillMode_Fit",e.TRTCVideoMirrorType=void 0,(s=e.TRTCVideoMirrorType||(e.TRTCVideoMirrorType={}))[s.TRTCVideoMirrorType_Auto=0]="TRTCVideoMirrorType_Auto",s[s.TRTCVideoMirrorType_Enable=1]="TRTCVideoMirrorType_Enable",s[s.TRTCVideoMirrorType_Disable=2]="TRTCVideoMirrorType_Disable",e.TRTCBeautyStyle=void 0,(c=e.TRTCBeautyStyle||(e.TRTCBeautyStyle={}))[c.TRTCBeautyStyleSmooth=0]="TRTCBeautyStyleSmooth",c[c.TRTCBeautyStyleNature=1]="TRTCBeautyStyleNature",e.TRTCAppScene=void 0,(u=e.TRTCAppScene||(e.TRTCAppScene={}))[u.TRTCAppSceneVideoCall=0]="TRTCAppSceneVideoCall",u[u.TRTCAppSceneLIVE=1]="TRTCAppSceneLIVE",u[u.TRTCAppSceneAudioCall=2]="TRTCAppSceneAudioCall",u[u.TRTCAppSceneVoiceChatRoom=3]="TRTCAppSceneVoiceChatRoom",e.TRTCRoleType=void 0,(l=e.TRTCRoleType||(e.TRTCRoleType={}))[l.TRTCRoleAnchor=20]="TRTCRoleAnchor",l[l.TRTCRoleAudience=21]="TRTCRoleAudience",e.TRTCAudioQuality=void 0,(d=e.TRTCAudioQuality||(e.TRTCAudioQuality={}))[d.TRTCAudioQualityDefault=0]="TRTCAudioQualityDefault",d[d.TRTCAudioQualitySpeech=1]="TRTCAudioQualitySpeech",d[d.TRTCAudioQualityMusic=3]="TRTCAudioQualityMusic";var _,v,g=function(e,t,o,i,r){void 0===e&&(e=""),void 0===t&&(t=""),void 0===o&&(o=""),void 0===i&&(i=""),void 0===r&&(r=""),this.deviceId=e,this.deviceName=t,this.kind=o,this.label=i,this.groupId=r};e.TRTCDeviceState=void 0,(_=e.TRTCDeviceState||(e.TRTCDeviceState={}))[_.TRTCDeviceStateAdd=0]="TRTCDeviceStateAdd",_[_.TRTCDeviceStateRemove=1]="TRTCDeviceStateRemove",_[_.TRTCDeviceStateActive=2]="TRTCDeviceStateActive",e.TRTCDeviceType=void 0,(v=e.TRTCDeviceType||(e.TRTCDeviceType={}))[v.TRTCDeviceTypeUnknow=-1]="TRTCDeviceTypeUnknow",v[v.TRTCDeviceTypeMic=0]="TRTCDeviceTypeMic",v[v.TRTCDeviceTypeSpeaker=1]="TRTCDeviceTypeSpeaker",v[v.TRTCDeviceTypeCamera=2]="TRTCDeviceTypeCamera";var m,y=function(t,o,i,r,n,a,s,c,u,l,d){void 0===t&&(t=0),void 0===o&&(o=""),void 0===i&&(i=""),void 0===r&&(r=0),void 0===n&&(n=""),void 0===a&&(a=e.TRTCRoleType.TRTCRoleAnchor),void 0===s&&(s=null),void 0===u&&(u=null),void 0===l&&(l=null),void 0===d&&(d=30),this.sdkAppId=t,this.userId=o,this.userSig=i,this.roomId=r,this.strRoomId=n,this.role=a,this.privateMapKey=s,this.streamId=u,this.userDefineRecordId=l,this.frameWorkType=d},S=function(t,o,i){void 0===t&&(t=e.TRTCVideoResolution.TRTCVideoResolution_640_360),void 0===o&&(o=15),void 0===i&&(i=550),this.videoResolution=t,this.videoFps=o,this.videoBitrate=i};e.TRTCVideoRotation=void 0,(m=e.TRTCVideoRotation||(e.TRTCVideoRotation={}))[m.TRTCVideoRotation0=0]="TRTCVideoRotation0",m[m.TRTCVideoRotation90=1]="TRTCVideoRotation90",m[m.TRTCVideoRotation180=2]="TRTCVideoRotation180",m[m.TRTCVideoRotation270=3]="TRTCVideoRotation270";var V,M=function(t,o,i){void 0===t&&(t=e.TRTCVideoRotation.TRTCVideoRotation0),void 0===o&&(o=e.TRTCVideoFillMode.TRTCVideoFillMode_Fit),void 0===i&&(i=e.TRTCVideoMirrorType.TRTCVideoMirrorType_Disable),this.rotation=t,this.fillMode=o,this.mirrorType=i};e.TRTCQuality=void 0,(V=e.TRTCQuality||(e.TRTCQuality={}))[V.TRTCQuality_Unknown=0]="TRTCQuality_Unknown",V[V.TRTCQuality_Excellent=1]="TRTCQuality_Excellent",V[V.TRTCQuality_Good=2]="TRTCQuality_Good",V[V.TRTCQuality_Poor=3]="TRTCQuality_Poor",V[V.TRTCQuality_Bad=4]="TRTCQuality_Bad",V[V.TRTCQuality_Vbad=5]="TRTCQuality_Vbad",V[V.TRTCQuality_Down=6]="TRTCQuality_Down";var b,w,A,I=function(t,o){void 0===t&&(t=""),void 0===o&&(o=e.TRTCQuality.TRTCQuality_Unknown),this.userId=t,this.quality=o},E=function(e,t){void 0===e&&(e=""),void 0===t&&(t=0),this.userId=e,this.volume=t},D=function(e,t,o){void 0===e&&(e=0),void 0===t&&(t=0),void 0===o&&(o=null),this.appId=e,this.bizId=t,this.url=o},P=function(t,o,i,r,n,a,s){void 0===t&&(t=0),void 0===o&&(o=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===s&&(s=e.TRTCVideoStreamType.TRTCVideoStreamTypeBig),this.width=t,this.height=o,this.frameRate=i,this.videoBitrate=r,this.audioSampleRate=n,this.audioBitrate=a,this.streamType=s},L=function(e,t,o,i,r,n,a,s,c,u){void 0===e&&(e=0),void 0===t&&(t=0),void 0===o&&(o=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===s&&(s=[]),void 0===c&&(c=0),void 0===u&&(u=0),this.upLoss=e,this.downLoss=t,this.appCpu=o,this.systemCpu=i,this.rtt=r,this.receivedBytes=n,this.sentBytes=a,this.localStatisticsArray=s,this.localStatisticsArraySize=c,this.remoteStatisticsArraySize=u};e.TRTCVideoResolutionMode=void 0,(b=e.TRTCVideoResolutionMode||(e.TRTCVideoResolutionMode={}))[b.TRTCVideoResolutionModeLandscape=0]="TRTCVideoResolutionModeLandscape",b[b.TRTCVideoResolutionModePortrait=1]="TRTCVideoResolutionModePortrait",e.TRTCVideoQosPreference=void 0,(w=e.TRTCVideoQosPreference||(e.TRTCVideoQosPreference={}))[w.TRTCVideoQosPreferenceSmooth=1]="TRTCVideoQosPreferenceSmooth",w[w.TRTCVideoQosPreferenceClear=2]="TRTCVideoQosPreferenceClear",e.TRTCQosControlMode=void 0,(A=e.TRTCQosControlMode||(e.TRTCQosControlMode={}))[A.TRTCQosControlModeClient=0]="TRTCQosControlModeClient",A[A.TRTCQosControlModeServer=1]="TRTCQosControlModeServer";var O,k=function(t,o){void 0===t&&(t=e.TRTCVideoQosPreference.TRTCVideoQosPreferenceClear),void 0===o&&(o=e.TRTCQosControlMode.TRTCQosControlModeServer),this.preference=t,this.controlMode=o},F=function(e,t,o,i){void 0===e&&(e=new ArrayBuffer(0)),void 0===t&&(t=0),void 0===o&&(o=0),void 0===i&&(i=0),this.buffer=e,this.length=t,this.width=o,this.height=i};e.TRTCScreenCaptureSourceType=void 0,(O=e.TRTCScreenCaptureSourceType||(e.TRTCScreenCaptureSourceType={}))[O.TRTCScreenCaptureSourceTypeUnknown=-1]="TRTCScreenCaptureSourceTypeUnknown",O[O.TRTCScreenCaptureSourceTypeWindow=0]="TRTCScreenCaptureSourceTypeWindow",O[O.TRTCScreenCaptureSourceTypeScreen=1]="TRTCScreenCaptureSourceTypeScreen",O[O.TRTCScreenCaptureSourceTypeCustom=2]="TRTCScreenCaptureSourceTypeCustom";var Q,N=function(t,o,i,r,n,a){void 0===t&&(t=e.TRTCScreenCaptureSourceType.TRTCScreenCaptureSourceTypeUnknown),void 0===o&&(o=""),void 0===i&&(i=""),void 0===r&&(r=new F),void 0===n&&(n=new F),void 0===a&&(a=!1),this.type=t,this.sourceId=o,this.sourceName=i,this.thumbBGRA=r,this.iconBGRA=n,this.isMinimizeWindow=a},B=function(e,t,o,i){void 0===e&&(e=0),void 0===t&&(t=0),void 0===o&&(o=0),void 0===i&&(i=0),this.left=e,this.top=t,this.right=o,this.bottom=i},U=function(t,o,i,r,n,a,s,c,u,l,d,T,h,p,R){void 0===t&&(t=e.TRTCTranscodingConfigMode.TRTCTranscodingConfigMode_Unknown),void 0===o&&(o=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===s&&(s=15),void 0===c&&(c=2),void 0===u&&(u=0),void 0===l&&(l=""),void 0===d&&(d=64),void 0===T&&(T=48e3),void 0===h&&(h=1),void 0===p&&(p=[]),void 0===R&&(R=""),this.mode=t,this.appId=o,this.bizId=i,this.videoWidth=r,this.videoHeight=n,this.videoBitrate=a,this.videoFramerate=s,this.videoGOP=c,this.backgroundColor=u,this.backgroundImage=l,this.audioSampleRate=d,this.audioBitrate=T,this.audioChannels=h,this.mixUsersArray=p,this.mixUsersArraySize=p.length,this.streamId=R};e.TRTCTranscodingConfigMode=void 0,(Q=e.TRTCTranscodingConfigMode||(e.TRTCTranscodingConfigMode={}))[Q.TRTCTranscodingConfigMode_Unknown=0]="TRTCTranscodingConfigMode_Unknown",Q[Q.TRTCTranscodingConfigMode_Manual=1]="TRTCTranscodingConfigMode_Manual",Q[Q.TRTCTranscodingConfigMode_Template_PureAudio=2]="TRTCTranscodingConfigMode_Template_PureAudio",Q[Q.TRTCTranscodingConfigMode_Template_PresetLayout=3]="TRTCTranscodingConfigMode_Template_PresetLayout",Q[Q.TRTCTranscodingConfigMode_Template_ScreenSharing=4]="TRTCTranscodingConfigMode_Template_ScreenSharing",Q[Q.TRTC_TranscodingConfigMode_Unknown=5]="TRTC_TranscodingConfigMode_Unknown",Q[Q.TRTC_TranscodingConfigMode_Manual=6]="TRTC_TranscodingConfigMode_Manual",Q[Q.TRTC_TranscodingConfigMode_Template_PureAudio=7]="TRTC_TranscodingConfigMode_Template_PureAudio",Q[Q.TRTC_TranscodingConfigMode_Template_PresetLayout=8]="TRTC_TranscodingConfigMode_Template_PresetLayout",Q[Q.TRTC_TranscodingConfigMode_Template_ScreenSharing=9]="TRTC_TranscodingConfigMode_Template_ScreenSharing";var x,j=function(t,o,i,r,n,a,s,c){void 0===t&&(t=""),void 0===o&&(o=""),void 0===i&&(i=null),void 0===r&&(r=0),void 0===n&&(n=!1),void 0===a&&(a=e.TRTCVideoStreamType.TRTCVideoStreamTypeBig),void 0===s&&(s=e.TRTCMixInputType.TRTCMixInputTypeUndefined),void 0===c&&(c=0),this.userId=t,this.roomId=o,this.rect=i,this.zOrder=r,this.pureAudio=n,this.streamType=a,this.inputType=s,this.renderMode=c};e.TRTCMixInputType=void 0,(x=e.TRTCMixInputType||(e.TRTCMixInputType={}))[x.TRTCMixInputTypeUndefined=0]="TRTCMixInputTypeUndefined",x[x.TRTCMixInputTypeAudioVideo=1]="TRTCMixInputTypeAudioVideo",x[x.TRTCMixInputTypePureVideo=2]="TRTCMixInputTypePureVideo",x[x.TRTCMixInputTypePureAudio=3]="TRTCMixInputTypePureAudio";var W,J="onError",Y="rtc",G="live",K={20:"anchor",21:"audience"},q={0:Y,1:G,2:Y,3:G},z={0:"standard",1:"high",2:"standard_stereo",3:"high_stereo"};function H(){return Math.floor(performance.now())}!function(e){e[e.ActiveExitRoom=0]="ActiveExitRoom",e[e.KickedExitRoom=1]="KickedExitRoom"}(W||(W={}));var X,Z,$=function(e){return void 0===e},ee=function(e){return"number"==typeof e},te=function(e){return"boolean"==typeof e};function oe(e,t){for(var o=0,i=Reflect.ownKeys(t);o<i.length;o++){var r=i[o];if("constructor"!==r&&"prototype"!==r&&"name"!==r){var n=Object.getOwnPropertyDescriptor(t,r)||"";Object.defineProperty(e,r,n)}}}!function(e){e.LIVE="live",e.RTC="rtc"}(X||(X={})),function(e){e.CONTAIN="contain",e.COVER="cover",e.FILL="fill"}(Z||(Z={}));var ie=-1e3,re={code:-1001,message:"参数错误, 请检查参数格式、是否非空等"},ne={code:-1005,message:"not supported"},ae="2.1.4",se=function(){function e(e,t){if(this.logRegion="tc",this.loggerManager=e,t){var o=t.sdkAppId,i=t.userId,r=t.seq;this.seq=r,e&&(this.logger=e.createLogger({id:"".concat(this.logRegion).concat(r),userId:i,sdkAppId:o}))}else this.logger=e;this.logger||(this.logger={debug:function(e){console.debug(e)},info:function(e){console.info(e)},warn:function(e){console.warn(e)},error:function(e){console.error(e)}})}return e.prototype.getLogMessage=function(e){var t=this;return e.map((function(e){return t.getStringifyMessage(e)})).join(" ")},e.prototype.getStringifyMessage=function(e){var t=this;if("object"!=typeof e)return e;if(e instanceof HTMLElement)return"".concat(e.tagName.toLocaleLowerCase(),"#").concat(e.id);if(e instanceof Array){var o=[];return Object.keys(e).forEach((function(i){return o[i]=t.getStringifyMessage(e[i])})),JSON.stringify(o)}if(e instanceof Object){var i={};return Object.keys(e).forEach((function(o){return i[o]=t.getStringifyMessage(e[o])})),JSON.stringify(i)}return e},e.prototype.update=function(e){var t=e.userId,o=e.sdkAppId;this.loggerManager&&this.loggerManager.createLogger&&(this.logger=this.loggerManager.createLogger({id:"".concat(this.logRegion).concat(this.seq),userId:t,sdkAppId:o}))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var o=this.getLogMessage(e);this.logger.debug(o)},e.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var o=this.getLogMessage(e);this.logger&&this.logger.info&&this.logger.info(o)},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var o=this.getLogMessage(e);this.logger&&this.logger.warn&&this.logger.warn(o)},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var o=this.getLogMessage(e);this.logger&&this.logger.error&&this.logger.error(o)},e}(),ce=null,ue=T.default._loggerManager;ue.info("TRTCCloud Version: ".concat(ae));var le="trtcCloud",de=1,Te=function(t){function o(o){void 0===o&&(o={});var i=t.call(this)||this;i._version="",i._frameWorkType=30,i._component=0,i._language=0,i._localView=null,i._autoRecvAudio=!0,i._autoRecvVideo=!0,i._localTestView=null,i._isVideoPublish=!0,i._localRenderParams={rotation:e.TRTCVideoRotation.TRTCVideoRotation0,fillMode:e.TRTCVideoFillMode.TRTCVideoFillMode_Fill,mirrorType:e.TRTCVideoMirrorType.TRTCVideoMirrorType_Auto},i._videoProfile={},i._videoPlayOption={},i._isAudioPublish=!0,i._audioProfile=Object.keys(z)[0],i._isSharingScreen=!1,i._remoteStreamConfig=new Map,i._remoteStreamMap=new Map,i._cameraList=[],i._microphoneList=[],i._speakerList=[],i._currentCamera={},i._currentMicrophone={},i._currentSpeaker={},i._currentCameraId="",i._currentMicrophoneId="",i._currentSpeakerId="",i._screenShareParams={option:{}},i._isMobile=!1,i._isFrontCamera=!1,i._smallStreamVideoProfile=void 0,i._defaultVideoProfile={width:640,height:480,frameRate:15,bitrate:900},i._defaultScreenProfile={width:1920,height:1080,frameRate:15,bitrate:1500},i._defaultSmallVideoProfile={width:160,height:120,frameRate:15,bitrate:200},i._version=ae;var r,n,a,s=o.frameWorkType,c=void 0===s?30:s,u=o.component,l=void 0===u?0:u;return i._frameWorkType=c,i._component=l,i._trtc=T.default.create(),i._testTrtc=T.default.create(),i._log=T.default._loggerManager,i.logger=new se(ue,{seq:de++}),i._addTRTCEvents(),i.handleDeviceChange=i.handleDeviceChange.bind(i),navigator&&navigator.mediaDevices&&navigator.mediaDevices.addEventListener("devicechange",(r=i.handleDeviceChange,n=30,function(){for(var e=this,t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];a>0&&clearTimeout(a),a=window.setTimeout((function(){r.apply(e,t),a=-1}),n)})),i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}h(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}(o,t),o.getTRTCShareInstance=function(e){return ce||(ce=new o(e)),ce},o.prototype.destroyTRTCShareInstance=function(){ce&&(this._removeTRTCEvents(),ce._destroy(),ce=null)},o.prototype.getSDKVersion=function(){return this._version||""},o.prototype.off=function(e,t){void 0===t&&(t=function(){});try{"*"===e?this.removeAllListeners():this.removeListener(e,t)}catch(o){console.log("off error ",o)}},o.prototype.enterRoom=function(e,t){return R(this,void 0,Promise,(function(){var o,i,r,n,a,s,c,u,l,d,T,h,R,C,_,v;return f(this,(function(f){switch(f.label){case 0:if(o=e.sdkAppId,i=e.userId,r=e.userSig,n=e.roomId,a=e.strRoomId,s=e.role,c=e.privateMapKey,u=e.businessInfo,l=e.enableAutoPlayDialog,d=e.proxy,T=e.streamId,h=e.userDefineRecordId,this.logger.update({sdkAppId:o,userId:i}),this.logger.info("".concat(le,".enterRoom with params: "),e,t),!(o&&i&&r))return[3,5];f.label=1;case 1:return f.trys.push([1,3,,4]),R={sdkAppId:o,userId:i,userSig:r,roomId:n||a,role:K[s],scene:q[t],autoReceiveAudio:this._autoRecvAudio,autoReceiveVideo:this._autoRecvVideo,frameWorkType:this._frameWorkType,component:this._component,language:this._language},R=c?p(p({},R),{privateMapKey:c}):R,R=u?p(p({},R),{businessInfo:u}):R,R=l?p(p({},R),{enableAutoPlayDialog:l}):R,R=d?p(p({},R),{proxy:d}):R,R=T?p(p({},R),{streamId:T}):R,R=h?p(p({},R),{userDefineRecordId:h}):R,C=H(),[4,this._trtc.enterRoom(R)];case 2:return f.sent(),_=H()-C,this.emit("onEnterRoom",_),[3,4];case 3:return v=f.sent(),this.emit("onEnterRoom",-1),this._callFunctionErrorManage(v,"enterRoom"),[3,4];case 4:return[3,6];case 5:this._emitError(re),f.label=6;case 6:return[2]}}))}))},o.prototype.exitRoom=function(){return R(this,void 0,Promise,(function(){var e;return f(this,(function(t){switch(t.label){case 0:return t.trys.push([0,4,,5]),this.logger.info("".concat(le,".enterRoom")),this._isSharingScreen?[4,this.stopScreenShare()]:[3,2];case 1:t.sent(),t.label=2;case 2:return[4,this._trtc.exitRoom()];case 3:return t.sent(),[3,5];case 4:return e=t.sent(),this._callFunctionErrorManage(e,"exitRoom"),[3,5];case 5:return[2]}}))}))},o.prototype.switchRole=function(e){return R(this,void 0,void 0,(function(){var t;return f(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(le,".switchRole with param: "),e),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this._trtc.switchRole(K[e])];case 2:return o.sent(),this.emit("onSwitchRole",0,"switch role success, role = ".concat(e,", ").concat(K[e])),[3,4];case 3:return t=o.sent(),this.emit("onSwitchRole",null==t?void 0:t.getCode(),t.message),[3,4];case 4:return[2]}}))}))},o.prototype.setDefaultStreamRecvMode=function(e,t){return R(this,void 0,void 0,(function(){return f(this,(function(o){return this.logger.info("".concat(le,".setDefaultStreamRecvMode with param: "),{autoRecvAudio:e,autoRecvVideo:t}),te(e)&&(this._autoRecvAudio=e),te(t)&&(this._autoRecvVideo=t),[2]}))}))},o.prototype._updateLocalVideo=function(){return R(this,void 0,void 0,(function(){var e;return f(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this._trtc.updateLocalVideo(this._generateLocalVideoData())];case 1:return t.sent(),[3,3];case 2:if((e=t.sent()).code===T.default.ERROR_CODE.OPERATION_ABORT)return[2];throw e;case 3:return[2]}}))}))},o.prototype._updateLocalTestVideo=function(){return R(this,void 0,void 0,(function(){var e;return f(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this._testTrtc.updateLocalVideo(this._generateLocalTestVideoData())];case 1:return t.sent(),[3,3];case 2:if((e=t.sent()).code===T.default.ERROR_CODE.OPERATION_ABORT)return[2];throw e;case 3:return[2]}}))}))},o.prototype._updateRemoteVideo=function(e,t){return R(this,void 0,void 0,(function(){var o;return f(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this._trtc.updateRemoteVideo(this._generateRemoteVideoData(e,t))];case 1:return i.sent(),[3,3];case 2:if((o=i.sent()).code===T.default.ERROR_CODE.OPERATION_ABORT)return[2];throw o;case 3:return[2]}}))}))},o.prototype.startLocalPreview=function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];return R(this,void 0,Promise,(function(){var o,i,r,n,a,s,c,u;return f(this,(function(l){switch(l.label){case 0:this.logger.info("".concat(le,".startLocalPreview with params: "),t),1===C([],t,!0).length?i=C([],t,!0)[0]:2===C([],t,!0).length&&(u=C([],t,!0),o=u[0],i=u[1]),$(o)||(this._setIsMobile(!0),this._setIsFrontCamera(o)),this._setLocalView(i),l.label=1;case 1:l.trys.push([1,8,,9]),l.label=2;case 2:return l.trys.push([2,4,,7]),[4,this._trtc.startLocalVideo(this._generateLocalVideoData())];case 3:return l.sent(),[3,7];case 4:return(r=l.sent()).code!==T.default.ERROR_CODE.OPERATION_ABORT?[3,6]:[4,this._updateLocalVideo()];case 5:return l.sent(),[2];case 6:throw r;case 7:return this.emit("onCameraDidReady"),n=this._getVideoProfile(),a=n.width,s=n.height,this.emit("onFirstVideoFrame","",e.TRTCVideoStreamType.TRTCVideoStreamTypeBig,a,s),[3,9];case 8:return c=l.sent(),this._callFunctionErrorManage(c,"startLocalPreview"),[3,9];case 9:return[2]}}))}))},o.prototype.updateLocalView=function(e){return R(this,void 0,void 0,(function(){return f(this,(function(t){switch(t.label){case 0:return this.logger.info("".concat(le,".updateLocalView with param: "),e),this._setLocalView(e),[4,this._updateLocalVideo()];case 1:return t.sent(),[2]}}))}))},o.prototype.stopLocalPreview=function(){return R(this,void 0,void 0,(function(){var e;return f(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(le,".stopLocalPreview")),t.label=1;case 1:return t.trys.push([1,3,,4]),this._setLocalView(null),[4,this._trtc.stopLocalVideo()];case 2:return t.sent(),[3,4];case 3:return e=t.sent(),console.warn("".concat(le," stopLocalPreview error: ").concat(e)),this._callFunctionErrorManage(e,"stopLocalPreview"),[3,4];case 4:return[2]}}))}))},o.prototype.muteLocalVideo=function(e){return void 0===e&&(e=!1),R(this,void 0,void 0,(function(){var t;return f(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(le,".muteLocalVideo with params: "),e),o.label=1;case 1:return o.trys.push([1,3,,4]),this._setIsVideoPublish(!e),[4,this._updateLocalVideo()];case 2:return o.sent(),[3,4];case 3:return t=o.sent(),this._callFunctionErrorManage(t,"muteLocalVideo"),[3,4];case 4:return[2]}}))}))},o.prototype.startRemoteView=function(t,o,i){return R(this,void 0,void 0,(function(){var r,n;return f(this,(function(a){switch(a.label){case 0:this.logger.info("".concat(le,".startRemoteView with params: "),t,o,i),a.label=1;case 1:if(a.trys.push([1,8,,9]),this._setRemoteStreamConfig(t,i,{view:o,small:i===e.TRTCVideoStreamType.TRTCVideoStreamTypeSmall}),!this._remoteStreamMap.get("".concat(t,"_").concat(this._getTRTCStreamType(i))))return[2];a.label=2;case 2:return a.trys.push([2,4,,7]),[4,this._trtc.startRemoteVideo(this._generateRemoteVideoData(t,i))];case 3:return a.sent(),[3,7];case 4:return(r=a.sent()).code!==T.default.ERROR_CODE.OPERATION_ABORT?[3,6]:[4,this._updateRemoteVideo(t,i)];case 5:return a.sent(),[2];case 6:throw r;case 7:return this.emit("onFirstVideoFrame",t,i,0,0),[3,9];case 8:return n=a.sent(),this._callFunctionErrorManage(n,"startRemoteView"),[3,9];case 9:return[2]}}))}))},o.prototype.updateRemoteView=function(e,t,o){return R(this,void 0,void 0,(function(){return f(this,(function(i){switch(i.label){case 0:return this.logger.info("".concat(le,".updateRemoteView with params: "),e,t,o),this._setRemoteStreamConfig(e,o,{view:t}),[4,this._updateRemoteVideo(e,o)];case 1:return i.sent(),[2]}}))}))},o.prototype.stopRemoteView=function(e,t){return R(this,void 0,void 0,(function(){var o;return f(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(le,".stopRemoteView with params: "),e,t),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this._trtc.stopRemoteVideo({userId:e,streamType:this._getTRTCStreamType(t)})];case 2:return i.sent(),[3,4];case 3:return o=i.sent(),this._callFunctionErrorManage(o,"stopRemoteView"),[3,4];case 4:return[2]}}))}))},o.prototype.stopAllRemoteView=function(){return R(this,void 0,void 0,(function(){var e;return f(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(le,".stopAllRemoteView")),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this._trtc.stopRemoteVideo({userId:"*"})];case 2:return t.sent(),[3,4];case 3:return e=t.sent(),this._callFunctionErrorManage(e,"stopAllRemoteView"),[3,4];case 4:return[2]}}))}))},o.prototype.setVideoEncoderParam=function(e){return R(this,void 0,void 0,(function(){var t,o;return f(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(le,".setVideoEncoderParam with params: "),e),i.label=1;case 1:return i.trys.push([1,4,,5]),t=this._getTRTCVideoProfile("video",e),this._setVideoProfile(t),[4,this._updateLocalVideo()];case 2:return i.sent(),[4,this._updateLocalTestVideo()];case 3:return i.sent(),[3,5];case 4:return o=i.sent(),this._callFunctionErrorManage(o,"setVideoEncoderParam"),[3,5];case 5:return[2]}}))}))},o.prototype.setLocalRenderParams=function(e){return R(this,void 0,void 0,(function(){var t,o;return f(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(le,".setLocalRenderParams with params: "),e),Object.assign(this._localRenderParams,e),i.label=1;case 1:return i.trys.push([1,4,,5]),t={},e.mirrorType&&(t.mirror=this._getTRTCMirror(e.mirrorType)),e.fillMode&&(t.fillMode=this._getTRTCFillMode(e.fillMode)),this._setVideoPlayOption(t),[4,this._updateLocalVideo()];case 2:return i.sent(),[4,this._updateLocalTestVideo()];case 3:return i.sent(),[3,5];case 4:return o=i.sent(),this._callFunctionErrorManage(o,"setLocalRenderParams"),[3,5];case 5:return[2]}}))}))},o.prototype.setRemoteRenderParams=function(e,t,o){return R(this,void 0,void 0,(function(){var i;return f(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(le,".setRemoteRenderParams with params: "),e,t,o),r.label=1;case 1:return r.trys.push([1,3,,4]),this._setRemoteStreamConfig(e,t,o),[4,this._updateRemoteVideo(e,t)];case 2:return r.sent(),[3,4];case 3:return i=r.sent(),this._callFunctionErrorManage(i,"setRemoteRenderParams"),[3,4];case 4:return[2]}}))}))},o.prototype._updateLocalAudio=function(){return R(this,void 0,void 0,(function(){var e;return f(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this._trtc.updateLocalAudio(this._generateLocalAudioData())];case 1:return t.sent(),[3,3];case 2:if((e=t.sent()).code===T.default.ERROR_CODE.OPERATION_ABORT)return[2];throw e;case 3:return[2]}}))}))},o.prototype.startLocalAudio=function(t){return void 0===t&&(t=e.TRTCAudioQuality.TRTCAudioQualityDefault),R(this,void 0,void 0,(function(){var e,o;return f(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(le,".startLocalAudio with params: "),t),i.label=1;case 1:i.trys.push([1,8,,9]),this._setAudioProfile(z[t]),i.label=2;case 2:return i.trys.push([2,4,,7]),[4,this._trtc.startLocalAudio(this._generateLocalAudioData())];case 3:return i.sent(),[3,7];case 4:return(e=i.sent()).code!==T.default.ERROR_CODE.OPERATION_ABORT?[3,6]:[4,this._updateLocalAudio()];case 5:return i.sent(),[2];case 6:throw e;case 7:return this.emit("onMicDidReady"),[3,9];case 8:return o=i.sent(),console.warn("".concat(le," startLocalAudio error: ").concat(o)),this._callFunctionErrorManage(o,"startLocalAudio"),[3,9];case 9:return[2]}}))}))},o.prototype.stopLocalAudio=function(){return R(this,void 0,void 0,(function(){var e;return f(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(le,".stopLocalAudio")),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this._trtc.stopLocalAudio()];case 2:return t.sent(),[3,4];case 3:return e=t.sent(),this._callFunctionErrorManage(e,"stopLocalAudio"),[3,4];case 4:return[2]}}))}))},o.prototype.muteLocalAudio=function(e){return void 0===e&&(e=!1),R(this,void 0,void 0,(function(){var t;return f(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(le,".muteLocalAudio with params: "),e),o.label=1;case 1:return o.trys.push([1,3,,4]),this._setIsAudioPublish(!e),[4,this._updateLocalAudio()];case 2:return o.sent(),[3,4];case 3:return t=o.sent(),this._callFunctionErrorManage(t,"muteLocalAudio"),[3,4];case 4:return[2]}}))}))},o.prototype.muteRemoteAudio=function(e,t){return void 0===t&&(t=!1),R(this,void 0,void 0,(function(){var o;return f(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(le,".muteRemoteAudio with params: "),e,t),i.label=1;case 1:return i.trys.push([1,3,,4]),e?[4,this._trtc.muteRemoteAudio(e,t)]:(this._emitError(re),[2]);case 2:return i.sent(),[3,4];case 3:return o=i.sent(),this._callFunctionErrorManage(o,"muteRemoteAudio"),[3,4];case 4:return[2]}}))}))},o.prototype.muteAllRemoteAudio=function(e){this.logger.info("".concat(le,".muteAllRemoteAudio with params: "),e);try{this._trtc.muteRemoteAudio("*",e)}catch(t){this._callFunctionErrorManage(t,"muteAllRemoteAudio")}},o.prototype.setRemoteAudioVolume=function(e,t){this.logger.info("".concat(le,".setRemoteAudioVolume with params: "),e,t);try{this._trtc.setRemoteAudioVolume(e,t)}catch(o){this._callFunctionErrorManage(o,"setRemoteAudioVolume")}},o.prototype.enableAudioVolumeEvaluation=function(e){this.logger.info("".concat(le,".enableAudioVolumeEvaluation with params: "),e);try{this._trtc.enableAudioVolumeEvaluation(e)}catch(t){this._callFunctionErrorManage(t,"enableAudioVolumeEvaluation")}},o.prototype.enableSmallVideoStream=function(e,t){return R(this,void 0,Promise,(function(){var o;return f(this,(function(i){switch(i.label){case 0:return this.logger.info("".concat(le,".enableSmallVideoStream with params: "),e,t),o=this._getTRTCVideoProfile("small",t),this._setSmallStreamVideoProfile(e?o:void 0),[4,this._updateLocalVideo()];case 1:return i.sent(),[2]}}))}))},o.prototype.startScreenShare=function(t,o,i){return R(this,void 0,void 0,(function(){var r,n,a,s,c,u;return f(this,(function(l){switch(l.label){case 0:this.logger.info("".concat(le,".startScreenShare with params: "),t,o,i),l.label=1;case 1:return l.trys.push([1,3,,4]),r=(i||{}).screenAudio,n=void 0!==r&&r,a=this._getTRTCVideoProfile("screen",i),this._setScreenShareParams({view:t,profile:a,systemAudio:n}),[4,this._trtc.startScreenShare(this._getScreenShareParams())];case 2:return l.sent(),this._isSharingScreen=!0,s=a.width,c=a.height,this.emit("onFirstVideoFrame","",e.TRTCVideoStreamType.TRTCVideoStreamTypeSub,s,c),[3,4];case 3:if((u=l.sent()).code===T.default.ERROR_CODE.OPERATION_ABORT)return[2];throw console.error("Start share screen error:",u,u.code,u.name,u.message),u;case 4:return[2]}}))}))},o.prototype.setSubStreamEncoderParam=function(e){return R(this,void 0,void 0,(function(){var t,o;return f(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(le,".setSubStreamEncoderParam with params: "),e),i.label=1;case 1:return i.trys.push([1,3,,4]),t=this._getTRTCVideoProfile("screen",e),this._setScreenShareParams({profile:t}),[4,this._trtc.updateScreenShare(this._getScreenShareParams())];case 2:return i.sent(),[3,4];case 3:return o=i.sent(),this._callFunctionErrorManage(o,"setSubStreamEncoderParam"),[3,4];case 4:return[2]}}))}))},o.prototype.stopScreenShare=function(){return R(this,void 0,Promise,(function(){var e;return f(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(le,".stopScreenShare")),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this._trtc.stopScreenShare()];case 2:return t.sent(),this._isSharingScreen=!1,this.emit("onScreenCaptureStopped",0),[3,4];case 3:return e=t.sent(),this._callFunctionErrorManage(e,"stopScreenShare"),[3,4];case 4:return[2]}}))}))},o.prototype.startScreenCapture=function(){this.emitError(ne)},o.prototype.pauseScreenCapture=function(){this.emitError(ne)},o.prototype.resumeScreenCapture=function(){this.emitError(ne)},o.prototype.getScreenCaptureSources=function(){this.emitError(ne)},o.prototype.selectScreenCaptureTarget=function(){this.emitError(ne)},o.prototype.getCameraDevicesList=function(){return R(this,void 0,Promise,(function(){var e,t;return f(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(le,".getCameraDevicesList")),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,T.default.getCameraList()];case 2:return e=(e=o.sent()).map((function(e){return p(p({},e),{deviceName:e.label})})),this._cameraList=e,"{}"===JSON.stringify(this._currentCamera)&&(this._currentCamera=this.getDefaultDeviceInfo(e),this._currentCameraId=this._currentCamera.deviceId),[2,Promise.resolve(e)];case 3:return t=o.sent(),this._callFunctionErrorManage(t,"getCameraDevicesList"),[2,Promise.resolve([])];case 4:return[2]}}))}))},o.prototype.setCurrentCameraDevice=function(e){return R(this,void 0,Promise,(function(){var t;return f(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(le,".setCurrentCameraDevice with params: "),{cameraId:e}),o.label=1;case 1:return o.trys.push([1,4,,5]),e?(this._currentCameraId=e,this._currentCamera=this._cameraList.filter((function(t){return t.deviceId===e})),[4,this._updateLocalVideo()]):[2,!1];case 2:return o.sent(),[4,this._updateLocalTestVideo()];case 3:return o.sent(),[2,!0];case 4:return t=o.sent(),this._callFunctionErrorManage(t,"setCurrentCameraDevice"),[2,!1];case 5:return[2]}}))}))},o.prototype.getCurrentCameraDevice=function(){this.logger.info("".concat(le,".getCurrentCameraDevice"));var e=this._currentCamera,t=e.deviceId,o=e.label,i=e.kind,r=e.groupId;return new g(t,o,i,o,r)},o.prototype.isFrontCamera=function(){return this._getIsFrontCamera()},o.prototype.switchCamera=function(e){return R(this,void 0,void 0,(function(){var t;return f(this,(function(o){switch(o.label){case 0:return this.logger.info("".concat(le,".switchCamera with params: "),e),this._setIsFrontCamera(e),(t=this._getVideoPlayOption()).mirror=this._getTRTCMirror(this._localRenderParams.mirrorType),this._setVideoPlayOption(t),[4,this._updateLocalVideo()];case 1:return o.sent(),[2]}}))}))},o.prototype.getMicDevicesList=function(){return R(this,void 0,Promise,(function(){var e,t;return f(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(le,".getMicDevicesList")),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,T.default.getMicrophoneList()];case 2:return e=(e=o.sent()).map((function(e){return p(p({},e),{deviceName:e.label})})),this._microphoneList=e,"{}"===JSON.stringify(this._currentMicrophone)&&(this._currentMicrophone=this.getDefaultDeviceInfo(e),this._currentMicrophoneId=this._currentMicrophone.deviceId),[2,Promise.resolve(e)];case 3:return t=o.sent(),this._callFunctionErrorManage(t,"getMicDevicesList"),[2,Promise.resolve([])];case 4:return[2]}}))}))},o.prototype.setCurrentMicDevice=function(e){return R(this,void 0,Promise,(function(){var t;return f(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(le,".setCurrentMicDevice with params: "),{micId:e}),o.label=1;case 1:return o.trys.push([1,3,,4]),e?(this._setCurrentMicrophoneId(e),this._currentMicrophone=this._microphoneList.filter((function(t){return t.deviceId===e})),[4,this._trtc.updateLocalAudio(this._generateLocalAudioData())]):[2,!1];case 2:return o.sent(),[2,!0];case 3:return t=o.sent(),this._callFunctionErrorManage(t,"setCurrentMicDevice"),[2,!1];case 4:return[2]}}))}))},o.prototype.getCurrentMicDevice=function(){this.logger.info("".concat(le,".getCurrentMicDevice"));var e=this._currentMicrophone,t=e.deviceId,o=e.label,i=e.kind,r=e.groupId;return new g(t,o,i,o,r)},o.prototype.getSpeakerDevicesList=function(){return R(this,void 0,Promise,(function(){var e,t;return f(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(le,".getSpeakerDevicesList")),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,T.default.getSpeakerList()];case 2:return e=(e=o.sent()).map((function(e){return p(p({},e),{deviceName:e.label})})),this._speakerList=e,"{}"===JSON.stringify(this._currentSpeaker)&&(this._currentSpeaker=this.getDefaultDeviceInfo(e),this._currentSpeakerId=this._currentSpeaker.deviceId),[2,Promise.resolve(e)];case 3:return t=o.sent(),this._callFunctionErrorManage(t,"getSpeakerDevicesList"),[2,Promise.resolve([])];case 4:return[2]}}))}))},o.prototype.setCurrentSpeakerDevice=function(e){return R(this,void 0,Promise,(function(){var t;return f(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(le,".setCurrentSpeakerDevice with params: "),{speakerId:e}),o.label=1;case 1:return o.trys.push([1,3,,4]),e?(this._setCurrentSpeakerId(e),this._currentSpeaker=this._speakerList.filter((function(t){return t.deviceId===e})),[4,T.default.setCurrentSpeaker(e)]):[2,!1];case 2:return o.sent(),[2,!0];case 3:return t=o.sent(),this._callFunctionErrorManage(t,"setCurrentSpeakerDevice"),[2,!1];case 4:return[2]}}))}))},o.prototype.getCurrentSpeakerDevice=function(){this.logger.info("".concat(le,".getCurrentSpeakerDevice"));var e=this._currentCamera,t=e.deviceId,o=e.label,i=e.kind,r=e.groupId;return new g(t,o,i,o,r)},o.prototype.startCameraDeviceTest=function(e){return R(this,void 0,void 0,(function(){return f(this,(function(t){switch(t.label){case 0:return this.logger.info("".concat(le,".startCameraDeviceTest with params: "),e),e?(this._setLocalTestView(e),[4,this._testTrtc.startLocalVideo(this._generateLocalTestVideoData())]):[2];case 1:return t.sent(),[2]}}))}))},o.prototype.stopCameraDeviceTest=function(){return R(this,void 0,void 0,(function(){return f(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(le,".stopCameraDeviceTest")),this._setLocalTestView(null),[4,this._testTrtc.stopLocalVideo()];case 1:return e.sent(),[2]}}))}))},o.prototype.startMicDeviceTest=function(t){return R(this,void 0,void 0,(function(){var o=this;return f(this,(function(i){switch(i.label){case 0:return this.logger.info("".concat(le,".startMicDeviceTest with params: "),t),[4,this._testTrtc.startLocalAudio({publish:!1,option:{microphoneId:this._currentMicrophoneId,profile:z[e.TRTCAudioQuality.TRTCAudioQualityDefault]}})];case 1:return i.sent(),this._testTrtc.on(T.default.EVENT.AUDIO_VOLUME,(function(e){null==e||e.result.forEach((function(e){var t=e.userId,i=e.volume;""===t&&o.emit("onTestMicVolume",i)}))})),[4,this._testTrtc.enableAudioVolumeEvaluation(t)];case 2:return i.sent(),[2]}}))}))},o.prototype.stopMicDeviceTest=function(){return R(this,void 0,void 0,(function(){return f(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(le,".stopMicDeviceTest")),[4,this._testTrtc.stopLocalAudio()];case 1:return e.sent(),[2]}}))}))},o.prototype.callExperimentalAPI=function(e){this.logger.info("".concat(le,".callExperimentalAPI"),e);var t=function(e){if("string"!=typeof e)return e;var t;try{var o=JSON.parse(e);t="object"==typeof o&&o?o:e}catch(i){t=e}return t}(e);if(t!==e){var o=t.api,i=t.params;o&&i&&"setFramework"===o&&this._handleSetFrameWork(i)}},o.prototype._handleSetFrameWork=function(e){var t=e.frameWork,o=e.component,i=e.language;ee(t)&&(this._frameWorkType=t),ee(o)&&(this._component=o),ee(i)&&(this._language=i)},o.prototype._unbindEvents=function(){},o.prototype._destroy=function(){this._unbindEvents()},o.prototype._emitError=function(e){e&&this.emit&&this.emit(J,e.code,e.message)},o.prototype._callFunctionErrorManage=function(e,t){e&&e.code===T.default.ERROR_CODE.OPERATION_ABORT||(e&&e.getCode&&e.getCode()?(this.emit(J,e.getCode(),e.message),this._log.error("(".concat(t,") failed - ").concat(e.message))):(this.emit(J,ie,e.message),this._log.error("(".concat(t,") failed - ").concat(e.message))))},o.prototype._getTRTCResolution=function(t){var o=(e.TRTCVideoResolution[t]||"").split("_");return{width:+(o.length>1&&o[1]),height:+(o.length>2&&o[2])}},o.prototype._getTRTCVideoProfile=function(e,t){var o=t.videoResolution,i=t.videoFps,r=t.videoBitrate,n={};switch(e){case"screen":n=this._defaultScreenProfile;break;case"small":n=this._defaultSmallVideoProfile;break;default:n=this._defaultVideoProfile}if(o){var a=this._getTRTCResolution(o);n.width=a.width,n.height=a.height}return i&&(n.frameRate=i),r&&(n.bitrate=r),n},o.prototype._getTRTCStreamType=function(t){var o;return((o={})[e.TRTCVideoStreamType.TRTCVideoStreamTypeBig]=T.default.TYPE.STREAM_TYPE_MAIN,o[e.TRTCVideoStreamType.TRTCVideoStreamTypeSmall]=T.default.TYPE.STREAM_TYPE_MAIN,o[e.TRTCVideoStreamType.TRTCVideoStreamTypeSub]=T.default.TYPE.STREAM_TYPE_SUB,o)[t]},o.prototype._getTRTCFillMode=function(t){var o;return((o={})[e.TRTCVideoFillMode.TRTCVideoFillMode_Fill]=Z.COVER,o[e.TRTCVideoFillMode.TRTCVideoFillMode_Fit]=Z.CONTAIN,o)[t]},o.prototype._getTRTCMirror=function(t){var o;return t===e.TRTCVideoMirrorType.TRTCVideoMirrorType_Auto?!this._getIsMobile()||this._getIsFrontCamera():((o={})[e.TRTCVideoMirrorType.TRTCVideoMirrorType_Enable]=!0,o[e.TRTCVideoMirrorType.TRTCVideoMirrorType_Disable]=!1,o)[t]},o.prototype._getTRTCCloudDeviceType=function(t){return{camera:e.TRTCDeviceType.TRTCDeviceTypeCamera,microphone:e.TRTCDeviceType.TRTCDeviceTypeMic,speaker:e.TRTCDeviceType.TRTCDeviceTypeSpeaker}[t]},o.prototype._getTRTCCloudDeviceState=function(t){return{add:e.TRTCDeviceState.TRTCDeviceStateAdd,remove:e.TRTCDeviceState.TRTCDeviceStateRemove,active:e.TRTCDeviceState.TRTCDeviceStateActive}[t]},o.prototype._getTRTCCloudQuality=function(t){return[e.TRTCQuality.TRTCQuality_Unknown,e.TRTCQuality.TRTCQuality_Excellent,e.TRTCQuality.TRTCQuality_Good,e.TRTCQuality.TRTCQuality_Poor,e.TRTCQuality.TRTCQuality_Bad,e.TRTCQuality.TRTCQuality_Vbad,e.TRTCQuality.TRTCQuality_Down][t]},o.prototype._generateLocalVideoData=function(){var e={view:this._getLocalView(),publish:this._getIsVideoPublish(),option:p({profile:this._getVideoProfile(),small:this._getSmallStreamVideoProfile()},this._getVideoPlayOption())};return this._getIsMobile()?e&&Object.assign(e.option,{useFrontCamera:this._getIsFrontCamera()}):e&&Object.assign(e.option,{cameraId:this._getCurrentCameraId()}),e},o.prototype._generateLocalTestVideoData=function(){return{view:this._getLocalTestView(),publish:!1,option:p({cameraId:this._getCurrentCameraId(),profile:this._getVideoProfile()},this._getVideoPlayOption())}},o.prototype._generateLocalAudioData=function(){return{publish:this._getIsAudioPublish(),option:{microphoneId:this._getCurrentMicrophoneId(),profile:this._getAudioProfile()}}},o.prototype._generateRemoteVideoData=function(e,t){return this._remoteStreamConfig.get("".concat(e,"_").concat(this._getTRTCStreamType(t)))},o.prototype._addTRTCEvents=function(){var t=this;this._trtc.on(T.default.EVENT.ERROR,(function(e){var o;e&&t.emit("onError",null===(o=null==e?void 0:e.getCode)||void 0===o?void 0:o.getCode(),e.message)})),this._trtc.on(T.default.EVENT.REMOTE_USER_ENTER,(function(e){(null==e?void 0:e.userId)&&t.emit("onRemoteUserEnterRoom",e.userId)})),this._trtc.on(T.default.EVENT.REMOTE_USER_EXIT,(function(e){(null==e?void 0:e.userId)&&t.emit("onRemoteUserLeaveRoom",e.userId)})),this._trtc.on(T.default.EVENT.REMOTE_AUDIO_AVAILABLE,(function(e){(null==e?void 0:e.userId)&&t.emit("onUserAudioAvailable",e.userId,!0)})),this._trtc.on(T.default.EVENT.REMOTE_AUDIO_UNAVAILABLE,(function(e){(null==e?void 0:e.userId)&&t.emit("onUserAudioAvailable",e.userId,!1)})),this._trtc.on(T.default.EVENT.REMOTE_VIDEO_AVAILABLE,(function(e){t._emitVideoAvailable(e,!0)})),this._trtc.on(T.default.EVENT.REMOTE_VIDEO_UNAVAILABLE,(function(e){t._emitVideoAvailable(e,!1)})),this._trtc.on(T.default.EVENT.AUDIO_VOLUME,(function(e){(null==e?void 0:e.result)&&t.emit("onUserVoiceVolume",null==e?void 0:e.result,((null==e?void 0:e.result)||[]).length)})),this._trtc.on(T.default.EVENT.NETWORK_QUALITY,(function(e){var o=e.uplinkNetworkQuality,i=e.downlinkNetworkQuality,r=e.uplinkRTT,n=e.uplinkLoss,a=e.downlinkLoss,s=e.downlinkInfo,c=new I("",t._getTRTCCloudQuality(o)),u=[];s.length>0&&(u=s.map((function(e){return new I(e.userId,t._getTRTCCloudQuality(i))}))),t.emit("onNetworkQuality",c,u);var l=new L(n,a,0,0,r,0,0);t.emit("onStatistics",l)})),this._trtc.on(T.default.EVENT.SCREEN_SHARE_STOPPED,(function(){t.emit("onScreenCaptureStopped",0),t._isSharingScreen=!1})),this._trtc.on(T.default.EVENT.PUBLISH_STATE_CHANGED,(function(o){var i=o.mediaType;"started"===o.state&&("audio"===i?t.emit("onSendFirstLocalAudioFrame"):"video"===i?t.emit("onSendFirstLocalVideoFrame",e.TRTCVideoStreamType.TRTCVideoStreamTypeBig):"screen"===i&&t.emit("onSendFirstLocalVideoFrame",e.TRTCVideoStreamType.TRTCVideoStreamTypeSub))}))},o.prototype._removeTRTCEvents=function(){this._trtc.off("*")},o.prototype._emitVideoAvailable=function(e,t){var o=e.userId,i=e.streamType;t?this._remoteStreamMap.set("".concat(o,"_").concat(i),!0):this._remoteStreamMap.delete("".concat(o,"_").concat(i)),i===T.default.TYPE.STREAM_TYPE_SUB?o&&this.emit("onUserSubStreamAvailable",o,t):o&&this.emit("onUserVideoAvailable",o,t)},o.prototype._setLocalView=function(e){this._localView=e},o.prototype._getLocalView=function(){return this._localView},o.prototype._setIsMobile=function(e){this._isMobile=e},o.prototype._getIsMobile=function(){return this._isMobile},o.prototype._setIsFrontCamera=function(e){this._isFrontCamera=e},o.prototype._getIsFrontCamera=function(){return this._isFrontCamera},o.prototype._getSmallStreamVideoProfile=function(){return this._smallStreamVideoProfile},o.prototype._setSmallStreamVideoProfile=function(e){this._smallStreamVideoProfile=e},o.prototype._setIsVideoPublish=function(e){this._isVideoPublish=e},o.prototype._getIsVideoPublish=function(){return this._isVideoPublish},o.prototype._setVideoProfile=function(e){this._videoProfile=e},o.prototype._getVideoProfile=function(){return this._videoProfile},o.prototype._setVideoPlayOption=function(e){this._videoPlayOption=e},o.prototype._getVideoPlayOption=function(){return this._videoPlayOption},o.prototype._setLocalTestView=function(e){this._localTestView=e},o.prototype._getLocalTestView=function(){return this._localTestView},o.prototype._setScreenShareParams=function(e){var t=e.view,o=e.systemAudio,i=e.fillMode,r=e.profile;$(t)||(this._screenShareParams.view=t),$(o)||(this._screenShareParams.option.systemAudio=o),$(i)||(this._screenShareParams.option.fillMode=i),$(r)||(this._screenShareParams.option.profile=r)},o.prototype._getScreenShareParams=function(){return this._screenShareParams},o.prototype._setIsAudioPublish=function(e){this._isAudioPublish=e},o.prototype._getIsAudioPublish=function(){return this._isAudioPublish},o.prototype._setAudioProfile=function(e){this._audioProfile=e},o.prototype._getAudioProfile=function(){return this._audioProfile},o.prototype._setCurrentCameraId=function(e){this._currentCameraId=e},o.prototype._getCurrentCameraId=function(){return this._currentCameraId},o.prototype._setCurrentMicrophoneId=function(e){this._currentMicrophoneId=e},o.prototype._getCurrentMicrophoneId=function(){return this._currentMicrophoneId},o.prototype._setCurrentSpeakerId=function(e){this._currentSpeakerId=e},o.prototype._getCurrentSpeakerId=function(){return this._currentSpeakerId},o.prototype._setRemoteStreamConfig=function(t,o,i){var r=this._remoteStreamConfig.get("".concat(t,"_").concat(this._getTRTCStreamType(o)));r||(r={userId:t,streamType:this._getTRTCStreamType(o),option:{mirror:this._getTRTCMirror(e.TRTCVideoMirrorType.TRTCVideoMirrorType_Disable),fillMode:this._getTRTCFillMode(e.TRTCVideoFillMode.TRTCVideoFillMode_Fit)}});var n=i.view,a=i.mirrorType,s=i.fillMode,c=i.small;$(n)||(r.view=n),$(a)||(r.option.mirror=this._getTRTCMirror(a)),$(s)||(r.option.fillMode=this._getTRTCFillMode(s)),$(c)||(r.option.small=c),this._remoteStreamConfig.set("".concat(t,"_").concat(this._getTRTCStreamType(o)),r)},o.prototype.handleDeviceChange=function(){return R(this,void 0,void 0,(function(){var t=this;return f(this,(function(o){return T.default.getCameraList().then((function(o){return R(t,void 0,void 0,(function(){return f(this,(function(t){switch(t.label){case 0:return this._cameraList.length===o.length?[2]:[4,this.deviceChangeManage(this._cameraList,o,e.TRTCDeviceType.TRTCDeviceTypeCamera)];case 1:return t.sent(),this._cameraList=o,[2]}}))}))})),T.default.getMicrophoneList().then((function(o){return R(t,void 0,void 0,(function(){return f(this,(function(t){switch(t.label){case 0:return[4,this.deviceChangeManage(this._microphoneList,o,e.TRTCDeviceType.TRTCDeviceTypeMic)];case 1:return t.sent(),this._microphoneList=o,[2]}}))}))})),T.default.getSpeakerList().then((function(o){return R(t,void 0,void 0,(function(){return f(this,(function(t){switch(t.label){case 0:return[4,this.deviceChangeManage(this._speakerList,o,e.TRTCDeviceType.TRTCDeviceTypeSpeaker)];case 1:return t.sent(),this._speakerList=o,[2]}}))}))})),[2]}))}))},o.prototype.isSameDevice=function(e,t){var o=e&&e.deviceId&&e.groupId&&e.label,i=t&&t.deviceId&&t.groupId&&t.label;return!(!o||!i)&&e.deviceId===t.deviceId&&e.groupId===t.groupId&&e.label===t.label},o.prototype.deviceChangeManage=function(t,o,i){return R(this,void 0,void 0,(function(){var r,n,a,s,c;return f(this,(function(u){switch(u.label){case 0:return r=void 0,t.length!==o.length&&(n=(o||[]).map((function(e){return e.deviceId})),a=new g,t.length>o.length?(a=t.filter((function(e){return!n.includes(e.deviceId)}))[0]||{},r=e.TRTCDeviceState.TRTCDeviceStateRemove):(n=(t||[]).map((function(e){return e.deviceId})),a=o.filter((function(e){return!n.includes(e.deviceId)}))[0]||{},r=e.TRTCDeviceState.TRTCDeviceStateAdd),s=a.deviceId,this.emitOnDeviceChange(s,i,r)),c=this.getDefaultDeviceInfo(o),i!==e.TRTCDeviceType.TRTCDeviceTypeCamera||r!==e.TRTCDeviceState.TRTCDeviceStateRemove?[3,3]:this.isSameDevice(this._currentCamera,c)?[2]:c.deviceId?[4,this.autoChangeDevice(i,c)]:[3,2];case 1:u.sent(),u.label=2;case 2:u.label=3;case 3:return i!==e.TRTCDeviceType.TRTCDeviceTypeMic?[3,6]:this.isSameDevice(this._currentMicrophone,c)?[2]:c.deviceId?[4,this.autoChangeDevice(i,c)]:[3,5];case 4:u.sent(),u.label=5;case 5:u.label=6;case 6:return i!==e.TRTCDeviceType.TRTCDeviceTypeSpeaker?[3,9]:this.isSameDevice(this._currentSpeaker,c)?[2]:c.deviceId?[4,this.autoChangeDevice(i,c)]:[3,8];case 7:u.sent(),u.label=8;case 8:u.label=9;case 9:return[2]}}))}))},o.prototype.getDefaultDeviceInfo=function(e){var t=new g;if(0===e.length)return t;var o=e.filter((function(e){return"default"===e.deviceId}));return t=o.length>0?o[0]:e[0]},o.prototype.autoChangeDevice=function(t,o){return R(this,void 0,void 0,(function(){var i,r,n,a,s;return f(this,(function(c){switch(c.label){case 0:if(i=o.deviceId,t!==e.TRTCDeviceType.TRTCDeviceTypeCamera)return[3,8];c.label=1;case 1:return c.trys.push([1,3,,4]),[4,this._trtc.updateLocalVideo({option:{cameraId:i}})];case 2:return c.sent(),[3,4];case 3:return r=c.sent(),console.log("error",JSON.stringify(r)),r.code,T.default.ERROR_CODE.OPERATION_ABORT,[3,4];case 4:return c.trys.push([4,6,,7]),[4,this._testTrtc.updateLocalVideo({option:{cameraId:i}})];case 5:return c.sent(),[3,7];case 6:return n=c.sent(),console.log("testTRTC error",JSON.stringify(n)),n.code,T.default.ERROR_CODE.OPERATION_ABORT,[3,7];case 7:this._currentCameraId=i,this._currentCamera=o,this.emitOnDeviceChange(i,t,e.TRTCDeviceState.TRTCDeviceStateActive),c.label=8;case 8:if(t!==e.TRTCDeviceType.TRTCDeviceTypeMic)return[3,16];c.label=9;case 9:return c.trys.push([9,11,,12]),[4,this._trtc.updateLocalAudio({option:{microphoneId:i}})];case 10:return c.sent(),[3,12];case 11:return a=c.sent(),console.log("error",JSON.stringify(a)),a.code,T.default.ERROR_CODE.OPERATION_ABORT,[3,12];case 12:return c.trys.push([12,14,,15]),[4,this._testTrtc.updateLocalAudio({option:{microphoneId:i}})];case 13:return c.sent(),[3,15];case 14:return s=c.sent(),console.log("testTRTC error",JSON.stringify(s)),s.code,T.default.ERROR_CODE.OPERATION_ABORT,[3,15];case 15:this._currentMicId=i,this._currentMicrophone=o,this.emitOnDeviceChange(i,t,e.TRTCDeviceState.TRTCDeviceStateActive),c.label=16;case 16:return t!==e.TRTCDeviceType.TRTCDeviceTypeSpeaker?[3,18]:[4,T.default.setCurrentSpeaker(i)];case 17:c.sent(),this._currentSpeakerId=i,this._currentSpeaker=o,this.emitOnDeviceChange(i,t,e.TRTCDeviceState.TRTCDeviceStateActive),c.label=18;case 18:return[2]}}))}))},o.prototype.emitOnDeviceChange=function(e,t,o){this.emit("onDeviceChange",e,t,o)},o}(function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var o=function(){for(var t=0,o=e;t<o.length;t++)oe(this,new(0,o[t])(this))},i=o.prototype,r=0,n=e;r<n.length;r++){var a=n[r];oe(o,a),oe(i,a.prototype)}return o}(t.EventEmitter));e.Rect=B,e.TRTCDeviceInfo=g,e.TRTCImageBuffer=F,e.TRTCLocalStatistics=P,e.TRTCMixUser=j,e.TRTCNetworkQosParam=k,e.TRTCParams=y,e.TRTCPublishCDNParam=D,e.TRTCQualityInfo=I,e.TRTCRenderParams=M,e.TRTCScreenCaptureSourceInfo=N,e.TRTCStatistics=L,e.TRTCTranscodingConfig=U,e.TRTCVideoEncParam=S,e.TRTCVolumeInfo=E,e.default=Te,Object.defineProperty(e,"__esModule",{value:!0})},"object"==typeof exports&&"undefined"!=typeof module?factory(exports,require("events"),require("trtc-sdk-v5")):"function"==typeof define&&define.amd?define(["exports","events","trtc-sdk-v5"],factory):factory((global="undefined"!=typeof globalThis?globalThis:global||self).TRTC={},global.events,global.TRTC); | ||
var global,factory;global=this,factory=function(e,t){function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=o(t),r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])},r(e,t)},n=function(){return n=Object.assign||function(e){for(var t,o=1,i=arguments.length;o<i;o++)for(var r in t=arguments[o])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},n.apply(this,arguments)};function a(e,t,o,i){return new(o||(o=Promise))((function(r,n){function a(e){try{c(i.next(e))}catch(t){n(t)}}function s(e){try{c(i.throw(e))}catch(t){n(t)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof o?t:new o((function(e){e(t)}))).then(a,s)}c((i=i.apply(e,t||[])).next())}))}function s(e,t){var o,i,r,n,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return n={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(n[Symbol.iterator]=function(){return this}),n;function s(s){return function(c){return function(s){if(o)throw new TypeError("Generator is already executing.");for(;n&&(n=0,s[0]&&(a=0)),a;)try{if(o=1,i&&(r=2&s[0]?i.return:s[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,s[1])).done)return r;switch(i=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,i=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){a.label=s[1];break}if(6===s[0]&&a.label<r[1]){a.label=r[1],r=s;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(s);break}r[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(c){s=[6,c],i=0}finally{o=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}function c(e,t,o){if(o||2===arguments.length)for(var i,r=0,n=t.length;r<n;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}var u,l,d,T,h,p,f,R,_=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e){var t=Object.prototype.hasOwnProperty,o="~";function i(){}function r(e,t,o){this.fn=e,this.context=t,this.once=o||!1}function n(e,t,i,n,a){if("function"!=typeof i)throw new TypeError("The listener must be a function");var s=new r(i,n||e,a),c=o?o+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new i:delete e._events[t]}function s(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(o=!1)),s.prototype.eventNames=function(){var e,i,r=[];if(0===this._eventsCount)return r;for(i in e=this._events)t.call(e,i)&&r.push(o?i.slice(1):i);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(e)):r},s.prototype.listeners=function(e){var t=o?o+e:e,i=this._events[t];if(!i)return[];if(i.fn)return[i.fn];for(var r=0,n=i.length,a=new Array(n);r<n;r++)a[r]=i[r].fn;return a},s.prototype.listenerCount=function(e){var t=o?o+e:e,i=this._events[t];return i?i.fn?1:i.length:0},s.prototype.emit=function(e,t,i,r,n,a){var s=o?o+e:e;if(!this._events[s])return!1;var c,u,l=this._events[s],d=arguments.length;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),d){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,i),!0;case 4:return l.fn.call(l.context,t,i,r),!0;case 5:return l.fn.call(l.context,t,i,r,n),!0;case 6:return l.fn.call(l.context,t,i,r,n,a),!0}for(u=1,c=new Array(d-1);u<d;u++)c[u-1]=arguments[u];l.fn.apply(l.context,c)}else{var T,h=l.length;for(u=0;u<h;u++)switch(l[u].once&&this.removeListener(e,l[u].fn,void 0,!0),d){case 1:l[u].fn.call(l[u].context);break;case 2:l[u].fn.call(l[u].context,t);break;case 3:l[u].fn.call(l[u].context,t,i);break;case 4:l[u].fn.call(l[u].context,t,i,r);break;default:if(!c)for(T=1,c=new Array(d-1);T<d;T++)c[T-1]=arguments[T];l[u].fn.apply(l[u].context,c)}}return!0},s.prototype.on=function(e,t,o){return n(this,e,t,o,!1)},s.prototype.once=function(e,t,o){return n(this,e,t,o,!0)},s.prototype.removeListener=function(e,t,i,r){var n=o?o+e:e;if(!this._events[n])return this;if(!t)return a(this,n),this;var s=this._events[n];if(s.fn)s.fn!==t||r&&!s.once||i&&s.context!==i||a(this,n);else{for(var c=0,u=[],l=s.length;c<l;c++)(s[c].fn!==t||r&&!s[c].once||i&&s[c].context!==i)&&u.push(s[c]);u.length?this._events[n]=1===u.length?u[0]:u:a(this,n)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=o?o+e:e,this._events[t]&&a(this,t)):(this._events=new i,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=o,s.EventEmitter=s,e.exports=s}));e.TRTCVideoResolution=void 0,(u=e.TRTCVideoResolution||(e.TRTCVideoResolution={}))[u.TRTCVideoResolution_120_120=1]="TRTCVideoResolution_120_120",u[u.TRTCVideoResolution_160_160=3]="TRTCVideoResolution_160_160",u[u.TRTCVideoResolution_270_270=5]="TRTCVideoResolution_270_270",u[u.TRTCVideoResolution_480_480=7]="TRTCVideoResolution_480_480",u[u.TRTCVideoResolution_160_120=50]="TRTCVideoResolution_160_120",u[u.TRTCVideoResolution_240_180=52]="TRTCVideoResolution_240_180",u[u.TRTCVideoResolution_280_210=54]="TRTCVideoResolution_280_210",u[u.TRTCVideoResolution_320_240=56]="TRTCVideoResolution_320_240",u[u.TRTCVideoResolution_400_300=58]="TRTCVideoResolution_400_300",u[u.TRTCVideoResolution_480_360=60]="TRTCVideoResolution_480_360",u[u.TRTCVideoResolution_640_480=62]="TRTCVideoResolution_640_480",u[u.TRTCVideoResolution_960_720=64]="TRTCVideoResolution_960_720",u[u.TRTCVideoResolution_160_90=100]="TRTCVideoResolution_160_90",u[u.TRTCVideoResolution_256_144=102]="TRTCVideoResolution_256_144",u[u.TRTCVideoResolution_320_180=104]="TRTCVideoResolution_320_180",u[u.TRTCVideoResolution_480_270=106]="TRTCVideoResolution_480_270",u[u.TRTCVideoResolution_640_360=108]="TRTCVideoResolution_640_360",u[u.TRTCVideoResolution_960_540=110]="TRTCVideoResolution_960_540",u[u.TRTCVideoResolution_1280_720=112]="TRTCVideoResolution_1280_720",u[u.TRTCVideoResolution_1920_1080=114]="TRTCVideoResolution_1920_1080",e.TRTCVideoStreamType=void 0,(l=e.TRTCVideoStreamType||(e.TRTCVideoStreamType={}))[l.TRTCVideoStreamTypeBig=0]="TRTCVideoStreamTypeBig",l[l.TRTCVideoStreamTypeSmall=1]="TRTCVideoStreamTypeSmall",l[l.TRTCVideoStreamTypeSub=2]="TRTCVideoStreamTypeSub",e.TRTCVideoFillMode=void 0,(d=e.TRTCVideoFillMode||(e.TRTCVideoFillMode={}))[d.TRTCVideoFillMode_Fill=0]="TRTCVideoFillMode_Fill",d[d.TRTCVideoFillMode_Fit=1]="TRTCVideoFillMode_Fit",e.TRTCVideoMirrorType=void 0,(T=e.TRTCVideoMirrorType||(e.TRTCVideoMirrorType={}))[T.TRTCVideoMirrorType_Auto=0]="TRTCVideoMirrorType_Auto",T[T.TRTCVideoMirrorType_Enable=1]="TRTCVideoMirrorType_Enable",T[T.TRTCVideoMirrorType_Disable=2]="TRTCVideoMirrorType_Disable",e.TRTCBeautyStyle=void 0,(h=e.TRTCBeautyStyle||(e.TRTCBeautyStyle={}))[h.TRTCBeautyStyleSmooth=0]="TRTCBeautyStyleSmooth",h[h.TRTCBeautyStyleNature=1]="TRTCBeautyStyleNature",e.TRTCAppScene=void 0,(p=e.TRTCAppScene||(e.TRTCAppScene={}))[p.TRTCAppSceneVideoCall=0]="TRTCAppSceneVideoCall",p[p.TRTCAppSceneLIVE=1]="TRTCAppSceneLIVE",p[p.TRTCAppSceneAudioCall=2]="TRTCAppSceneAudioCall",p[p.TRTCAppSceneVoiceChatRoom=3]="TRTCAppSceneVoiceChatRoom",e.TRTCRoleType=void 0,(f=e.TRTCRoleType||(e.TRTCRoleType={}))[f.TRTCRoleAnchor=20]="TRTCRoleAnchor",f[f.TRTCRoleAudience=21]="TRTCRoleAudience",e.TRTCAudioQuality=void 0,(R=e.TRTCAudioQuality||(e.TRTCAudioQuality={}))[R.TRTCAudioQualityDefault=0]="TRTCAudioQualityDefault",R[R.TRTCAudioQualitySpeech=1]="TRTCAudioQualitySpeech",R[R.TRTCAudioQualityMusic=3]="TRTCAudioQualityMusic";var v,C,g=function(e,t,o,i,r){void 0===e&&(e=""),void 0===t&&(t=""),void 0===o&&(o=""),void 0===i&&(i=""),void 0===r&&(r=""),this.deviceId=e,this.deviceName=t,this.kind=o,this.label=i,this.groupId=r};e.TRTCDeviceState=void 0,(v=e.TRTCDeviceState||(e.TRTCDeviceState={}))[v.TRTCDeviceStateAdd=0]="TRTCDeviceStateAdd",v[v.TRTCDeviceStateRemove=1]="TRTCDeviceStateRemove",v[v.TRTCDeviceStateActive=2]="TRTCDeviceStateActive",e.TRTCDeviceType=void 0,(C=e.TRTCDeviceType||(e.TRTCDeviceType={}))[C.TRTCDeviceTypeUnknow=-1]="TRTCDeviceTypeUnknow",C[C.TRTCDeviceTypeMic=0]="TRTCDeviceTypeMic",C[C.TRTCDeviceTypeSpeaker=1]="TRTCDeviceTypeSpeaker",C[C.TRTCDeviceTypeCamera=2]="TRTCDeviceTypeCamera";var m,y=function(t,o,i,r,n,a,s,c,u,l,d){void 0===t&&(t=0),void 0===o&&(o=""),void 0===i&&(i=""),void 0===r&&(r=0),void 0===n&&(n=""),void 0===a&&(a=e.TRTCRoleType.TRTCRoleAnchor),void 0===s&&(s=null),void 0===u&&(u=null),void 0===l&&(l=null),void 0===d&&(d=30),this.sdkAppId=t,this.userId=o,this.userSig=i,this.roomId=r,this.strRoomId=n,this.role=a,this.privateMapKey=s,this.streamId=u,this.userDefineRecordId=l,this.frameWorkType=d},S=function(t,o,i,r){void 0===t&&(t=e.TRTCVideoResolution.TRTCVideoResolution_640_360),void 0===o&&(o=e.TRTCVideoResolutionMode.TRTCVideoResolutionModeLandscape),void 0===i&&(i=15),void 0===r&&(r=550),this.videoResolution=t,this.resMode=o,this.videoFps=i,this.videoBitrate=r};e.TRTCVideoRotation=void 0,(m=e.TRTCVideoRotation||(e.TRTCVideoRotation={}))[m.TRTCVideoRotation0=0]="TRTCVideoRotation0",m[m.TRTCVideoRotation90=1]="TRTCVideoRotation90",m[m.TRTCVideoRotation180=2]="TRTCVideoRotation180",m[m.TRTCVideoRotation270=3]="TRTCVideoRotation270";var V,M=function(t,o,i){void 0===t&&(t=e.TRTCVideoRotation.TRTCVideoRotation0),void 0===o&&(o=e.TRTCVideoFillMode.TRTCVideoFillMode_Fit),void 0===i&&(i=e.TRTCVideoMirrorType.TRTCVideoMirrorType_Disable),this.rotation=t,this.fillMode=o,this.mirrorType=i};e.TRTCQuality=void 0,(V=e.TRTCQuality||(e.TRTCQuality={}))[V.TRTCQuality_Unknown=0]="TRTCQuality_Unknown",V[V.TRTCQuality_Excellent=1]="TRTCQuality_Excellent",V[V.TRTCQuality_Good=2]="TRTCQuality_Good",V[V.TRTCQuality_Poor=3]="TRTCQuality_Poor",V[V.TRTCQuality_Bad=4]="TRTCQuality_Bad",V[V.TRTCQuality_Vbad=5]="TRTCQuality_Vbad",V[V.TRTCQuality_Down=6]="TRTCQuality_Down";var w,b,A,I=function(t,o){void 0===t&&(t=""),void 0===o&&(o=e.TRTCQuality.TRTCQuality_Unknown),this.userId=t,this.quality=o},E=function(e,t){void 0===e&&(e=""),void 0===t&&(t=0),this.userId=e,this.volume=t},D=function(e,t,o){void 0===e&&(e=0),void 0===t&&(t=0),void 0===o&&(o=null),this.appId=e,this.bizId=t,this.url=o},P=function(t,o,i,r,n,a,s){void 0===t&&(t=0),void 0===o&&(o=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===s&&(s=e.TRTCVideoStreamType.TRTCVideoStreamTypeBig),this.width=t,this.height=o,this.frameRate=i,this.videoBitrate=r,this.audioSampleRate=n,this.audioBitrate=a,this.streamType=s},L=function(e,t,o,i,r,n,a,s,c,u){void 0===e&&(e=0),void 0===t&&(t=0),void 0===o&&(o=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===s&&(s=[]),void 0===c&&(c=0),void 0===u&&(u=0),this.upLoss=e,this.downLoss=t,this.appCpu=o,this.systemCpu=i,this.rtt=r,this.receivedBytes=n,this.sentBytes=a,this.localStatisticsArray=s,this.localStatisticsArraySize=c,this.remoteStatisticsArraySize=u};e.TRTCVideoResolutionMode=void 0,(w=e.TRTCVideoResolutionMode||(e.TRTCVideoResolutionMode={}))[w.TRTCVideoResolutionModeLandscape=0]="TRTCVideoResolutionModeLandscape",w[w.TRTCVideoResolutionModePortrait=1]="TRTCVideoResolutionModePortrait",e.TRTCVideoQosPreference=void 0,(b=e.TRTCVideoQosPreference||(e.TRTCVideoQosPreference={}))[b.TRTCVideoQosPreferenceSmooth=1]="TRTCVideoQosPreferenceSmooth",b[b.TRTCVideoQosPreferenceClear=2]="TRTCVideoQosPreferenceClear",e.TRTCQosControlMode=void 0,(A=e.TRTCQosControlMode||(e.TRTCQosControlMode={}))[A.TRTCQosControlModeClient=0]="TRTCQosControlModeClient",A[A.TRTCQosControlModeServer=1]="TRTCQosControlModeServer";var O,k=function(t,o){void 0===t&&(t=e.TRTCVideoQosPreference.TRTCVideoQosPreferenceClear),void 0===o&&(o=e.TRTCQosControlMode.TRTCQosControlModeServer),this.preference=t,this.controlMode=o},F=function(e,t,o,i){void 0===e&&(e=new ArrayBuffer(0)),void 0===t&&(t=0),void 0===o&&(o=0),void 0===i&&(i=0),this.buffer=e,this.length=t,this.width=o,this.height=i};e.TRTCScreenCaptureSourceType=void 0,(O=e.TRTCScreenCaptureSourceType||(e.TRTCScreenCaptureSourceType={}))[O.TRTCScreenCaptureSourceTypeUnknown=-1]="TRTCScreenCaptureSourceTypeUnknown",O[O.TRTCScreenCaptureSourceTypeWindow=0]="TRTCScreenCaptureSourceTypeWindow",O[O.TRTCScreenCaptureSourceTypeScreen=1]="TRTCScreenCaptureSourceTypeScreen",O[O.TRTCScreenCaptureSourceTypeCustom=2]="TRTCScreenCaptureSourceTypeCustom";var Q,N=function(t,o,i,r,n,a){void 0===t&&(t=e.TRTCScreenCaptureSourceType.TRTCScreenCaptureSourceTypeUnknown),void 0===o&&(o=""),void 0===i&&(i=""),void 0===r&&(r=new F),void 0===n&&(n=new F),void 0===a&&(a=!1),this.type=t,this.sourceId=o,this.sourceName=i,this.thumbBGRA=r,this.iconBGRA=n,this.isMinimizeWindow=a},x=function(e,t,o,i){void 0===e&&(e=0),void 0===t&&(t=0),void 0===o&&(o=0),void 0===i&&(i=0),this.left=e,this.top=t,this.right=o,this.bottom=i},B=function(t,o,i,r,n,a,s,c,u,l,d,T,h,p,f){void 0===t&&(t=e.TRTCTranscodingConfigMode.TRTCTranscodingConfigMode_Unknown),void 0===o&&(o=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===a&&(a=0),void 0===s&&(s=15),void 0===c&&(c=2),void 0===u&&(u=0),void 0===l&&(l=""),void 0===d&&(d=64),void 0===T&&(T=48e3),void 0===h&&(h=1),void 0===p&&(p=[]),void 0===f&&(f=""),this.mode=t,this.appId=o,this.bizId=i,this.videoWidth=r,this.videoHeight=n,this.videoBitrate=a,this.videoFramerate=s,this.videoGOP=c,this.backgroundColor=u,this.backgroundImage=l,this.audioSampleRate=d,this.audioBitrate=T,this.audioChannels=h,this.mixUsersArray=p,this.mixUsersArraySize=p.length,this.streamId=f};e.TRTCTranscodingConfigMode=void 0,(Q=e.TRTCTranscodingConfigMode||(e.TRTCTranscodingConfigMode={}))[Q.TRTCTranscodingConfigMode_Unknown=0]="TRTCTranscodingConfigMode_Unknown",Q[Q.TRTCTranscodingConfigMode_Manual=1]="TRTCTranscodingConfigMode_Manual",Q[Q.TRTCTranscodingConfigMode_Template_PureAudio=2]="TRTCTranscodingConfigMode_Template_PureAudio",Q[Q.TRTCTranscodingConfigMode_Template_PresetLayout=3]="TRTCTranscodingConfigMode_Template_PresetLayout",Q[Q.TRTCTranscodingConfigMode_Template_ScreenSharing=4]="TRTCTranscodingConfigMode_Template_ScreenSharing",Q[Q.TRTC_TranscodingConfigMode_Unknown=5]="TRTC_TranscodingConfigMode_Unknown",Q[Q.TRTC_TranscodingConfigMode_Manual=6]="TRTC_TranscodingConfigMode_Manual",Q[Q.TRTC_TranscodingConfigMode_Template_PureAudio=7]="TRTC_TranscodingConfigMode_Template_PureAudio",Q[Q.TRTC_TranscodingConfigMode_Template_PresetLayout=8]="TRTC_TranscodingConfigMode_Template_PresetLayout",Q[Q.TRTC_TranscodingConfigMode_Template_ScreenSharing=9]="TRTC_TranscodingConfigMode_Template_ScreenSharing";var U,j=function(t,o,i,r,n,a,s,c){void 0===t&&(t=""),void 0===o&&(o=""),void 0===i&&(i=null),void 0===r&&(r=0),void 0===n&&(n=!1),void 0===a&&(a=e.TRTCVideoStreamType.TRTCVideoStreamTypeBig),void 0===s&&(s=e.TRTCMixInputType.TRTCMixInputTypeUndefined),void 0===c&&(c=0),this.userId=t,this.roomId=o,this.rect=i,this.zOrder=r,this.pureAudio=n,this.streamType=a,this.inputType=s,this.renderMode=c};e.TRTCMixInputType=void 0,(U=e.TRTCMixInputType||(e.TRTCMixInputType={}))[U.TRTCMixInputTypeUndefined=0]="TRTCMixInputTypeUndefined",U[U.TRTCMixInputTypeAudioVideo=1]="TRTCMixInputTypeAudioVideo",U[U.TRTCMixInputTypePureVideo=2]="TRTCMixInputTypePureVideo",U[U.TRTCMixInputTypePureAudio=3]="TRTCMixInputTypePureAudio";var W,J="onError",Y="rtc",G="live",z={20:"anchor",21:"audience"},K={0:Y,1:G,2:Y,3:G},q={0:"standard",1:"high",2:"standard_stereo",3:"high_stereo"};function H(){return Math.floor(performance.now())}!function(e){e[e.ActiveExitRoom=0]="ActiveExitRoom",e[e.KickedExitRoom=1]="KickedExitRoom"}(W||(W={}));var X,Z,$=function(e){return void 0===e},ee=function(e){return"number"==typeof e},te=function(e){return"boolean"==typeof e};!function(e){e.LIVE="live",e.RTC="rtc"}(X||(X={})),function(e){e.CONTAIN="contain",e.COVER="cover",e.FILL="fill"}(Z||(Z={}));var oe=-1e3,ie={code:-1001,message:"参数错误, 请检查参数格式、是否非空等"},re={code:-1005,message:"not supported"},ne="2.1.5",ae=function(){function e(e,t){if(this.logRegion="tc",this.loggerManager=e,t){var o=t.sdkAppId,i=t.userId,r=t.seq;this.seq=r,e&&(this.logger=e.createLogger({id:"".concat(this.logRegion).concat(r),userId:i,sdkAppId:o}))}else this.logger=e;this.logger||(this.logger={debug:function(e){console.debug(e)},info:function(e){console.info(e)},warn:function(e){console.warn(e)},error:function(e){console.error(e)}})}return e.prototype.getLogMessage=function(e){var t=this;return e.map((function(e){return t.getStringifyMessage(e)})).join(" ")},e.prototype.getStringifyMessage=function(e){var t=this;if("object"!=typeof e)return e;if(e instanceof HTMLElement)return"".concat(e.tagName.toLocaleLowerCase(),"#").concat(e.id);if(e instanceof Array){var o=[];return Object.keys(e).forEach((function(i){return o[i]=t.getStringifyMessage(e[i])})),JSON.stringify(o)}if(e instanceof Object){var i={};return Object.keys(e).forEach((function(o){return i[o]=t.getStringifyMessage(e[o])})),JSON.stringify(i)}return e},e.prototype.update=function(e){var t=e.userId,o=e.sdkAppId;this.loggerManager&&this.loggerManager.createLogger&&(this.logger=this.loggerManager.createLogger({id:"".concat(this.logRegion).concat(this.seq),userId:t,sdkAppId:o}))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var o=this.getLogMessage(e);this.logger.debug(o)},e.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var o=this.getLogMessage(e);this.logger&&this.logger.info&&this.logger.info(o)},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var o=this.getLogMessage(e);this.logger&&this.logger.warn&&this.logger.warn(o)},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var o=this.getLogMessage(e);this.logger&&this.logger.error&&this.logger.error(o)},e}(),se=null,ce=i.default._loggerManager;ce.info("TRTCCloud Version: ".concat(ne));var ue="trtcCloud",le=1,de=function(t){function o(o){void 0===o&&(o={});var r=t.call(this)||this;r._version="",r._frameWorkType=30,r._component=0,r._language=0,r._localView=null,r._autoRecvAudio=!0,r._autoRecvVideo=!0,r._localTestView=null,r._isVideoPublish=!0,r._localRenderParams={rotation:e.TRTCVideoRotation.TRTCVideoRotation0,fillMode:e.TRTCVideoFillMode.TRTCVideoFillMode_Fill,mirrorType:e.TRTCVideoMirrorType.TRTCVideoMirrorType_Auto},r._videoProfile={},r._videoPlayOption={},r._isAudioPublish=!0,r._audioProfile=Object.keys(q)[0],r._isSharingScreen=!1,r._remoteStreamConfig=new Map,r._remoteStreamMap=new Map,r._cameraList=[],r._microphoneList=[],r._speakerList=[],r._currentCamera={},r._currentMicrophone={},r._currentSpeaker={},r._currentCameraId="",r._currentMicrophoneId="",r._currentSpeakerId="",r._screenShareParams={option:{}},r._isMobile=!1,r._isFrontCamera=!1,r._smallStreamVideoProfile=void 0,r._defaultVideoProfile={width:640,height:480,frameRate:15,bitrate:900},r._defaultScreenProfile={width:1920,height:1080,frameRate:15,bitrate:1500},r._defaultSmallVideoProfile={width:160,height:120,frameRate:15,bitrate:200},r._version=ne;var n,a,s,c=o.frameWorkType,u=void 0===c?30:c,l=o.component,d=void 0===l?0:l;return r._frameWorkType=u,r._component=d,r._trtc=i.default.create(),r._testTrtc=i.default.create(),r._log=i.default._loggerManager,r.logger=new ae(ce,{seq:le++}),r._addTRTCEvents(),r.handleDeviceChange=r.handleDeviceChange.bind(r),navigator&&navigator.mediaDevices&&navigator.mediaDevices.addEventListener("devicechange",(n=r.handleDeviceChange,a=30,function(){for(var e=this,t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];s>0&&clearTimeout(s),s=window.setTimeout((function(){n.apply(e,t),s=-1}),a)})),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function o(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(o.prototype=t.prototype,new o)}(o,t),o.getTRTCShareInstance=function(e){return se||(se=new o(e)),se},o.prototype.destroyTRTCShareInstance=function(){se&&(this._removeTRTCEvents(),se._destroy(),se=null)},o.prototype.getSDKVersion=function(){return this._version||""},o.prototype.enterRoom=function(e,t){return a(this,void 0,Promise,(function(){var o,i,r,a,c,u,l,d,T,h,p,f,R,_,v,C;return s(this,(function(s){switch(s.label){case 0:if(o=e.sdkAppId,i=e.userId,r=e.userSig,a=e.roomId,c=e.strRoomId,u=e.role,l=e.privateMapKey,d=e.businessInfo,T=e.enableAutoPlayDialog,h=e.proxy,p=e.streamId,f=e.userDefineRecordId,this.logger.update({sdkAppId:o,userId:i}),this.logger.info("".concat(ue,".enterRoom with params: "),e,t),!(o&&i&&r))return[3,5];s.label=1;case 1:return s.trys.push([1,3,,4]),R={sdkAppId:o,userId:i,userSig:r,roomId:a||c,role:z[u],scene:K[t],autoReceiveAudio:this._autoRecvAudio,autoReceiveVideo:this._autoRecvVideo,frameWorkType:this._frameWorkType,component:this._component,language:this._language},R=l?n(n({},R),{privateMapKey:l}):R,R=d?n(n({},R),{businessInfo:d}):R,R=T?n(n({},R),{enableAutoPlayDialog:T}):R,R=h?n(n({},R),{proxy:h}):R,R=p?n(n({},R),{streamId:p}):R,R=f?n(n({},R),{userDefineRecordId:f}):R,_=H(),[4,this._trtc.enterRoom(R)];case 2:return s.sent(),v=H()-_,this.emit("onEnterRoom",v),[3,4];case 3:return C=s.sent(),this.emit("onEnterRoom",-1),this._callFunctionErrorManage(C,"enterRoom"),[3,4];case 4:return[3,6];case 5:this._emitError(ie),s.label=6;case 6:return[2]}}))}))},o.prototype.exitRoom=function(){return a(this,void 0,Promise,(function(){var e;return s(this,(function(t){switch(t.label){case 0:return t.trys.push([0,4,,5]),this.logger.info("".concat(ue,".enterRoom")),this._isSharingScreen?[4,this.stopScreenShare()]:[3,2];case 1:t.sent(),t.label=2;case 2:return[4,this._trtc.exitRoom()];case 3:return t.sent(),[3,5];case 4:return e=t.sent(),this._callFunctionErrorManage(e,"exitRoom"),[3,5];case 5:return[2]}}))}))},o.prototype.switchRole=function(e){return a(this,void 0,void 0,(function(){var t;return s(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(ue,".switchRole with param: "),e),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,this._trtc.switchRole(z[e])];case 2:return o.sent(),this.emit("onSwitchRole",0,"switch role success, role = ".concat(e,", ").concat(z[e])),[3,4];case 3:return t=o.sent(),this.emit("onSwitchRole",null==t?void 0:t.getCode(),t.message),[3,4];case 4:return[2]}}))}))},o.prototype.setDefaultStreamRecvMode=function(e,t){return a(this,void 0,void 0,(function(){return s(this,(function(o){return this.logger.info("".concat(ue,".setDefaultStreamRecvMode with param: "),{autoRecvAudio:e,autoRecvVideo:t}),te(e)&&(this._autoRecvAudio=e),te(t)&&(this._autoRecvVideo=t),[2]}))}))},o.prototype._updateLocalVideo=function(){return a(this,void 0,void 0,(function(){var e;return s(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this._trtc.updateLocalVideo(this._generateLocalVideoData())];case 1:return t.sent(),[3,3];case 2:if((e=t.sent()).code===i.default.ERROR_CODE.OPERATION_ABORT)return[2];throw e;case 3:return[2]}}))}))},o.prototype._updateLocalTestVideo=function(){return a(this,void 0,void 0,(function(){var e;return s(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this._testTrtc.updateLocalVideo(this._generateLocalTestVideoData())];case 1:return t.sent(),[3,3];case 2:if((e=t.sent()).code===i.default.ERROR_CODE.OPERATION_ABORT)return[2];throw e;case 3:return[2]}}))}))},o.prototype._updateRemoteVideo=function(e,t){return a(this,void 0,void 0,(function(){var o;return s(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this._trtc.updateRemoteVideo(this._generateRemoteVideoData(e,t))];case 1:return r.sent(),[3,3];case 2:if((o=r.sent()).code===i.default.ERROR_CODE.OPERATION_ABORT)return[2];throw o;case 3:return[2]}}))}))},o.prototype.startLocalPreview=function(){for(var t=[],o=0;o<arguments.length;o++)t[o]=arguments[o];return a(this,void 0,Promise,(function(){var o,r,n,a,u,l,d,T;return s(this,(function(s){switch(s.label){case 0:this.logger.info("".concat(ue,".startLocalPreview with params: "),t),1===c([],t,!0).length?r=c([],t,!0)[0]:2===c([],t,!0).length&&(T=c([],t,!0),o=T[0],r=T[1]),$(o)||(this._setIsMobile(!0),this._setIsFrontCamera(o)),this._setLocalView(r),s.label=1;case 1:s.trys.push([1,8,,9]),s.label=2;case 2:return s.trys.push([2,4,,7]),[4,this._trtc.startLocalVideo(this._generateLocalVideoData())];case 3:return s.sent(),[3,7];case 4:return(n=s.sent()).code!==i.default.ERROR_CODE.OPERATION_ABORT?[3,6]:[4,this._updateLocalVideo()];case 5:return s.sent(),[2];case 6:throw n;case 7:return this.emit("onCameraDidReady"),a=this._getVideoProfile(),u=a.width,l=a.height,this.emit("onFirstVideoFrame","",e.TRTCVideoStreamType.TRTCVideoStreamTypeBig,u,l),[3,9];case 8:return d=s.sent(),this._callFunctionErrorManage(d,"startLocalPreview"),[3,9];case 9:return[2]}}))}))},o.prototype.updateLocalView=function(e){return a(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return this.logger.info("".concat(ue,".updateLocalView with param: "),e),this._setLocalView(e),[4,this._updateLocalVideo()];case 1:return t.sent(),[2]}}))}))},o.prototype.stopLocalPreview=function(){return a(this,void 0,void 0,(function(){var e;return s(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(ue,".stopLocalPreview")),t.label=1;case 1:return t.trys.push([1,3,,4]),this._setLocalView(null),[4,this._trtc.stopLocalVideo()];case 2:return t.sent(),[3,4];case 3:return e=t.sent(),console.warn("".concat(ue," stopLocalPreview error: ").concat(e)),this._callFunctionErrorManage(e,"stopLocalPreview"),[3,4];case 4:return[2]}}))}))},o.prototype.muteLocalVideo=function(e){return void 0===e&&(e=!1),a(this,void 0,void 0,(function(){var t;return s(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(ue,".muteLocalVideo with params: "),e),o.label=1;case 1:return o.trys.push([1,3,,4]),this._setIsVideoPublish(!e),[4,this._updateLocalVideo()];case 2:return o.sent(),[3,4];case 3:return t=o.sent(),this._callFunctionErrorManage(t,"muteLocalVideo"),[3,4];case 4:return[2]}}))}))},o.prototype.startRemoteView=function(t,o,r){return a(this,void 0,void 0,(function(){var n,a;return s(this,(function(s){switch(s.label){case 0:this.logger.info("".concat(ue,".startRemoteView with params: "),t,o,r),s.label=1;case 1:if(s.trys.push([1,8,,9]),this._setRemoteStreamConfig(t,r,{view:o,small:r===e.TRTCVideoStreamType.TRTCVideoStreamTypeSmall}),!this._remoteStreamMap.get("".concat(t,"_").concat(this._getTRTCStreamType(r))))return[2];s.label=2;case 2:return s.trys.push([2,4,,7]),[4,this._trtc.startRemoteVideo(this._generateRemoteVideoData(t,r))];case 3:return s.sent(),[3,7];case 4:return(n=s.sent()).code!==i.default.ERROR_CODE.OPERATION_ABORT?[3,6]:[4,this._updateRemoteVideo(t,r)];case 5:return s.sent(),[2];case 6:throw n;case 7:return this.emit("onFirstVideoFrame",t,r,0,0),[3,9];case 8:return a=s.sent(),this._callFunctionErrorManage(a,"startRemoteView"),[3,9];case 9:return[2]}}))}))},o.prototype.updateRemoteView=function(e,t,o){return a(this,void 0,void 0,(function(){return s(this,(function(i){switch(i.label){case 0:return this.logger.info("".concat(ue,".updateRemoteView with params: "),e,t,o),this._setRemoteStreamConfig(e,o,{view:t}),[4,this._updateRemoteVideo(e,o)];case 1:return i.sent(),[2]}}))}))},o.prototype.stopRemoteView=function(e,t){return a(this,void 0,void 0,(function(){var o;return s(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(ue,".stopRemoteView with params: "),e,t),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this._trtc.stopRemoteVideo({userId:e,streamType:this._getTRTCStreamType(t)})];case 2:return i.sent(),[3,4];case 3:return o=i.sent(),this._callFunctionErrorManage(o,"stopRemoteView"),[3,4];case 4:return[2]}}))}))},o.prototype.stopAllRemoteView=function(){return a(this,void 0,void 0,(function(){var e;return s(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(ue,".stopAllRemoteView")),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this._trtc.stopRemoteVideo({userId:"*"})];case 2:return t.sent(),[3,4];case 3:return e=t.sent(),this._callFunctionErrorManage(e,"stopAllRemoteView"),[3,4];case 4:return[2]}}))}))},o.prototype.setVideoEncoderParam=function(e){return a(this,void 0,void 0,(function(){var t,o;return s(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(ue,".setVideoEncoderParam with params: "),e),i.label=1;case 1:return i.trys.push([1,4,,5]),t=this._getTRTCVideoProfile("video",e),this._setVideoProfile(t),[4,this._updateLocalVideo()];case 2:return i.sent(),[4,this._updateLocalTestVideo()];case 3:return i.sent(),[3,5];case 4:return o=i.sent(),this._callFunctionErrorManage(o,"setVideoEncoderParam"),[3,5];case 5:return[2]}}))}))},o.prototype.setLocalRenderParams=function(e){return a(this,void 0,void 0,(function(){var t,o;return s(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(ue,".setLocalRenderParams with params: "),e),Object.assign(this._localRenderParams,e),i.label=1;case 1:return i.trys.push([1,4,,5]),t={},e.mirrorType&&(t.mirror=this._getTRTCMirror(e.mirrorType)),e.fillMode&&(t.fillMode=this._getTRTCFillMode(e.fillMode)),this._setVideoPlayOption(t),[4,this._updateLocalVideo()];case 2:return i.sent(),[4,this._updateLocalTestVideo()];case 3:return i.sent(),[3,5];case 4:return o=i.sent(),this._callFunctionErrorManage(o,"setLocalRenderParams"),[3,5];case 5:return[2]}}))}))},o.prototype.setRemoteRenderParams=function(e,t,o){return a(this,void 0,void 0,(function(){var i;return s(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(ue,".setRemoteRenderParams with params: "),e,t,o),r.label=1;case 1:return r.trys.push([1,3,,4]),this._setRemoteStreamConfig(e,t,o),[4,this._updateRemoteVideo(e,t)];case 2:return r.sent(),[3,4];case 3:return i=r.sent(),this._callFunctionErrorManage(i,"setRemoteRenderParams"),[3,4];case 4:return[2]}}))}))},o.prototype._updateLocalAudio=function(){return a(this,void 0,void 0,(function(){var e;return s(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this._trtc.updateLocalAudio(this._generateLocalAudioData())];case 1:return t.sent(),[3,3];case 2:if((e=t.sent()).code===i.default.ERROR_CODE.OPERATION_ABORT)return[2];throw e;case 3:return[2]}}))}))},o.prototype.startLocalAudio=function(t){return void 0===t&&(t=e.TRTCAudioQuality.TRTCAudioQualityDefault),a(this,void 0,void 0,(function(){var e,o;return s(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(ue,".startLocalAudio with params: "),t),r.label=1;case 1:r.trys.push([1,8,,9]),this._setAudioProfile(q[t]),r.label=2;case 2:return r.trys.push([2,4,,7]),[4,this._trtc.startLocalAudio(this._generateLocalAudioData())];case 3:return r.sent(),[3,7];case 4:return(e=r.sent()).code!==i.default.ERROR_CODE.OPERATION_ABORT?[3,6]:[4,this._updateLocalAudio()];case 5:return r.sent(),[2];case 6:throw e;case 7:return this.emit("onMicDidReady"),[3,9];case 8:return o=r.sent(),console.warn("".concat(ue," startLocalAudio error: ").concat(o)),this._callFunctionErrorManage(o,"startLocalAudio"),[3,9];case 9:return[2]}}))}))},o.prototype.stopLocalAudio=function(){return a(this,void 0,void 0,(function(){var e;return s(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(ue,".stopLocalAudio")),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this._trtc.stopLocalAudio()];case 2:return t.sent(),[3,4];case 3:return e=t.sent(),this._callFunctionErrorManage(e,"stopLocalAudio"),[3,4];case 4:return[2]}}))}))},o.prototype.muteLocalAudio=function(e){return void 0===e&&(e=!1),a(this,void 0,void 0,(function(){var t;return s(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(ue,".muteLocalAudio with params: "),e),o.label=1;case 1:return o.trys.push([1,3,,4]),this._setIsAudioPublish(!e),[4,this._updateLocalAudio()];case 2:return o.sent(),[3,4];case 3:return t=o.sent(),this._callFunctionErrorManage(t,"muteLocalAudio"),[3,4];case 4:return[2]}}))}))},o.prototype.muteRemoteAudio=function(e,t){return void 0===t&&(t=!1),a(this,void 0,void 0,(function(){var o;return s(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(ue,".muteRemoteAudio with params: "),e,t),i.label=1;case 1:return i.trys.push([1,3,,4]),e?[4,this._trtc.muteRemoteAudio(e,t)]:(this._emitError(ie),[2]);case 2:return i.sent(),[3,4];case 3:return o=i.sent(),this._callFunctionErrorManage(o,"muteRemoteAudio"),[3,4];case 4:return[2]}}))}))},o.prototype.muteAllRemoteAudio=function(e){this.logger.info("".concat(ue,".muteAllRemoteAudio with params: "),e);try{this._trtc.muteRemoteAudio("*",e)}catch(t){this._callFunctionErrorManage(t,"muteAllRemoteAudio")}},o.prototype.setRemoteAudioVolume=function(e,t){this.logger.info("".concat(ue,".setRemoteAudioVolume with params: "),e,t);try{this._trtc.setRemoteAudioVolume(e,t)}catch(o){this._callFunctionErrorManage(o,"setRemoteAudioVolume")}},o.prototype.enableAudioVolumeEvaluation=function(e){this.logger.info("".concat(ue,".enableAudioVolumeEvaluation with params: "),e);try{this._trtc.enableAudioVolumeEvaluation(e)}catch(t){this._callFunctionErrorManage(t,"enableAudioVolumeEvaluation")}},o.prototype.enableSmallVideoStream=function(e,t){return a(this,void 0,Promise,(function(){var o;return s(this,(function(i){switch(i.label){case 0:return this.logger.info("".concat(ue,".enableSmallVideoStream with params: "),e,t),o=this._getTRTCVideoProfile("small",t),this._setSmallStreamVideoProfile(e?o:void 0),[4,this._updateLocalVideo()];case 1:return i.sent(),[2]}}))}))},o.prototype.startScreenShare=function(t,o,r){return a(this,void 0,void 0,(function(){var n,a,c,u,l,d;return s(this,(function(s){switch(s.label){case 0:this.logger.info("".concat(ue,".startScreenShare with params: "),t,o,r),s.label=1;case 1:return s.trys.push([1,3,,4]),n=(r||{}).screenAudio,a=void 0!==n&&n,c=this._getTRTCVideoProfile("screen",r),this._setScreenShareParams({view:t,profile:c,systemAudio:a}),[4,this._trtc.startScreenShare(this._getScreenShareParams())];case 2:return s.sent(),this._isSharingScreen=!0,u=c.width,l=c.height,this.emit("onFirstVideoFrame","",e.TRTCVideoStreamType.TRTCVideoStreamTypeSub,u,l),[3,4];case 3:if((d=s.sent()).code===i.default.ERROR_CODE.OPERATION_ABORT)return[2];throw console.error("Start share screen error:",d,d.code,d.name,d.message),d;case 4:return[2]}}))}))},o.prototype.setSubStreamEncoderParam=function(e){return a(this,void 0,void 0,(function(){var t,o;return s(this,(function(i){switch(i.label){case 0:this.logger.info("".concat(ue,".setSubStreamEncoderParam with params: "),e),i.label=1;case 1:return i.trys.push([1,3,,4]),t=this._getTRTCVideoProfile("screen",e),this._setScreenShareParams({profile:t}),[4,this._trtc.updateScreenShare(this._getScreenShareParams())];case 2:return i.sent(),[3,4];case 3:return o=i.sent(),this._callFunctionErrorManage(o,"setSubStreamEncoderParam"),[3,4];case 4:return[2]}}))}))},o.prototype.stopScreenShare=function(){return a(this,void 0,Promise,(function(){var e;return s(this,(function(t){switch(t.label){case 0:this.logger.info("".concat(ue,".stopScreenShare")),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this._trtc.stopScreenShare()];case 2:return t.sent(),this._isSharingScreen=!1,this.emit("onScreenCaptureStopped",0),[3,4];case 3:return e=t.sent(),this._callFunctionErrorManage(e,"stopScreenShare"),[3,4];case 4:return[2]}}))}))},o.prototype.startScreenCapture=function(){this.emitError(re)},o.prototype.pauseScreenCapture=function(){this.emitError(re)},o.prototype.resumeScreenCapture=function(){this.emitError(re)},o.prototype.getScreenCaptureSources=function(){this.emitError(re)},o.prototype.selectScreenCaptureTarget=function(){this.emitError(re)},o.prototype.getCameraDevicesList=function(){return a(this,void 0,Promise,(function(){var e,t,o;return s(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(ue,".getCameraDevicesList")),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,i.default.getCameraList()];case 2:return e=r.sent(),t=e.map((function(e){return n(n({},e),{deviceName:e.label})})),this._cameraList=e,"{}"===JSON.stringify(this._currentCamera)&&(this._currentCamera=this.getDefaultDeviceInfo(e),this._currentCameraId=this._currentCamera.deviceId),[2,Promise.resolve(t)];case 3:return o=r.sent(),this._callFunctionErrorManage(o,"getCameraDevicesList"),[2,Promise.resolve([])];case 4:return[2]}}))}))},o.prototype.setCurrentCameraDevice=function(e){return a(this,void 0,Promise,(function(){var t;return s(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(ue,".setCurrentCameraDevice with params: "),{cameraId:e}),o.label=1;case 1:return o.trys.push([1,4,,5]),e?(this._currentCameraId=e,this._currentCamera=this._cameraList.filter((function(t){return t.deviceId===e})),[4,this._updateLocalVideo()]):[2,!1];case 2:return o.sent(),[4,this._updateLocalTestVideo()];case 3:return o.sent(),[2,!0];case 4:return t=o.sent(),this._callFunctionErrorManage(t,"setCurrentCameraDevice"),[2,!1];case 5:return[2]}}))}))},o.prototype.getCurrentCameraDevice=function(){this.logger.info("".concat(ue,".getCurrentCameraDevice"));var e=this._currentCamera,t=e.deviceId,o=e.label,i=e.kind,r=e.groupId;return new g(t,o,i,o,r)},o.prototype.isFrontCamera=function(){return this._getIsFrontCamera()},o.prototype.switchCamera=function(e){return a(this,void 0,void 0,(function(){var t;return s(this,(function(o){switch(o.label){case 0:return this.logger.info("".concat(ue,".switchCamera with params: "),e),this._setIsFrontCamera(e),(t=this._getVideoPlayOption()).mirror=this._getTRTCMirror(this._localRenderParams.mirrorType),this._setVideoPlayOption(t),[4,this._updateLocalVideo()];case 1:return o.sent(),[2]}}))}))},o.prototype.getMicDevicesList=function(){return a(this,void 0,Promise,(function(){var e,t,o;return s(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(ue,".getMicDevicesList")),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,i.default.getMicrophoneList()];case 2:return e=r.sent(),t=e.map((function(e){return n(n({},e),{deviceName:e.label})})),this._microphoneList=e,"{}"===JSON.stringify(this._currentMicrophone)&&(this._currentMicrophone=this.getDefaultDeviceInfo(e),this._currentMicrophoneId=this._currentMicrophone.deviceId),[2,Promise.resolve(t)];case 3:return o=r.sent(),this._callFunctionErrorManage(o,"getMicDevicesList"),[2,Promise.resolve([])];case 4:return[2]}}))}))},o.prototype.setCurrentMicDevice=function(e){return a(this,void 0,Promise,(function(){var t;return s(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(ue,".setCurrentMicDevice with params: "),{micId:e}),o.label=1;case 1:return o.trys.push([1,3,,4]),e?(this._setCurrentMicrophoneId(e),this._currentMicrophone=this._microphoneList.filter((function(t){return t.deviceId===e})),[4,this._trtc.updateLocalAudio(this._generateLocalAudioData())]):[2,!1];case 2:return o.sent(),[2,!0];case 3:return t=o.sent(),this._callFunctionErrorManage(t,"setCurrentMicDevice"),[2,!1];case 4:return[2]}}))}))},o.prototype.getCurrentMicDevice=function(){this.logger.info("".concat(ue,".getCurrentMicDevice"));var e=this._currentMicrophone,t=e.deviceId,o=e.label,i=e.kind,r=e.groupId;return new g(t,o,i,o,r)},o.prototype.getSpeakerDevicesList=function(){return a(this,void 0,Promise,(function(){var e,t,o;return s(this,(function(r){switch(r.label){case 0:this.logger.info("".concat(ue,".getSpeakerDevicesList")),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,i.default.getSpeakerList()];case 2:return e=r.sent(),t=e.map((function(e){return n(n({},e),{deviceName:e.label})})),this._speakerList=e,"{}"===JSON.stringify(this._currentSpeaker)&&(this._currentSpeaker=this.getDefaultDeviceInfo(e),this._currentSpeakerId=this._currentSpeaker.deviceId),[2,Promise.resolve(t)];case 3:return o=r.sent(),this._callFunctionErrorManage(o,"getSpeakerDevicesList"),[2,Promise.resolve([])];case 4:return[2]}}))}))},o.prototype.setCurrentSpeakerDevice=function(e){return a(this,void 0,Promise,(function(){var t;return s(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(ue,".setCurrentSpeakerDevice with params: "),{speakerId:e}),o.label=1;case 1:return o.trys.push([1,3,,4]),e?(this._setCurrentSpeakerId(e),this._currentSpeaker=this._speakerList.filter((function(t){return t.deviceId===e})),[4,i.default.setCurrentSpeaker(e)]):[2,!1];case 2:return o.sent(),[2,!0];case 3:return t=o.sent(),this._callFunctionErrorManage(t,"setCurrentSpeakerDevice"),[2,!1];case 4:return[2]}}))}))},o.prototype.getCurrentSpeakerDevice=function(){this.logger.info("".concat(ue,".getCurrentSpeakerDevice"));var e=this._currentCamera,t=e.deviceId,o=e.label,i=e.kind,r=e.groupId;return new g(t,o,i,o,r)},o.prototype.startCameraDeviceTest=function(e){return a(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return this.logger.info("".concat(ue,".startCameraDeviceTest with params: "),e),e?(this._setLocalTestView(e),[4,this._testTrtc.startLocalVideo(this._generateLocalTestVideoData())]):[2];case 1:return t.sent(),[2]}}))}))},o.prototype.stopCameraDeviceTest=function(){return a(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(ue,".stopCameraDeviceTest")),this._setLocalTestView(null),[4,this._testTrtc.stopLocalVideo()];case 1:return e.sent(),[2]}}))}))},o.prototype.startMicDeviceTest=function(t){return a(this,void 0,void 0,(function(){var o=this;return s(this,(function(r){switch(r.label){case 0:return this.logger.info("".concat(ue,".startMicDeviceTest with params: "),t),[4,this._testTrtc.startLocalAudio({publish:!1,option:{microphoneId:this._currentMicrophoneId,profile:q[e.TRTCAudioQuality.TRTCAudioQualityDefault]}})];case 1:return r.sent(),this._testTrtc.on(i.default.EVENT.AUDIO_VOLUME,(function(e){null==e||e.result.forEach((function(e){var t=e.userId,i=e.volume;""===t&&o.emit("onTestMicVolume",i)}))})),[4,this._testTrtc.enableAudioVolumeEvaluation(t)];case 2:return r.sent(),[2]}}))}))},o.prototype.stopMicDeviceTest=function(){return a(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return this.logger.info("".concat(ue,".stopMicDeviceTest")),[4,this._testTrtc.stopLocalAudio()];case 1:return e.sent(),[2]}}))}))},o.prototype.callExperimentalAPI=function(e){this.logger.info("".concat(ue,".callExperimentalAPI"),e);var t=function(e){if("string"!=typeof e)return e;var t;try{var o=JSON.parse(e);t="object"==typeof o&&o?o:e}catch(i){t=e}return t}(e);if(t!==e){var o=t.api,i=t.params;o&&i&&"setFramework"===o&&this._handleSetFrameWork(i)}},o.prototype._handleSetFrameWork=function(e){var t=e.frameWork,o=e.component,i=e.language;ee(t)&&(this._frameWorkType=t),ee(o)&&(this._component=o),ee(i)&&(this._language=i)},o.prototype._unbindEvents=function(){},o.prototype._destroy=function(){this._unbindEvents()},o.prototype._emitError=function(e){e&&this.emit&&this.emit(J,e.code,e.message)},o.prototype._callFunctionErrorManage=function(e,t){e&&e.code===i.default.ERROR_CODE.OPERATION_ABORT||(e&&e.getCode&&e.getCode()?(this.emit(J,e.getCode(),e.message),this.logger.warn("(".concat(t,") failed - ").concat(e.message))):(this.emit(J,oe,e.message),this.logger.warn("(".concat(t,") failed - ").concat(e.message))))},o.prototype._getTRTCResolution=function(t){var o=(e.TRTCVideoResolution[t]||"").split("_");return{width:+(o.length>1&&o[1]),height:+(o.length>2&&o[2])}},o.prototype._getTRTCVideoProfile=function(t,o){var i=o.videoResolution,r=o.videoFps,n=o.videoBitrate,a=o.resMode,s={};switch(t){case"screen":s=this._defaultScreenProfile;break;case"small":s=this._defaultSmallVideoProfile;break;default:s=this._defaultVideoProfile}if(!$(i)){var c=this._getTRTCResolution(i);s.width=c.width,s.height=c.height}if(!$(a)&&a===e.TRTCVideoResolutionMode.TRTCVideoResolutionModePortrait){var u=s.height,l=s.width;s.width=u,s.height=l}return r&&(s.frameRate=r),n&&(s.bitrate=n),s},o.prototype._getTRTCStreamType=function(t){var o;return((o={})[e.TRTCVideoStreamType.TRTCVideoStreamTypeBig]=i.default.TYPE.STREAM_TYPE_MAIN,o[e.TRTCVideoStreamType.TRTCVideoStreamTypeSmall]=i.default.TYPE.STREAM_TYPE_MAIN,o[e.TRTCVideoStreamType.TRTCVideoStreamTypeSub]=i.default.TYPE.STREAM_TYPE_SUB,o)[t]},o.prototype._getTRTCFillMode=function(t){var o;return((o={})[e.TRTCVideoFillMode.TRTCVideoFillMode_Fill]=Z.COVER,o[e.TRTCVideoFillMode.TRTCVideoFillMode_Fit]=Z.CONTAIN,o)[t]},o.prototype._getTRTCMirror=function(t){var o;return t===e.TRTCVideoMirrorType.TRTCVideoMirrorType_Auto?!this._getIsMobile()||this._getIsFrontCamera():((o={})[e.TRTCVideoMirrorType.TRTCVideoMirrorType_Enable]=!0,o[e.TRTCVideoMirrorType.TRTCVideoMirrorType_Disable]=!1,o)[t]},o.prototype._getTRTCCloudDeviceType=function(t){return{camera:e.TRTCDeviceType.TRTCDeviceTypeCamera,microphone:e.TRTCDeviceType.TRTCDeviceTypeMic,speaker:e.TRTCDeviceType.TRTCDeviceTypeSpeaker}[t]},o.prototype._getTRTCCloudDeviceState=function(t){return{add:e.TRTCDeviceState.TRTCDeviceStateAdd,remove:e.TRTCDeviceState.TRTCDeviceStateRemove,active:e.TRTCDeviceState.TRTCDeviceStateActive}[t]},o.prototype._getTRTCCloudQuality=function(t){return[e.TRTCQuality.TRTCQuality_Unknown,e.TRTCQuality.TRTCQuality_Excellent,e.TRTCQuality.TRTCQuality_Good,e.TRTCQuality.TRTCQuality_Poor,e.TRTCQuality.TRTCQuality_Bad,e.TRTCQuality.TRTCQuality_Vbad,e.TRTCQuality.TRTCQuality_Down][t]},o.prototype._generateLocalVideoData=function(){var e={view:this._getLocalView(),publish:this._getIsVideoPublish(),option:n({profile:this._getVideoProfile(),small:this._getSmallStreamVideoProfile()},this._getVideoPlayOption())};return this._getIsMobile()?e&&Object.assign(e.option,{useFrontCamera:this._getIsFrontCamera()}):e&&Object.assign(e.option,{cameraId:this._getCurrentCameraId()}),e},o.prototype._generateLocalTestVideoData=function(){return{view:this._getLocalTestView(),publish:!1,option:n({cameraId:this._getCurrentCameraId(),profile:this._getVideoProfile()},this._getVideoPlayOption())}},o.prototype._generateLocalAudioData=function(){return{publish:this._getIsAudioPublish(),option:{microphoneId:this._getCurrentMicrophoneId(),profile:this._getAudioProfile()}}},o.prototype._generateRemoteVideoData=function(e,t){return this._remoteStreamConfig.get("".concat(e,"_").concat(this._getTRTCStreamType(t)))},o.prototype._addTRTCEvents=function(){var t=this;this._trtc.on(i.default.EVENT.ERROR,(function(e){var o;e&&t.emit("onError",null===(o=null==e?void 0:e.getCode)||void 0===o?void 0:o.getCode(),e.message)})),this._trtc.on(i.default.EVENT.REMOTE_USER_ENTER,(function(e){(null==e?void 0:e.userId)&&t.emit("onRemoteUserEnterRoom",e.userId)})),this._trtc.on(i.default.EVENT.REMOTE_USER_EXIT,(function(e){(null==e?void 0:e.userId)&&t.emit("onRemoteUserLeaveRoom",e.userId)})),this._trtc.on(i.default.EVENT.REMOTE_AUDIO_AVAILABLE,(function(e){(null==e?void 0:e.userId)&&t.emit("onUserAudioAvailable",e.userId,!0)})),this._trtc.on(i.default.EVENT.REMOTE_AUDIO_UNAVAILABLE,(function(e){(null==e?void 0:e.userId)&&t.emit("onUserAudioAvailable",e.userId,!1)})),this._trtc.on(i.default.EVENT.REMOTE_VIDEO_AVAILABLE,(function(e){t._emitVideoAvailable(e,!0)})),this._trtc.on(i.default.EVENT.REMOTE_VIDEO_UNAVAILABLE,(function(e){t._emitVideoAvailable(e,!1)})),this._trtc.on(i.default.EVENT.AUDIO_VOLUME,(function(e){(null==e?void 0:e.result)&&t.emit("onUserVoiceVolume",null==e?void 0:e.result,((null==e?void 0:e.result)||[]).length)})),this._trtc.on(i.default.EVENT.NETWORK_QUALITY,(function(e){var o=e.uplinkNetworkQuality,i=e.downlinkNetworkQuality,r=e.uplinkRTT,n=e.uplinkLoss,a=e.downlinkLoss,s=e.downlinkInfo,c=new I("",t._getTRTCCloudQuality(o)),u=[];s.length>0&&(u=s.map((function(e){return new I(e.userId,t._getTRTCCloudQuality(i))}))),t.emit("onNetworkQuality",c,u);var l=new L(n,a,0,0,r,0,0);t.emit("onStatistics",l)})),this._trtc.on(i.default.EVENT.SCREEN_SHARE_STOPPED,(function(){t.emit("onScreenCaptureStopped",0),t._isSharingScreen=!1})),this._trtc.on(i.default.EVENT.PUBLISH_STATE_CHANGED,(function(o){var i=o.mediaType;"started"===o.state&&("audio"===i?t.emit("onSendFirstLocalAudioFrame"):"video"===i?t.emit("onSendFirstLocalVideoFrame",e.TRTCVideoStreamType.TRTCVideoStreamTypeBig):"screen"===i&&t.emit("onSendFirstLocalVideoFrame",e.TRTCVideoStreamType.TRTCVideoStreamTypeSub))}))},o.prototype._removeTRTCEvents=function(){this._trtc.off("*")},o.prototype._emitVideoAvailable=function(e,t){var o=e.userId,r=e.streamType;t?this._remoteStreamMap.set("".concat(o,"_").concat(r),!0):this._remoteStreamMap.delete("".concat(o,"_").concat(r)),r===i.default.TYPE.STREAM_TYPE_SUB?o&&this.emit("onUserSubStreamAvailable",o,t):o&&this.emit("onUserVideoAvailable",o,t)},o.prototype._setLocalView=function(e){this._localView=e},o.prototype._getLocalView=function(){return this._localView},o.prototype._setIsMobile=function(e){this._isMobile=e},o.prototype._getIsMobile=function(){return this._isMobile},o.prototype._setIsFrontCamera=function(e){this._isFrontCamera=e},o.prototype._getIsFrontCamera=function(){return this._isFrontCamera},o.prototype._getSmallStreamVideoProfile=function(){return this._smallStreamVideoProfile},o.prototype._setSmallStreamVideoProfile=function(e){this._smallStreamVideoProfile=e},o.prototype._setIsVideoPublish=function(e){this._isVideoPublish=e},o.prototype._getIsVideoPublish=function(){return this._isVideoPublish},o.prototype._setVideoProfile=function(e){this._videoProfile=e},o.prototype._getVideoProfile=function(){return this._videoProfile},o.prototype._setVideoPlayOption=function(e){this._videoPlayOption=e},o.prototype._getVideoPlayOption=function(){return this._videoPlayOption},o.prototype._setLocalTestView=function(e){this._localTestView=e},o.prototype._getLocalTestView=function(){return this._localTestView},o.prototype._setScreenShareParams=function(e){var t=e.view,o=e.systemAudio,i=e.fillMode,r=e.profile;$(t)||(this._screenShareParams.view=t),$(o)||(this._screenShareParams.option.systemAudio=o),$(i)||(this._screenShareParams.option.fillMode=i),$(r)||(this._screenShareParams.option.profile=r)},o.prototype._getScreenShareParams=function(){return this._screenShareParams},o.prototype._setIsAudioPublish=function(e){this._isAudioPublish=e},o.prototype._getIsAudioPublish=function(){return this._isAudioPublish},o.prototype._setAudioProfile=function(e){this._audioProfile=e},o.prototype._getAudioProfile=function(){return this._audioProfile},o.prototype._setCurrentCameraId=function(e){this._currentCameraId=e},o.prototype._getCurrentCameraId=function(){return this._currentCameraId},o.prototype._setCurrentMicrophoneId=function(e){this._currentMicrophoneId=e},o.prototype._getCurrentMicrophoneId=function(){return this._currentMicrophoneId},o.prototype._setCurrentSpeakerId=function(e){this._currentSpeakerId=e},o.prototype._getCurrentSpeakerId=function(){return this._currentSpeakerId},o.prototype._setRemoteStreamConfig=function(t,o,i){var r=this._remoteStreamConfig.get("".concat(t,"_").concat(this._getTRTCStreamType(o)));r||(r={userId:t,streamType:this._getTRTCStreamType(o),option:{mirror:this._getTRTCMirror(e.TRTCVideoMirrorType.TRTCVideoMirrorType_Disable),fillMode:this._getTRTCFillMode(e.TRTCVideoFillMode.TRTCVideoFillMode_Fit)}});var n=i.view,a=i.mirrorType,s=i.fillMode,c=i.small;$(n)||(r.view=n),$(a)||(r.option.mirror=this._getTRTCMirror(a)),$(s)||(r.option.fillMode=this._getTRTCFillMode(s)),$(c)||(r.option.small=c),this._remoteStreamConfig.set("".concat(t,"_").concat(this._getTRTCStreamType(o)),r)},o.prototype.handleDeviceChange=function(){return a(this,void 0,void 0,(function(){var t=this;return s(this,(function(o){return i.default.getCameraList().then((function(o){return a(t,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return this._cameraList.length===o.length?[2]:[4,this.deviceChangeManage(this._cameraList,o,e.TRTCDeviceType.TRTCDeviceTypeCamera)];case 1:return t.sent(),this._cameraList=o,[2]}}))}))})),i.default.getMicrophoneList().then((function(o){return a(t,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return[4,this.deviceChangeManage(this._microphoneList,o,e.TRTCDeviceType.TRTCDeviceTypeMic)];case 1:return t.sent(),this._microphoneList=o,[2]}}))}))})),i.default.getSpeakerList().then((function(o){return a(t,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return[4,this.deviceChangeManage(this._speakerList,o,e.TRTCDeviceType.TRTCDeviceTypeSpeaker)];case 1:return t.sent(),this._speakerList=o,[2]}}))}))})),[2]}))}))},o.prototype.isSameDevice=function(e,t){var o=e&&e.deviceId&&e.groupId&&e.label,i=t&&t.deviceId&&t.groupId&&t.label;return!(!o||!i)&&e.deviceId===t.deviceId&&e.groupId===t.groupId&&e.label===t.label},o.prototype.deviceChangeManage=function(t,o,i){return a(this,void 0,void 0,(function(){var r,n,a,c,u;return s(this,(function(s){switch(s.label){case 0:return r=void 0,t.length!==o.length&&(n=(o||[]).map((function(e){return e.deviceId})),a=new g,t.length>o.length?(a=t.filter((function(e){return!n.includes(e.deviceId)}))[0]||{},r=e.TRTCDeviceState.TRTCDeviceStateRemove):(n=(t||[]).map((function(e){return e.deviceId})),a=o.filter((function(e){return!n.includes(e.deviceId)}))[0]||{},r=e.TRTCDeviceState.TRTCDeviceStateAdd),c=a.deviceId,this.emitOnDeviceChange(c,i,r)),u=this.getDefaultDeviceInfo(o),i!==e.TRTCDeviceType.TRTCDeviceTypeCamera||r!==e.TRTCDeviceState.TRTCDeviceStateRemove?[3,3]:this.isSameDevice(this._currentCamera,u)?[2]:u.deviceId?[4,this.autoChangeDevice(i,u)]:[3,2];case 1:s.sent(),s.label=2;case 2:s.label=3;case 3:return i!==e.TRTCDeviceType.TRTCDeviceTypeMic?[3,6]:this.isSameDevice(this._currentMicrophone,u)?[2]:u.deviceId?[4,this.autoChangeDevice(i,u)]:[3,5];case 4:s.sent(),s.label=5;case 5:s.label=6;case 6:return i!==e.TRTCDeviceType.TRTCDeviceTypeSpeaker?[3,9]:this.isSameDevice(this._currentSpeaker,u)?[2]:u.deviceId?[4,this.autoChangeDevice(i,u)]:[3,8];case 7:s.sent(),s.label=8;case 8:s.label=9;case 9:return[2]}}))}))},o.prototype.getDefaultDeviceInfo=function(e){var t=new g;if(0===e.length)return t;var o=e.filter((function(e){return"default"===e.deviceId}));return t=o.length>0?o[0]:e[0]},o.prototype.autoChangeDevice=function(t,o){return a(this,void 0,void 0,(function(){var r,n,a,c,u;return s(this,(function(s){switch(s.label){case 0:if(r=o.deviceId,t!==e.TRTCDeviceType.TRTCDeviceTypeCamera)return[3,8];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this._trtc.updateLocalVideo({option:{cameraId:r}})];case 2:return s.sent(),[3,4];case 3:return n=s.sent(),console.log("error",JSON.stringify(n)),n.code,i.default.ERROR_CODE.OPERATION_ABORT,[3,4];case 4:return s.trys.push([4,6,,7]),[4,this._testTrtc.updateLocalVideo({option:{cameraId:r}})];case 5:return s.sent(),[3,7];case 6:return a=s.sent(),console.log("testTRTC error",JSON.stringify(a)),a.code,i.default.ERROR_CODE.OPERATION_ABORT,[3,7];case 7:this._currentCameraId=r,this._currentCamera=o,this.emitOnDeviceChange(r,t,e.TRTCDeviceState.TRTCDeviceStateActive),s.label=8;case 8:if(t!==e.TRTCDeviceType.TRTCDeviceTypeMic)return[3,16];s.label=9;case 9:return s.trys.push([9,11,,12]),[4,this._trtc.updateLocalAudio({option:{microphoneId:r}})];case 10:return s.sent(),[3,12];case 11:return c=s.sent(),console.log("error",JSON.stringify(c)),c.code,i.default.ERROR_CODE.OPERATION_ABORT,[3,12];case 12:return s.trys.push([12,14,,15]),[4,this._testTrtc.updateLocalAudio({option:{microphoneId:r}})];case 13:return s.sent(),[3,15];case 14:return u=s.sent(),console.log("testTRTC error",JSON.stringify(u)),u.code,i.default.ERROR_CODE.OPERATION_ABORT,[3,15];case 15:this._currentMicId=r,this._currentMicrophone=o,this.emitOnDeviceChange(r,t,e.TRTCDeviceState.TRTCDeviceStateActive),s.label=16;case 16:return t!==e.TRTCDeviceType.TRTCDeviceTypeSpeaker?[3,18]:[4,i.default.setCurrentSpeaker(r)];case 17:s.sent(),this._currentSpeakerId=r,this._currentSpeaker=o,this.emitOnDeviceChange(r,t,e.TRTCDeviceState.TRTCDeviceStateActive),s.label=18;case 18:return[2]}}))}))},o.prototype.emitOnDeviceChange=function(e,t,o){this.emit("onDeviceChange",e,t,o)},o}(_);e.Rect=x,e.TRTCDeviceInfo=g,e.TRTCImageBuffer=F,e.TRTCLocalStatistics=P,e.TRTCMixUser=j,e.TRTCNetworkQosParam=k,e.TRTCParams=y,e.TRTCPublishCDNParam=D,e.TRTCQualityInfo=I,e.TRTCRenderParams=M,e.TRTCScreenCaptureSourceInfo=N,e.TRTCStatistics=L,e.TRTCTranscodingConfig=B,e.TRTCVideoEncParam=S,e.TRTCVolumeInfo=E,e.default=de,Object.defineProperty(e,"__esModule",{value:!0})},"object"==typeof exports&&"undefined"!=typeof module?factory(exports,require("trtc-sdk-v5")):"function"==typeof define&&define.amd?define(["exports","trtc-sdk-v5"],factory):factory((global="undefined"!=typeof globalThis?globalThis:global||self).TRTCCloud={},global.TRTC); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
60227
1
218
- Removedaxios@^0.21.1
- Removedrtc-beauty-plugin@^0.0.5
- Removedaxios@0.21.4(transitive)
- Removedfollow-redirects@1.15.9(transitive)
- Removedrtc-beauty-plugin@0.0.5(transitive)