trtc-cloud-js-sdk
Advanced tools
Comparing version 2.1.4-beta.0 to 2.1.4-beta.1
{ | ||
"name": "trtc-cloud-js-sdk", | ||
"version": "2.1.4-beta.0", | ||
"version": "2.1.4-beta.1", | ||
"description": "Tencent Cloud RTC SDK for Web And Electron", | ||
@@ -22,4 +22,4 @@ "main": "trtc-cloud-js-sdk.js", | ||
"rtc-beauty-plugin": "^0.0.5", | ||
"trtc-sdk-v5": "5.0.2" | ||
"trtc-sdk-v5": "5.1.0-beta.4" | ||
} | ||
} |
@@ -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 J,W="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"}(J||(J={}));var X,Z,$=function(e){return void 0===e},ee=function(e){return"boolean"==typeof e};function te(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 oe=-1e3,ie={code:-1001,message:"参数错误, 请检查参数格式、是否非空等"},re={code:-1005,message:"not supported"},ne="2.1.4-beta.0",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=T.default._loggerManager;ce.info("TRTCCloud Version: ".concat(ne));var ue="trtcCloud",le=1,de=function(t){function o(o){void 0===o&&(o={});var i=t.call(this)||this;i._version="",i._frameWorkType=30,i._component=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=ne;var r,n,a,s=o.frameWorkType,c=void 0===s?30:s,u=o.component,l=void 0===u?0:u;return i._trtc=T.default.create({frameWorkType:c,component:l}),i._testTrtc=T.default.create(),i._log=T.default._loggerManager,i.logger=new ae(ce,{seq:le++}),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 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.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(ue,".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},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(ie),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(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 R(this,void 0,void 0,(function(){var t;return f(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(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(ue,".setDefaultStreamRecvMode with param: "),{autoRecvAudio:e,autoRecvVideo:t}),ee(e)&&(this._autoRecvAudio=e),ee(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(ue,".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(ue,".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(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),R(this,void 0,void 0,(function(){var t;return f(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,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(ue,".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(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 R(this,void 0,void 0,(function(){var o;return f(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 R(this,void 0,void 0,(function(){var e;return f(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 R(this,void 0,void 0,(function(){var t,o;return f(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 R(this,void 0,void 0,(function(){var t,o;return f(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 R(this,void 0,void 0,(function(){var i;return f(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 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(ue,".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(ue," 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(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),R(this,void 0,void 0,(function(){var t;return f(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),R(this,void 0,void 0,(function(){var o;return f(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 R(this,void 0,Promise,(function(){var o;return f(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,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(ue,".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(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 R(this,void 0,Promise,(function(){var e;return f(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 R(this,void 0,Promise,(function(){var e,t;return f(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(ue,".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(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 R(this,void 0,void 0,(function(){var t;return f(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 R(this,void 0,Promise,(function(){var e,t;return f(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(ue,".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(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 R(this,void 0,Promise,(function(){var e,t;return f(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(ue,".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(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,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(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 R(this,void 0,void 0,(function(){return f(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 R(this,void 0,void 0,(function(){return f(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 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(ue,".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(ue,".stopMicDeviceTest")),[4,this._testTrtc.stopLocalAudio()];case 1:return e.sent(),[2]}}))}))},o.prototype.callExperimentalAPI=function(e){},o.prototype._unbindEvents=function(){},o.prototype._destroy=function(){this._unbindEvents()},o.prototype._emitError=function(e){e&&this.emit&&this.emit(W,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(W,e.getCode(),e.message),this._log.error("(".concat(t,") failed - ").concat(e.message))):(this.emit(W,oe,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++)te(this,new(0,o[t])(this))},i=o.prototype,r=0,n=e;r<n.length;r++){var a=n[r];te(o,a),te(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=de,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,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 J,W="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"}(J||(J={}));var X,Z,$=function(e){return void 0===e},ee=function(e){return"boolean"==typeof e};function te(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 oe=-1e3,ie={code:-1001,message:"参数错误, 请检查参数格式、是否非空等"},re={code:-1005,message:"not supported"},ne="2.1.4-beta.1",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=T.default._loggerManager;ce.info("TRTCCloud Version: ".concat(ne));var ue="trtcCloud",le=1,de=function(t){function o(o){void 0===o&&(o={});var i=t.call(this)||this;i._version="",i._frameWorkType=30,i._component=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=ne;var r,n,a,s=o.frameWorkType,c=void 0===s?30:s,u=o.component,l=void 0===u?0:u;return i._trtc=T.default.create({frameWorkType:c,component:l}),i._testTrtc=T.default.create(),i._log=T.default._loggerManager,i.logger=new ae(ce,{seq:le++}),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 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.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(ue,".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},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(ie),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(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 R(this,void 0,void 0,(function(){var t;return f(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(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(ue,".setDefaultStreamRecvMode with param: "),{autoRecvAudio:e,autoRecvVideo:t}),ee(e)&&(this._autoRecvAudio=e),ee(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(ue,".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(ue,".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(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),R(this,void 0,void 0,(function(){var t;return f(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,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(ue,".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(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 R(this,void 0,void 0,(function(){var o;return f(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 R(this,void 0,void 0,(function(){var e;return f(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 R(this,void 0,void 0,(function(){var t,o;return f(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 R(this,void 0,void 0,(function(){var t,o;return f(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 R(this,void 0,void 0,(function(){var i;return f(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 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(ue,".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(ue," 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(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),R(this,void 0,void 0,(function(){var t;return f(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),R(this,void 0,void 0,(function(){var o;return f(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 R(this,void 0,Promise,(function(){var o;return f(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,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(ue,".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(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 R(this,void 0,Promise,(function(){var e;return f(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 R(this,void 0,Promise,(function(){var e,t;return f(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(ue,".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(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 R(this,void 0,void 0,(function(){var t;return f(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 R(this,void 0,Promise,(function(){var e,t;return f(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(ue,".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(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 R(this,void 0,Promise,(function(){var e,t;return f(this,(function(o){switch(o.label){case 0:this.logger.info("".concat(ue,".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(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,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(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 R(this,void 0,void 0,(function(){return f(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 R(this,void 0,void 0,(function(){return f(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 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(ue,".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(ue,".stopMicDeviceTest")),[4,this._testTrtc.stopLocalAudio()];case 1:return e.sent(),[2]}}))}))},o.prototype.callExperimentalAPI=function(e){},o.prototype._unbindEvents=function(){},o.prototype._destroy=function(){this._unbindEvents()},o.prototype._emitError=function(e){e&&this.emit&&this.emit(W,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(W,e.getCode(),e.message),this._log.error("(".concat(t,") failed - ").concat(e.message))):(this.emit(W,oe,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++)te(this,new(0,o[t])(this))},i=o.prototype,r=0,n=e;r<n.length;r++){var a=n[r];te(o,a),te(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=de,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); |
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
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
57324
+ Addedtrtc-sdk-v5@5.1.0-beta.4(transitive)
- Removedtrtc-sdk-v5@5.0.2(transitive)
Updatedtrtc-sdk-v5@5.1.0-beta.4