Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

trtc-cloud-js-sdk

Package Overview
Dependencies
Maintainers
1
Versions
155
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

trtc-cloud-js-sdk - npm Package Compare versions

Comparing version 2.2.6 to 2.2.7

2

package.json
{
"name": "trtc-cloud-js-sdk",
"version": "2.2.6",
"version": "2.2.7",
"description": "Tencent Cloud RTC SDK for Web And Electron",

@@ -5,0 +5,0 @@ "main": "trtc-cloud-js-sdk.js",

@@ -1,1 +0,1 @@

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

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc