trtc-cloud-js-sdk 2.0.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/package.json +7 -57
  2. package/trtc-cloud-js-sdk.js +1 -0
  3. package/.eslintrc.js +0 -88
  4. package/.prettierrc +0 -5
  5. package/CHANGELOG.md +0 -58
  6. package/build/jsdoc/clean-doc.js +0 -12
  7. package/build/jsdoc/fix-doc.js +0 -141
  8. package/build/jsdoc/jsdoc.json +0 -42
  9. package/build/package-bundle.js +0 -29
  10. package/build/rollup.config.dev.js +0 -88
  11. package/build/rollup.config.prod.js +0 -93
  12. package/build/rollup.js +0 -359
  13. package/build/template/npm-package/package.json +0 -24
  14. package/coverage/Chrome 103.0.5060 (Mac OS X 10.15.7)/base.css +0 -213
  15. package/coverage/Chrome 103.0.5060 (Mac OS X 10.15.7)/index.html +0 -80
  16. package/coverage/Chrome 103.0.5060 (Mac OS X 10.15.7)/prettify.css +0 -1
  17. package/coverage/Chrome 103.0.5060 (Mac OS X 10.15.7)/prettify.js +0 -1
  18. package/coverage/Chrome 103.0.5060 (Mac OS X 10.15.7)/sort-arrow-sprite.png +0 -0
  19. package/coverage/Chrome 103.0.5060 (Mac OS X 10.15.7)/sorter.js +0 -158
  20. package/examples/apiExample/.env +0 -2
  21. package/examples/apiExample/README.md +0 -70
  22. package/examples/apiExample/package-lock.json +0 -30915
  23. package/examples/apiExample/package.json +0 -51
  24. package/examples/apiExample/public/audio.js +0 -195
  25. package/examples/apiExample/public/audio.js.map +0 -7
  26. package/examples/apiExample/public/av_processing.js +0 -1
  27. package/examples/apiExample/public/basic/av_processing.wasm +0 -0
  28. package/examples/apiExample/public/basic/worker.js +0 -10434
  29. package/examples/apiExample/public/favicon.ico +0 -0
  30. package/examples/apiExample/public/index.html +0 -47
  31. package/examples/apiExample/public/logo192.png +0 -0
  32. package/examples/apiExample/public/logo512.png +0 -0
  33. package/examples/apiExample/public/manifest.json +0 -25
  34. package/examples/apiExample/public/robots.txt +0 -3
  35. package/examples/apiExample/src/App.css +0 -37
  36. package/examples/apiExample/src/App.js +0 -25
  37. package/examples/apiExample/src/api/http.js +0 -127
  38. package/examples/apiExample/src/api/nav.js +0 -44
  39. package/examples/apiExample/src/components/BasicInfoComponent.css +0 -16
  40. package/examples/apiExample/src/components/BasicInfoComponent.js +0 -27
  41. package/examples/apiExample/src/config/gen-test-user-sig.js +0 -64
  42. package/examples/apiExample/src/config/lib-generate-test-usersig.min.js +0 -7052
  43. package/examples/apiExample/src/config/nav.js +0 -136
  44. package/examples/apiExample/src/home.js +0 -16
  45. package/examples/apiExample/src/index.css +0 -21
  46. package/examples/apiExample/src/index.js +0 -12
  47. package/examples/apiExample/src/logo.svg +0 -1
  48. package/examples/apiExample/src/page/basic/screen-share/index.css +0 -52
  49. package/examples/apiExample/src/page/basic/screen-share/index.js +0 -223
  50. package/examples/apiExample/src/page/basic/setDevice/index.js +0 -262
  51. package/examples/apiExample/src/page/basic/setDevice/index.scss +0 -93
  52. package/examples/apiExample/src/page/basic/video-call/index.js +0 -521
  53. package/examples/apiExample/src/page/basic/video-call/index.scss +0 -93
  54. package/examples/apiExample/src/page/basic/video-call-init/index.js +0 -382
  55. package/examples/apiExample/src/page/basic/video-call-init/index.scss +0 -93
  56. package/examples/apiExample/src/page/basic/video-live/index.css +0 -37
  57. package/examples/apiExample/src/page/basic/video-live/index.js +0 -188
  58. package/examples/apiExample/src/page/layout.js +0 -22
  59. package/examples/apiExample/src/page/layout.scss +0 -76
  60. package/examples/apiExample/src/utils/utils.js +0 -35
  61. package/examples/jsExample/assets/css/bootstrap-material-design.css +0 -12169
  62. package/examples/jsExample/assets/css/bootstrap-material-design.min.css +0 -8
  63. package/examples/jsExample/assets/css/common.css +0 -48
  64. package/examples/jsExample/assets/icon/iconfont.js +0 -1
  65. package/examples/jsExample/assets/js/bootstrap-material-design.js +0 -6939
  66. package/examples/jsExample/assets/js/bootstrap-material-design.js.map +0 -1
  67. package/examples/jsExample/assets/js/bootstrap-material-design.min.js +0 -1
  68. package/examples/jsExample/assets/js/graph.js +0 -695
  69. package/examples/jsExample/assets/js/jquery-3.2.1.min.js +0 -4
  70. package/examples/jsExample/assets/js/jquery-3.2.1.slim.min.js +0 -4
  71. package/examples/jsExample/assets/js/lib-generate-test-usersig.min.js +0 -2
  72. package/examples/jsExample/assets/js/popper.js +0 -2442
  73. package/examples/jsExample/index.html +0 -57
  74. package/examples/jsExample/rtc/css/common.css +0 -82
  75. package/examples/jsExample/rtc/index.html +0 -107
  76. package/examples/jsExample/rtc/js/index.js +0 -142
  77. package/examples/vueDemo/LICENSE +0 -21
  78. package/examples/vueDemo/README.md +0 -144
  79. package/examples/vueDemo/README_EN.md +0 -136
  80. package/examples/vueDemo/av_processing.wasm +0 -0
  81. package/examples/vueDemo/index.html +0 -23
  82. package/examples/vueDemo/package-lock.json +0 -1375
  83. package/examples/vueDemo/package.json +0 -36
  84. package/examples/vueDemo/src/App.vue +0 -12
  85. package/examples/vueDemo/src/api/index.js +0 -59
  86. package/examples/vueDemo/src/assets/css/color-dark.css +0 -28
  87. package/examples/vueDemo/src/assets/css/icon.css +0 -4
  88. package/examples/vueDemo/src/assets/css/main.css +0 -177
  89. package/examples/vueDemo/src/assets/img/img.jpg +0 -0
  90. package/examples/vueDemo/src/assets/img/login-bg.jpg +0 -0
  91. package/examples/vueDemo/src/components/Header.vue +0 -172
  92. package/examples/vueDemo/src/components/Sidebar.vue +0 -117
  93. package/examples/vueDemo/src/components/Tags.vue +0 -174
  94. package/examples/vueDemo/src/components/tendency.vue +0 -206
  95. package/examples/vueDemo/src/components/trtc/main-menu.vue +0 -50
  96. package/examples/vueDemo/src/components/trtc/nav-bar.vue +0 -53
  97. package/examples/vueDemo/src/components/trtc/show-screen-capture.vue +0 -118
  98. package/examples/vueDemo/src/components/trtc/trtc-state-check.vue +0 -117
  99. package/examples/vueDemo/src/config/gen-test-user-sig.js +0 -67
  100. package/examples/vueDemo/src/config/lib-generate-test-usersig.min.js +0 -7052
  101. package/examples/vueDemo/src/main.js +0 -11
  102. package/examples/vueDemo/src/plugins/element.js +0 -17
  103. package/examples/vueDemo/src/router/index.js +0 -73
  104. package/examples/vueDemo/src/store/sidebar.js +0 -17
  105. package/examples/vueDemo/src/store/tags.js +0 -48
  106. package/examples/vueDemo/src/utils/i18n.js +0 -24
  107. package/examples/vueDemo/src/utils/request.js +0 -34
  108. package/examples/vueDemo/src/utils/utils.js +0 -35
  109. package/examples/vueDemo/src/views/Home.vue +0 -46
  110. package/examples/vueDemo/src/views/I18n.vue +0 -40
  111. package/examples/vueDemo/src/views/Icon.vue +0 -229
  112. package/examples/vueDemo/src/views/basic/trtc.vue +0 -194
  113. package/examples/vueDemo/src/views/feature/index.vue +0 -259
  114. package/examples/vueDemo/src/views/github/index.vue +0 -243
  115. package/examples/vueDemo/src/views/improve/live-index.vue +0 -256
  116. package/examples/vueDemo/src/views/improve/live-room-anchor.vue +0 -689
  117. package/examples/vueDemo/src/views/improve/live-room-audience.vue +0 -383
  118. package/examples/vueDemo/src/views/sdkAppId/index.vue +0 -284
  119. package/examples/vueDemo/vite.config.js +0 -18
  120. package/examples/vueDemo/worker.js +0 -22
  121. package/karma.conf.js +0 -99
  122. package/scripts/publish.js +0 -86
  123. package/src/Camera.ts +0 -80
  124. package/src/Mic.ts +0 -145
  125. package/src/common/IError.ts +0 -6
  126. package/src/common/ITRTCCloud.ts +0 -68
  127. package/src/common/constants.ts +0 -116
  128. package/src/common/trtc-code.ts +0 -43
  129. package/src/common/trtc-define.ts +0 -1007
  130. package/src/common/trtc-event.ts +0 -29
  131. package/src/index.ts +0 -1672
  132. package/src/utils/environment.js +0 -297
  133. package/src/utils/raf.js +0 -131
  134. package/src/utils/time.js +0 -22
  135. package/src/utils/utils.ts +0 -71
  136. package/src/utils/uuid.js +0 -12
  137. package/test/unit/env.test.js +0 -25
  138. package/test/unit/get-user-media.test.js +0 -40
  139. package/test/unit/ice-parser.test.js +0 -23
  140. package/test/unit/sdp.test.js +0 -45
  141. package/test/unit/signal.test.js +0 -78
  142. package/tsconfig.json +0 -32
  143. /package/{build/template/npm-package/README.md → README.md} +0 -0
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "trtc-cloud-js-sdk",
3
- "version": "2.0.0",
4
- "description": "Tencent Cloud RTC SDK for Web",
3
+ "version": "2.1.0",
4
+ "description": "Tencent Cloud RTC SDK for Web And Electron",
5
+ "main": "trtc-cloud-js-sdk.js",
5
6
  "keywords": [
6
7
  "实时音视频",
7
8
  "视频通话",
@@ -11,64 +12,13 @@
11
12
  ],
12
13
  "repository": {
13
14
  "type": "git",
14
- "url": ""
15
+ "url": "git@github.com:tencentyun/TRTCSDK.git"
15
16
  },
16
- "husky": {
17
- "hooks": {
18
- "pre-commit": "yarn run lint"
19
- }
20
- },
21
- "scripts": {
22
- "test": "karma start",
23
- "lint": "eslint src --ext .ts",
24
- "dev": "rollup -c build/rollup.config.dev.js -w",
25
- "docs": "tsc && yarn run docs:clean && yarn run docs:build:zh-cn",
26
- "docs:build:zh-cn": "./node_modules/.bin/jsdoc -c build/jsdoc/jsdoc.json -r && node ./build/jsdoc/fix-doc.js",
27
- "docs:clean": "node ./build/jsdoc/clean-doc.js",
28
- "tsc": "rm -fr ./build/ts2js && tsc",
29
- "prod": "rm -fr ./dist/**/*.js* && rollup -c build/rollup.config.prod.js && node ./build/package-bundle.js ",
30
- "script": "browserify ./dist/trtc-cloud.js -o ./dist/scriptJs/trtc-cloud-js-sdk.js && cp ./dist/scriptJs/trtc-cloud-js-sdk.js ./examples/jsExample/dist/trtc-cloud-js-sdk.js && rm ./dist/trtc-cloud.js",
31
- "zip": "cd ./cos && tar zcvf apiExample.zip ./apiExample && tar zcvf jsExample.zip ./jsExample && cd ../dist && tar zcvf npm-package.zip ./npm-package",
32
- "publish": "yarn run prod && yarn run script && yarn run docs && node ./scripts/publish.js && yarn run zip"
33
- },
34
- "author": "",
17
+ "author": "Tencent Cloud Client R&D Center",
35
18
  "license": "ISC",
36
- "devDependencies": {
37
- "@babel/core": "^7.21.4",
38
- "@babel/preset-env": "^7.21.4",
39
- "@typescript-eslint/parser": "^5.59.0",
40
- "docdash-blue": "^1.1.9",
41
- "eslint": "^8.38.0",
42
- "eslint-config-tencent": "^1.0.4",
43
- "husky": "^8.0.3",
44
- "jsdoc": "^4.0.2",
45
- "jsdoc-plugin-typescript": "^2.2.1",
46
- "karma": "^6.4.1",
47
- "karma-chrome-launcher": "^3.1.1",
48
- "karma-coverage": "^2.2.0",
49
- "karma-coverage-istanbul-reporter": "^3.0.3",
50
- "karma-jasmine": "^5.1.0",
51
- "karma-rollup-preprocessor": "^7.0.8",
52
- "lint-staged": "^13.2.1",
53
- "replace": "^1.2.2",
54
- "rollup-plugin-babel": "^4.4.0",
55
- "rollup-plugin-commonjs": "^10.1.0",
56
- "rollup-plugin-filesize": "^10.0.0",
57
- "rollup-plugin-json": "^4.0.0",
58
- "rollup-plugin-livereload": "^2.0.5",
59
- "rollup-plugin-node-globals": "^1.4.0",
60
- "rollup-plugin-node-resolve": "^5.2.0",
61
- "rollup-plugin-progress": "^1.1.2",
62
- "rollup-plugin-replace": "^2.2.0",
63
- "rollup-plugin-serve": "^2.0.2",
64
- "rollup-plugin-terser": "^7.0.2",
65
- "rollup-plugin-typescript": "^1.0.1"
66
- },
67
19
  "dependencies": {
68
20
  "axios": "^0.21.1",
69
- "rtc-beauty-plugin": "^0.0.6",
70
- "trtc-sdk-v5": "^5.0.0",
71
- "tslib": "^2.5.3",
72
- "typescript": "^4.6.2"
21
+ "rtc-beauty-plugin": "^0.0.5",
22
+ "trtc-sdk-v5": "^5.0.0"
73
23
  }
74
24
  }
@@ -0,0 +1 @@
1
+ var global,factory;global=this,factory=function(e,t,i){function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r,n,s,a,c,u,T,d,l=o(i),h=function(e,t){return h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},h(e,t)},p=function(){return p=Object.assign||function(e){for(var t,i=1,o=arguments.length;i<o;i++)for(var r in t=arguments[i])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},p.apply(this,arguments)};function R(e,t,i,o){return new(i||(i=Promise))((function(r,n){function s(e){try{c(o.next(e))}catch(t){n(t)}}function a(e){try{c(o.throw(e))}catch(t){n(t)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(s,a)}c((o=o.apply(e,t||[])).next())}))}function C(e,t){var i,o,r,n,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return n={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(n[Symbol.iterator]=function(){return this}),n;function a(n){return function(a){return function(n){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,o&&(r=2&n[0]?o.return:n[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,n[1])).done)return r;switch(o=0,r&&(n=[2&n[0],r.value]),n[0]){case 0:case 1:r=n;break;case 4:return s.label++,{value:n[1],done:!1};case 5:s.label++,o=n[1],n=[0];continue;case 7:n=s.ops.pop(),s.trys.pop();continue;default:if(!((r=(r=s.trys).length>0&&r[r.length-1])||6!==n[0]&&2!==n[0])){s=0;continue}if(3===n[0]&&(!r||n[1]>r[0]&&n[1]<r[3])){s.label=n[1];break}if(6===n[0]&&s.label<r[1]){s.label=r[1],r=n;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(n);break}r[2]&&s.ops.pop(),s.trys.pop();continue}n=t.call(e,s)}catch(a){n=[6,a],o=0}finally{i=r=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}([n,a])}}}function _(e,t,i){if(i||2===arguments.length)for(var o,r=0,n=t.length;r<n;r++)!o&&r in t||(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}e.TRTCVideoResolution=void 0,(r=e.TRTCVideoResolution||(e.TRTCVideoResolution={}))[r.TRTCVideoResolution_120_120=1]="TRTCVideoResolution_120_120",r[r.TRTCVideoResolution_160_160=3]="TRTCVideoResolution_160_160",r[r.TRTCVideoResolution_270_270=5]="TRTCVideoResolution_270_270",r[r.TRTCVideoResolution_480_480=7]="TRTCVideoResolution_480_480",r[r.TRTCVideoResolution_160_120=50]="TRTCVideoResolution_160_120",r[r.TRTCVideoResolution_240_180=52]="TRTCVideoResolution_240_180",r[r.TRTCVideoResolution_280_210=54]="TRTCVideoResolution_280_210",r[r.TRTCVideoResolution_320_240=56]="TRTCVideoResolution_320_240",r[r.TRTCVideoResolution_400_300=58]="TRTCVideoResolution_400_300",r[r.TRTCVideoResolution_480_360=60]="TRTCVideoResolution_480_360",r[r.TRTCVideoResolution_640_480=62]="TRTCVideoResolution_640_480",r[r.TRTCVideoResolution_960_720=64]="TRTCVideoResolution_960_720",r[r.TRTCVideoResolution_160_90=100]="TRTCVideoResolution_160_90",r[r.TRTCVideoResolution_256_144=102]="TRTCVideoResolution_256_144",r[r.TRTCVideoResolution_320_180=104]="TRTCVideoResolution_320_180",r[r.TRTCVideoResolution_480_270=106]="TRTCVideoResolution_480_270",r[r.TRTCVideoResolution_640_360=108]="TRTCVideoResolution_640_360",r[r.TRTCVideoResolution_960_540=110]="TRTCVideoResolution_960_540",r[r.TRTCVideoResolution_1280_720=112]="TRTCVideoResolution_1280_720",r[r.TRTCVideoResolution_1920_1080=114]="TRTCVideoResolution_1920_1080",e.TRTCVideoStreamType=void 0,(n=e.TRTCVideoStreamType||(e.TRTCVideoStreamType={}))[n.TRTCVideoStreamTypeBig=0]="TRTCVideoStreamTypeBig",n[n.TRTCVideoStreamTypeSmall=1]="TRTCVideoStreamTypeSmall",n[n.TRTCVideoStreamTypeSub=2]="TRTCVideoStreamTypeSub",e.TRTCVideoFillMode=void 0,(s=e.TRTCVideoFillMode||(e.TRTCVideoFillMode={}))[s.TRTCVideoFillMode_Fill=0]="TRTCVideoFillMode_Fill",s[s.TRTCVideoFillMode_Fit=1]="TRTCVideoFillMode_Fit",e.TRTCVideoMirrorType=void 0,(a=e.TRTCVideoMirrorType||(e.TRTCVideoMirrorType={}))[a.TRTCVideoMirrorType_Auto=0]="TRTCVideoMirrorType_Auto",a[a.TRTCVideoMirrorType_Enable=1]="TRTCVideoMirrorType_Enable",a[a.TRTCVideoMirrorType_Disable=2]="TRTCVideoMirrorType_Disable",e.TRTCBeautyStyle=void 0,(c=e.TRTCBeautyStyle||(e.TRTCBeautyStyle={}))[c.TRTCBeautyStyleSmooth=0]="TRTCBeautyStyleSmooth",c[c.TRTCBeautyStyleNature=1]="TRTCBeautyStyleNature",e.TRTCAppScene=void 0,(u=e.TRTCAppScene||(e.TRTCAppScene={}))[u.TRTCAppSceneVideoCall=0]="TRTCAppSceneVideoCall",u[u.TRTCAppSceneLIVE=1]="TRTCAppSceneLIVE",u[u.TRTCAppSceneAudioCall=2]="TRTCAppSceneAudioCall",u[u.TRTCAppSceneVoiceChatRoom=3]="TRTCAppSceneVoiceChatRoom",e.TRTCRoleType=void 0,(T=e.TRTCRoleType||(e.TRTCRoleType={}))[T.TRTCRoleAnchor=20]="TRTCRoleAnchor",T[T.TRTCRoleAudience=21]="TRTCRoleAudience",e.TRTCAudioQuality=void 0,(d=e.TRTCAudioQuality||(e.TRTCAudioQuality={}))[d.TRTCAudioQualityDefault=0]="TRTCAudioQualityDefault",d[d.TRTCAudioQualitySpeech=1]="TRTCAudioQualitySpeech",d[d.TRTCAudioQualityMusic=3]="TRTCAudioQualityMusic";var v,f,y=function(e,t,i,o,r){void 0===e&&(e=""),void 0===t&&(t=""),void 0===i&&(i=""),void 0===o&&(o=""),void 0===r&&(r=""),this.deviceId=e,this.deviceName=t,this.kind=i,this.label=o,this.groupId=r};e.TRTCDeviceState=void 0,(v=e.TRTCDeviceState||(e.TRTCDeviceState={}))[v.TRTCDeviceStateAdd=0]="TRTCDeviceStateAdd",v[v.TRTCDeviceStateRemove=1]="TRTCDeviceStateRemove",v[v.TRTCDeviceStateActive=2]="TRTCDeviceStateActive",e.TRTCDeviceType=void 0,(f=e.TRTCDeviceType||(e.TRTCDeviceType={}))[f.TRTCDeviceTypeUnknow=-1]="TRTCDeviceTypeUnknow",f[f.TRTCDeviceTypeMic=0]="TRTCDeviceTypeMic",f[f.TRTCDeviceTypeSpeaker=1]="TRTCDeviceTypeSpeaker",f[f.TRTCDeviceTypeCamera=2]="TRTCDeviceTypeCamera";var m,g=function(t,i,o,r,n,s,a,c,u,T,d){void 0===t&&(t=0),void 0===i&&(i=""),void 0===o&&(o=""),void 0===r&&(r=0),void 0===n&&(n=""),void 0===s&&(s=e.TRTCRoleType.TRTCRoleAnchor),void 0===a&&(a=null),void 0===u&&(u=null),void 0===T&&(T=null),void 0===d&&(d=30),this.sdkAppId=t,this.userId=i,this.userSig=o,this.roomId=r,this.strRoomId=n,this.role=s,this.privateMapKey=a,this.streamId=u,this.userDefineRecordId=T,this.frameWorkType=d},V=function(t,i,o){void 0===t&&(t=e.TRTCVideoResolution.TRTCVideoResolution_640_360),void 0===i&&(i=15),void 0===o&&(o=550),this.videoResolution=t,this.videoFps=i,this.videoBitrate=o};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 S,M=function(t,i,o){void 0===t&&(t=e.TRTCVideoRotation.TRTCVideoRotation0),void 0===i&&(i=e.TRTCVideoFillMode.TRTCVideoFillMode_Fit),void 0===o&&(o=e.TRTCVideoMirrorType.TRTCVideoMirrorType_Disable),this.rotation=t,this.fillMode=i,this.mirrorType=o};e.TRTCQuality=void 0,(S=e.TRTCQuality||(e.TRTCQuality={}))[S.TRTCQuality_Unknown=0]="TRTCQuality_Unknown",S[S.TRTCQuality_Excellent=1]="TRTCQuality_Excellent",S[S.TRTCQuality_Good=2]="TRTCQuality_Good",S[S.TRTCQuality_Poor=3]="TRTCQuality_Poor",S[S.TRTCQuality_Bad=4]="TRTCQuality_Bad",S[S.TRTCQuality_Vbad=5]="TRTCQuality_Vbad",S[S.TRTCQuality_Down=6]="TRTCQuality_Down";var A,I,E,b=function(t,i){void 0===t&&(t=""),void 0===i&&(i=e.TRTCQuality.TRTCQuality_Unknown),this.userId=t,this.quality=i},D=function(e,t){void 0===e&&(e=""),void 0===t&&(t=0),this.userId=e,this.volume=t},w=function(e,t,i){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=null),this.appId=e,this.bizId=t,this.url=i},P=function(t,i,o,r,n,s,a){void 0===t&&(t=0),void 0===i&&(i=0),void 0===o&&(o=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===s&&(s=0),void 0===a&&(a=e.TRTCVideoStreamType.TRTCVideoStreamTypeBig),this.width=t,this.height=i,this.frameRate=o,this.videoBitrate=r,this.audioSampleRate=n,this.audioBitrate=s,this.streamType=a},L=function(e,t,i,o,r,n,s,a,c,u){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),void 0===o&&(o=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===s&&(s=0),void 0===a&&(a=[]),void 0===c&&(c=0),void 0===u&&(u=0),this.upLoss=e,this.downLoss=t,this.appCpu=i,this.systemCpu=o,this.rtt=r,this.receivedBytes=n,this.sentBytes=s,this.localStatisticsArray=a,this.localStatisticsArraySize=c,this.remoteStatisticsArraySize=u};e.TRTCVideoResolutionMode=void 0,(A=e.TRTCVideoResolutionMode||(e.TRTCVideoResolutionMode={}))[A.TRTCVideoResolutionModeLandscape=0]="TRTCVideoResolutionModeLandscape",A[A.TRTCVideoResolutionModePortrait=1]="TRTCVideoResolutionModePortrait",e.TRTCVideoQosPreference=void 0,(I=e.TRTCVideoQosPreference||(e.TRTCVideoQosPreference={}))[I.TRTCVideoQosPreferenceSmooth=1]="TRTCVideoQosPreferenceSmooth",I[I.TRTCVideoQosPreferenceClear=2]="TRTCVideoQosPreferenceClear",e.TRTCQosControlMode=void 0,(E=e.TRTCQosControlMode||(e.TRTCQosControlMode={}))[E.TRTCQosControlModeClient=0]="TRTCQosControlModeClient",E[E.TRTCQosControlModeServer=1]="TRTCQosControlModeServer";var O,F=function(t,i){void 0===t&&(t=e.TRTCVideoQosPreference.TRTCVideoQosPreferenceClear),void 0===i&&(i=e.TRTCQosControlMode.TRTCQosControlModeServer),this.preference=t,this.controlMode=i},k=function(e,t,i,o){void 0===e&&(e=new ArrayBuffer(0)),void 0===t&&(t=0),void 0===i&&(i=0),void 0===o&&(o=0),this.buffer=e,this.length=t,this.width=i,this.height=o};e.TRTCScreenCaptureSourceType=void 0,(O=e.TRTCScreenCaptureSourceType||(e.TRTCScreenCaptureSourceType={}))[O.TRTCScreenCaptureSourceTypeUnknown=-1]="TRTCScreenCaptureSourceTypeUnknown",O[O.TRTCScreenCaptureSourceTypeWindow=0]="TRTCScreenCaptureSourceTypeWindow",O[O.TRTCScreenCaptureSourceTypeScreen=1]="TRTCScreenCaptureSourceTypeScreen",O[O.TRTCScreenCaptureSourceTypeCustom=2]="TRTCScreenCaptureSourceTypeCustom";var Q,N=function(t,i,o,r,n,s){void 0===t&&(t=e.TRTCScreenCaptureSourceType.TRTCScreenCaptureSourceTypeUnknown),void 0===i&&(i=""),void 0===o&&(o=""),void 0===r&&(r=new k),void 0===n&&(n=new k),void 0===s&&(s=!1),this.type=t,this.sourceId=i,this.sourceName=o,this.thumbBGRA=r,this.iconBGRA=n,this.isMinimizeWindow=s},B=function(e,t,i,o){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),void 0===o&&(o=0),this.left=e,this.top=t,this.right=i,this.bottom=o},U=function(t,i,o,r,n,s,a,c,u,T,d,l,h,p,R){void 0===t&&(t=e.TRTCTranscodingConfigMode.TRTCTranscodingConfigMode_Unknown),void 0===i&&(i=0),void 0===o&&(o=0),void 0===r&&(r=0),void 0===n&&(n=0),void 0===s&&(s=0),void 0===a&&(a=15),void 0===c&&(c=2),void 0===u&&(u=0),void 0===T&&(T=""),void 0===d&&(d=64),void 0===l&&(l=48e3),void 0===h&&(h=1),void 0===p&&(p=[]),void 0===R&&(R=""),this.mode=t,this.appId=i,this.bizId=o,this.videoWidth=r,this.videoHeight=n,this.videoBitrate=s,this.videoFramerate=a,this.videoGOP=c,this.backgroundColor=u,this.backgroundImage=T,this.audioSampleRate=d,this.audioBitrate=l,this.audioChannels=h,this.mixUsersArray=p,this.mixUsersArraySize=p.length,this.streamId=R};e.TRTCTranscodingConfigMode=void 0,(Q=e.TRTCTranscodingConfigMode||(e.TRTCTranscodingConfigMode={}))[Q.TRTCTranscodingConfigMode_Unknown=0]="TRTCTranscodingConfigMode_Unknown",Q[Q.TRTCTranscodingConfigMode_Manual=1]="TRTCTranscodingConfigMode_Manual",Q[Q.TRTCTranscodingConfigMode_Template_PureAudio=2]="TRTCTranscodingConfigMode_Template_PureAudio",Q[Q.TRTCTranscodingConfigMode_Template_PresetLayout=3]="TRTCTranscodingConfigMode_Template_PresetLayout",Q[Q.TRTCTranscodingConfigMode_Template_ScreenSharing=4]="TRTCTranscodingConfigMode_Template_ScreenSharing",Q[Q.TRTC_TranscodingConfigMode_Unknown=5]="TRTC_TranscodingConfigMode_Unknown",Q[Q.TRTC_TranscodingConfigMode_Manual=6]="TRTC_TranscodingConfigMode_Manual",Q[Q.TRTC_TranscodingConfigMode_Template_PureAudio=7]="TRTC_TranscodingConfigMode_Template_PureAudio",Q[Q.TRTC_TranscodingConfigMode_Template_PresetLayout=8]="TRTC_TranscodingConfigMode_Template_PresetLayout",Q[Q.TRTC_TranscodingConfigMode_Template_ScreenSharing=9]="TRTC_TranscodingConfigMode_Template_ScreenSharing";var x,j=function(t,i,o,r,n,s,a,c){void 0===t&&(t=""),void 0===i&&(i=""),void 0===o&&(o=null),void 0===r&&(r=0),void 0===n&&(n=!1),void 0===s&&(s=e.TRTCVideoStreamType.TRTCVideoStreamTypeBig),void 0===a&&(a=e.TRTCMixInputType.TRTCMixInputTypeUndefined),void 0===c&&(c=0),this.userId=t,this.roomId=i,this.rect=o,this.zOrder=r,this.pureAudio=n,this.streamType=s,this.inputType=a,this.renderMode=c};e.TRTCMixInputType=void 0,(x=e.TRTCMixInputType||(e.TRTCMixInputType={}))[x.TRTCMixInputTypeUndefined=0]="TRTCMixInputTypeUndefined",x[x.TRTCMixInputTypeAudioVideo=1]="TRTCMixInputTypeAudioVideo",x[x.TRTCMixInputTypePureVideo=2]="TRTCMixInputTypePureVideo",x[x.TRTCMixInputTypePureAudio=3]="TRTCMixInputTypePureAudio";var W,Y="onError",G="rtc",K="live",z={20:"anchor",21:"audience"},H={0:G,1:K,2:G,3:K},J={0:"standard",1:"high",2:"standard_stereo",3:"high_stereo"};function q(){return Math.floor(performance.now())}!function(e){e[e.ActiveExitRoom=0]="ActiveExitRoom",e[e.KickedExitRoom=1]="KickedExitRoom"}(W||(W={}));var X,Z,$=function(e){return void 0===e};function ee(e,t){for(var i=0,o=Reflect.ownKeys(t);i<o.length;i++){var r=o[i];if("constructor"!==r&&"prototype"!==r&&"name"!==r){var n=Object.getOwnPropertyDescriptor(t,r)||"";Object.defineProperty(e,r,n)}}}!function(e){e.LIVE="live",e.RTC="rtc"}(X||(X={})),function(e){e.CONTAIN="contain",e.COVER="cover",e.FILL="fill"}(Z||(Z={}));var te=-1e3,ie={code:-1001,message:"参数错误, 请检查参数格式、是否非空等"},oe={code:-1005,message:"not supported"},re="2.1.0",ne=null,se="【TRTCCloud】";l.default._loggerManager.info("TRTCCloud Version: ".concat(re));var ae=function(t){function i(i){void 0===i&&(i={});var o=t.call(this)||this;o._version="",o._frameWorkType=30,o._component=0,o._localView=null,o._localTestView=null,o._isVideoPublish=!0,o._localRenderParams={rotation:e.TRTCVideoRotation.TRTCVideoRotation0,fillMode:e.TRTCVideoFillMode.TRTCVideoFillMode_Fill,mirrorType:e.TRTCVideoMirrorType.TRTCVideoMirrorType_Auto},o._videoProfile={},o._videoPlayOption={},o._isAudioPublish=!0,o._audioProfile=Object.keys(J)[0],o._isSharingScreen=!1,o._remoteStreamConfig=new Map,o._remoteStreamMap=new Map,o._cameraList=[],o._microphoneList=[],o._speakerList=[],o._currentCamera={},o._currentMicrophone={},o._currentSpeaker={},o._currentCameraId="",o._currentMicrophoneId="",o._currentSpeakerId="",o._screenShareParams={option:{}},o._isMobile=!1,o._isFrontCamera=!1,o._defaultVideoProfile={width:640,height:480,frameRate:15,bitrate:900},o._defaultScreenProfile={width:1920,height:1080,frameRate:15,bitrate:1500},o._version=re;var r,n,s,a=i.frameWorkType,c=void 0===a?30:a,u=i.component,T=void 0===u?0:u;return o._trtc=l.default.create({frameWorkType:c,component:T}),o._testTrtc=l.default.create(),o._log=l.default._loggerManager,o._addTRTCEvents(),o.handleDeviceChange=o.handleDeviceChange.bind(o),navigator&&navigator.mediaDevices&&navigator.mediaDevices.addEventListener("devicechange",(r=o.handleDeviceChange,n=30,function(){for(var e=this,t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];s>0&&clearTimeout(s),s=window.setTimeout((function(){r.apply(e,t),s=-1}),n)})),o}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 i(){this.constructor=e}h(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}(i,t),i.getTRTCShareInstance=function(e){return ne||(ne=new i(e)),ne},i.prototype.destroyTRTCShareInstance=function(){ne&&(this._removeTRTCEvents(),ne._destroy(),ne=null)},i.prototype.getSDKVersion=function(){return this._version||""},i.prototype.off=function(e,t){void 0===t&&(t=function(){});try{"*"===e?this.removeAllListeners():this.removeListener(e,t)}catch(i){console.log("off error ",i)}},i.prototype.enterRoom=function(e,t){return R(this,void 0,Promise,(function(){var i,o,r,n,s,a,c,u,T,d,l,h,R,_,v,f;return C(this,(function(C){switch(C.label){case 0:if(i=e.sdkAppId,o=e.userId,r=e.userSig,n=e.roomId,s=e.strRoomId,a=e.role,c=e.privateMapKey,u=e.businessInfo,T=e.enableAutoPlayDialog,d=e.proxy,l=e.streamId,h=e.userDefineRecordId,!(i&&o&&r))return[3,5];C.label=1;case 1:return C.trys.push([1,3,,4]),R={sdkAppId:i,userId:o,userSig:r,roomId:n||s,role:z[a],scene:H[t],frameWorkType:this._frameWorkType,component:this._component},R=c?p(p({},R),{privateMapKey:c}):R,R=u?p(p({},R),{businessInfo:u}):R,R=T?p(p({},R),{enableAutoPlayDialog:T}):R,R=d?p(p({},R),{proxy:d}):R,R=l?p(p({},R),{streamId:l}):R,R=h?p(p({},R),{userDefineRecordId:h}):R,_=q(),[4,this._trtc.enterRoom(R)];case 2:return C.sent(),v=q()-_,this.emit("onEnterRoom",v),[3,4];case 3:return f=C.sent(),this.emit("onEnterRoom",-1),this._callFunctionErrorManage(f,"enterRoom"),[3,4];case 4:return[3,6];case 5:this._emitError(ie),C.label=6;case 6:return[2]}}))}))},i.prototype.exitRoom=function(){return R(this,void 0,Promise,(function(){var e;return C(this,(function(t){switch(t.label){case 0:return t.trys.push([0,4,,5]),console.warn("".concat(se," 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]}}))}))},i.prototype.switchRole=function(e){return R(this,void 0,void 0,(function(){var t;return C(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this._trtc.switchRole(z[e])];case 1:return i.sent(),this.emit("onSwitchRole",0,"switch role success, role = ".concat(e,", ").concat(z[e])),[3,3];case 2:return t=i.sent(),this.emit("onSwitchRole",null==t?void 0:t.getCode(),t.message),[3,3];case 3:return[2]}}))}))},i.prototype._updateLocalVideo=function(){return R(this,void 0,void 0,(function(){var e;return C(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===l.default.ERROR_CODE.OPERATION_ABORT)return[2];throw e;case 3:return[2]}}))}))},i.prototype._updateLocalTestVideo=function(){return R(this,void 0,void 0,(function(){var e;return C(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===l.default.ERROR_CODE.OPERATION_ABORT)return[2];throw e;case 3:return[2]}}))}))},i.prototype._updateRemoteVideo=function(e,t){return R(this,void 0,void 0,(function(){var i;return C(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this._trtc.updateRemoteVideo(this._generateRemoteVideoData(e,t))];case 1:return o.sent(),[3,3];case 2:if((i=o.sent()).code===l.default.ERROR_CODE.OPERATION_ABORT)return[2];throw i;case 3:return[2]}}))}))},i.prototype.startLocalPreview=function(){for(var t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return R(this,void 0,Promise,(function(){var i,o,r,n,s;return C(this,(function(a){switch(a.label){case 0:this._log.info("(startLocalPreview) start - start local preview with params: [".concat(t,"]")),1===_([],t,!0).length?o=_([],t,!0)[0]:2===_([],t,!0).length&&(s=_([],t,!0),i=s[0],o=s[1]),$(i)||(this._setIsMobile(!0),this._setIsFrontCamera(i)),this._setLocalView(o),a.label=1;case 1:a.trys.push([1,8,,9]),a.label=2;case 2:return a.trys.push([2,4,,7]),[4,this._trtc.startLocalVideo(this._generateLocalVideoData())];case 3:return a.sent(),[3,7];case 4:return(r=a.sent()).code!==l.default.ERROR_CODE.OPERATION_ABORT?[3,6]:[4,this._updateLocalVideo()];case 5:return a.sent(),[2];case 6:throw r;case 7:return this.emit("onCameraDidReady"),this.emit("onFirstVideoFrame",{userId:"",streamType:e.TRTCVideoStreamType.TRTCVideoStreamTypeBig,width:this._getVideoProfile().width,height:this._getVideoProfile().height}),[3,9];case 8:return n=a.sent(),this._callFunctionErrorManage(n,"startLocalPreview"),[3,9];case 9:return[2]}}))}))},i.prototype.updateLocalView=function(e){return R(this,void 0,void 0,(function(){return C(this,(function(t){switch(t.label){case 0:return this._setLocalView(e),[4,this._updateLocalVideo()];case 1:return t.sent(),[2]}}))}))},i.prototype.stopLocalPreview=function(){return R(this,void 0,void 0,(function(){var e;return C(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),this._setLocalView(null),[4,this._trtc.stopLocalVideo()];case 1:return t.sent(),[3,3];case 2:return e=t.sent(),console.warn("".concat(se," stopLocalPreview error: ").concat(e)),this._callFunctionErrorManage(e,"stopLocalPreview"),[3,3];case 3:return[2]}}))}))},i.prototype.muteLocalVideo=function(e){return void 0===e&&(e=!1),R(this,void 0,void 0,(function(){var t;return C(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),this._setIsVideoPublish(!e),[4,this._updateLocalVideo()];case 1:return i.sent(),[3,3];case 2:return t=i.sent(),this._callFunctionErrorManage(t,"muteLocalVideo"),[3,3];case 3:return[2]}}))}))},i.prototype.startRemoteView=function(e,t,i){return R(this,void 0,void 0,(function(){var o,r;return C(this,(function(n){switch(n.label){case 0:if(n.trys.push([0,7,,8]),this._setRemoteStreamConfig(e,i,{view:t}),!this._remoteStreamMap.get("".concat(e,"_").concat(this._getTRTCStreamType(i))))return[2];n.label=1;case 1:return n.trys.push([1,3,,6]),[4,this._trtc.startRemoteVideo(this._generateRemoteVideoData(e,i))];case 2:return n.sent(),[3,6];case 3:return(o=n.sent()).code!==l.default.ERROR_CODE.OPERATION_ABORT?[3,5]:[4,this._updateRemoteVideo(e,i)];case 4:return n.sent(),[2];case 5:throw o;case 6:return[3,8];case 7:return r=n.sent(),this._callFunctionErrorManage(r,"startRemoteView"),[3,8];case 8:return[2]}}))}))},i.prototype.updateRemoteView=function(e,t,i){return R(this,void 0,void 0,(function(){return C(this,(function(o){switch(o.label){case 0:return this._setRemoteStreamConfig(e,i,{view:t}),[4,this._updateRemoteVideo(e,i)];case 1:return o.sent(),[2]}}))}))},i.prototype.stopRemoteView=function(e,t){return R(this,void 0,void 0,(function(){var i;return C(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this._trtc.stopRemoteVideo({userId:e,streamType:this._getTRTCStreamType(t)})];case 1:return o.sent(),[3,3];case 2:return i=o.sent(),this._callFunctionErrorManage(i,"stopRemoteView"),[3,3];case 3:return[2]}}))}))},i.prototype.stopAllRemoteView=function(){return R(this,void 0,void 0,(function(){var e;return C(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this._trtc.stopRemoteVideo({userId:"*"})];case 1:return t.sent(),[3,3];case 2:return e=t.sent(),this._callFunctionErrorManage(e,"stopAllRemoteView"),[3,3];case 3:return[2]}}))}))},i.prototype.setVideoEncoderParam=function(e){return R(this,void 0,void 0,(function(){var t,i;return C(this,(function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),t=this._getTRTCVideoProfile("video",e),this._setVideoProfile(t),[4,this._updateLocalVideo()];case 1:return o.sent(),[4,this._updateLocalTestVideo()];case 2:return o.sent(),[3,4];case 3:return i=o.sent(),this._callFunctionErrorManage(i,"setVideoEncoderParam"),[3,4];case 4:return[2]}}))}))},i.prototype.setLocalRenderParams=function(e){return R(this,void 0,void 0,(function(){var t,i;return C(this,(function(o){switch(o.label){case 0:Object.assign(this._localRenderParams,e),o.label=1;case 1:return o.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 o.sent(),[4,this._updateLocalTestVideo()];case 3:return o.sent(),[3,5];case 4:return i=o.sent(),this._callFunctionErrorManage(i,"setLocalRenderParams"),[3,5];case 5:return[2]}}))}))},i.prototype.setRemoteRenderParams=function(e,t,i){return R(this,void 0,void 0,(function(){var o;return C(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),this._setRemoteStreamConfig(e,t,i),[4,this._updateRemoteVideo(e,t)];case 1:return r.sent(),[3,3];case 2:return o=r.sent(),this._callFunctionErrorManage(o,"setRemoteRenderParams"),[3,3];case 3:return[2]}}))}))},i.prototype._updateLocalAudio=function(){return R(this,void 0,void 0,(function(){var e;return C(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===l.default.ERROR_CODE.OPERATION_ABORT)return[2];throw e;case 3:return[2]}}))}))},i.prototype.startLocalAudio=function(t){return void 0===t&&(t=e.TRTCAudioQuality.TRTCAudioQualityDefault),R(this,void 0,void 0,(function(){var e,i;return C(this,(function(o){switch(o.label){case 0:o.trys.push([0,7,,8]),this._setAudioProfile(J[t]),o.label=1;case 1:return o.trys.push([1,3,,6]),[4,this._trtc.startLocalAudio(this._generateLocalAudioData())];case 2:return o.sent(),[3,6];case 3:return(e=o.sent()).code!==l.default.ERROR_CODE.OPERATION_ABORT?[3,5]:[4,this._updateLocalAudio()];case 4:return o.sent(),[2];case 5:throw e;case 6:return this.emit("onMicDidReady"),[3,8];case 7:return i=o.sent(),console.warn("".concat(se," startLocalAudio error: ").concat(i)),this._callFunctionErrorManage(i,"startLocalAudio"),[3,8];case 8:return[2]}}))}))},i.prototype.stopLocalAudio=function(){return R(this,void 0,void 0,(function(){var e;return C(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this._trtc.stopLocalAudio()];case 1:return t.sent(),[3,3];case 2:return e=t.sent(),this._callFunctionErrorManage(e,"stopLocalAudio"),[3,3];case 3:return[2]}}))}))},i.prototype.muteLocalAudio=function(e){return void 0===e&&(e=!1),R(this,void 0,void 0,(function(){var t;return C(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),this._setIsAudioPublish(!e),[4,this._updateLocalAudio()];case 1:return i.sent(),[3,3];case 2:return t=i.sent(),this._callFunctionErrorManage(t,"muteLocalAudio"),[3,3];case 3:return[2]}}))}))},i.prototype.muteRemoteAudio=function(e,t){return void 0===t&&(t=!1),R(this,void 0,void 0,(function(){var i;return C(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),e?[4,this._trtc.muteRemoteAudio(e,t)]:(this._emitError(ie),[2]);case 1:return o.sent(),[3,3];case 2:return i=o.sent(),this._callFunctionErrorManage(i,"muteRemoteAudio"),[3,3];case 3:return[2]}}))}))},i.prototype.muteAllRemoteAudio=function(e){try{this._trtc.muteRemoteAudio("*",e)}catch(t){this._callFunctionErrorManage(t,"muteAllRemoteAudio")}},i.prototype.setRemoteAudioVolume=function(e,t){try{this._trtc.setRemoteAudioVolume(e,t)}catch(i){this._callFunctionErrorManage(i,"setRemoteAudioVolume")}},i.prototype.enableAudioVolumeEvaluation=function(e){try{this._trtc.enableAudioVolumeEvaluation(e)}catch(t){this._callFunctionErrorManage(t,"enableAudioVolumeEvaluation")}},i.prototype.startScreenShare=function(t,i,o){return R(this,void 0,void 0,(function(){var i,r,n,s;return C(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),i=(o||{}).screenAudio,r=void 0!==i&&i,n=this._getTRTCVideoProfile("screen",o),this._setScreenShareParams({view:t,profile:n,systemAudio:r}),[4,this._trtc.startScreenShare(this._getScreenShareParams())];case 1:return a.sent(),this._isSharingScreen=!0,this.emit("onFirstVideoFrame",{userId:"",streamType:e.TRTCVideoStreamType.TRTCVideoStreamTypeSub,width:n.width,height:n.height}),[3,3];case 2:if((s=a.sent()).code===l.default.ERROR_CODE.OPERATION_ABORT)return[2];throw console.error("Start share screen error:",s,s.code,s.name,s.message),s;case 3:return[2]}}))}))},i.prototype.setSubStreamEncoderParam=function(e){return R(this,void 0,void 0,(function(){var t,i;return C(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),t=this._getTRTCVideoProfile("screen",e),this._setScreenShareParams({profile:t}),[4,this._trtc.updateScreenShare(this._getScreenShareParams())];case 1:return o.sent(),[3,3];case 2:return i=o.sent(),this._callFunctionErrorManage(i,"setSubStreamEncoderParam"),[3,3];case 3:return[2]}}))}))},i.prototype.stopScreenShare=function(){return R(this,void 0,Promise,(function(){var e;return C(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this._trtc.stopScreenShare()];case 1:return t.sent(),this._isSharingScreen=!1,this.emit("onScreenCaptureStopped",{reason:0}),[3,3];case 2:return e=t.sent(),this._callFunctionErrorManage(e,"stopScreenShare"),[3,3];case 3:return[2]}}))}))},i.prototype.startScreenCapture=function(){this.emitError(oe)},i.prototype.pauseScreenCapture=function(){this.emitError(oe)},i.prototype.resumeScreenCapture=function(){this.emitError(oe)},i.prototype.getScreenCaptureSources=function(){this.emitError(oe)},i.prototype.selectScreenCaptureTarget=function(){this.emitError(oe)},i.prototype.getCameraDevicesList=function(){return R(this,void 0,Promise,(function(){var e,t;return C(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,l.default.getCameraList()];case 1:return e=(e=i.sent()).map((function(e){return p(p({},e),{deviceName:e.label})})),this._cameraList=e,this._currentCamera=this.getDefaultDeviceInfo(e),this._currentCameraId=this._currentCamera.deviceId,[2,Promise.resolve(e)];case 2:return t=i.sent(),this._callFunctionErrorManage(t,"getCameraDevicesList"),[2,Promise.resolve([])];case 3:return[2]}}))}))},i.prototype.setCurrentCameraDevice=function(e){return R(this,void 0,Promise,(function(){var t;return C(this,(function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),e?(this._currentCameraId=e,this._currentCamera=this._cameraList.filter((function(t){return t.deviceId===e})),[4,this._updateLocalVideo()]):[2,!1];case 1:return i.sent(),[4,this._updateLocalTestVideo()];case 2:return i.sent(),[2,!0];case 3:return t=i.sent(),this._callFunctionErrorManage(t,"setCurrentCameraDevice"),[2,!1];case 4:return[2]}}))}))},i.prototype.getCurrentCameraDevice=function(){return new y},i.prototype.isFrontCamera=function(){return this._getIsFrontCamera()},i.prototype.switchCamera=function(e){return R(this,void 0,void 0,(function(){var t;return C(this,(function(i){switch(i.label){case 0:return this._setIsFrontCamera(e),(t=this._getVideoPlayOption()).mirror=this._getTRTCMirror(this._localRenderParams.mirrorType),this._setVideoPlayOption(t),[4,this._updateLocalVideo()];case 1:return i.sent(),[2]}}))}))},i.prototype.getMicDevicesList=function(){return R(this,void 0,Promise,(function(){var e,t;return C(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,l.default.getMicrophoneList()];case 1:return e=(e=i.sent()).map((function(e){return p(p({},e),{deviceName:e.label})})),this._microphoneList=e,this._currentMicrophone=this.getDefaultDeviceInfo(e),this._currentMicrophoneId=this._currentMicrophone.deviceId,[2,Promise.resolve(e)];case 2:return t=i.sent(),this._callFunctionErrorManage(t,"getMicDevicesList"),[2,Promise.resolve([])];case 3:return[2]}}))}))},i.prototype.setCurrentMicDevice=function(e){return R(this,void 0,Promise,(function(){var t;return C(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),e?(this._setCurrentMicrophoneId(e),this._currentMicrophone=this._microphoneList.filter((function(t){return t.deviceId===e})),[4,this._trtc.updateLocalAudio(this._generateLocalAudioData())]):[2,!1];case 1:return i.sent(),[2,!0];case 2:return t=i.sent(),this._callFunctionErrorManage(t,"setCurrentMicDevice"),[2,!1];case 3:return[2]}}))}))},i.prototype.getCurrentMicDevice=function(){return new y},i.prototype.getSpeakerDevicesList=function(){return R(this,void 0,Promise,(function(){var e,t;return C(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,l.default.getSpeakerList()];case 1:return e=(e=i.sent()).map((function(e){return p(p({},e),{deviceName:e.label})})),this._speakerList=e,this._currentSpeaker=this.getDefaultDeviceInfo(e),this._currentSpeakerId=this._currentSpeaker.deviceId,[2,Promise.resolve(e)];case 2:return t=i.sent(),this._callFunctionErrorManage(t,"getSpeakerDevicesList"),[2,Promise.resolve([])];case 3:return[2]}}))}))},i.prototype.setCurrentSpeakerDevice=function(e){return R(this,void 0,Promise,(function(){var t;return C(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),e?(this._setCurrentSpeakerId(e),this._currentSpeaker=this._speakerList.filter((function(t){return t.deviceId===e})),[4,l.default.setCurrentSpeaker(e)]):[2,!1];case 1:return i.sent(),[2,!0];case 2:return t=i.sent(),this._callFunctionErrorManage(t,"setCurrentSpeakerDevice"),[2,!1];case 3:return[2]}}))}))},i.prototype.getCurrentSpeakerDevice=function(){return new y},i.prototype.startCameraDeviceTest=function(e){return R(this,void 0,void 0,(function(){return C(this,(function(t){switch(t.label){case 0:return this._log.info("(startCameraDeviceTest) start - start test camera Device",e),e?(this._setLocalTestView(e),[4,this._testTrtc.startLocalVideo(this._generateLocalTestVideoData())]):[2];case 1:return t.sent(),[2]}}))}))},i.prototype.stopCameraDeviceTest=function(){return R(this,void 0,void 0,(function(){return C(this,(function(e){switch(e.label){case 0:return this._setLocalTestView(null),[4,this._testTrtc.stopLocalVideo()];case 1:return e.sent(),[2]}}))}))},i.prototype.startMicDeviceTest=function(t){return R(this,void 0,void 0,(function(){var i=this;return C(this,(function(o){switch(o.label){case 0:return this._log.info("(startMicDeviceTest) start - start test mic Device",t),[4,this._testTrtc.startLocalAudio({publish:!1,option:{microphoneId:this._currentMicrophoneId,profile:J[e.TRTCAudioQuality.TRTCAudioQualityDefault]}})];case 1:return o.sent(),this._testTrtc.on(l.default.EVENT.AUDIO_VOLUME,(function(e){null==e||e.result.forEach((function(e){var t=e.userId,o=e.volume;""===t&&i.emit("onTestMicVolume",o)}))})),[4,this._testTrtc.enableAudioVolumeEvaluation(t)];case 2:return o.sent(),[2]}}))}))},i.prototype.stopMicDeviceTest=function(){this._log.info("(stopMicDeviceTest) stop - stop test mic Device"),this._testTrtc.stopLocalAudio()},i.prototype._unbindEvents=function(){},i.prototype._destroy=function(){this._unbindEvents()},i.prototype._emitError=function(e){e&&this.emit&&this.emit(Y,e.code,e.message)},i.prototype._callFunctionErrorManage=function(e,t){e&&e.code===l.default.ERROR_CODE.OPERATION_ABORT||(e&&e.getCode&&e.getCode()?(this.emit(Y,e.getCode(),e.message),this._log.error("(".concat(t,") failed - ").concat(e.message))):(this.emit(Y,te,e.message),this._log.error("(".concat(t,") failed - ").concat(e.message))))},i.prototype._getTRTCResolution=function(t){var i=(e.TRTCVideoResolution[t]||"").split("_");return{width:+(i.length>1&&i[1]),height:+(i.length>2&&i[2])}},i.prototype._getTRTCVideoProfile=function(e,t){var i=t.videoResolution,o=t.videoFps,r=t.videoBitrate,n="screen"===e?this._defaultScreenProfile:this._defaultVideoProfile;if(i){var s=this._getTRTCResolution(i);n.width=s.width,n.height=s.height}return o&&(n.frameRate=o),r&&(n.bitrate=r),n},i.prototype._getTRTCStreamType=function(t){var i;return((i={})[e.TRTCVideoStreamType.TRTCVideoStreamTypeBig]=l.default.TYPE.STREAM_TYPE_MAIN,i[e.TRTCVideoStreamType.TRTCVideoStreamTypeSmall]=l.default.TYPE.STREAM_TYPE_MAIN,i[e.TRTCVideoStreamType.TRTCVideoStreamTypeSub]=l.default.TYPE.STREAM_TYPE_SUB,i)[t]},i.prototype._getTRTCFillMode=function(t){var i;return((i={})[e.TRTCVideoFillMode.TRTCVideoFillMode_Fill]=Z.COVER,i[e.TRTCVideoFillMode.TRTCVideoFillMode_Fit]=Z.CONTAIN,i)[t]},i.prototype._getTRTCMirror=function(t){var i;return t===e.TRTCVideoMirrorType.TRTCVideoMirrorType_Auto?!this._getIsMobile()||this._getIsFrontCamera():((i={})[e.TRTCVideoMirrorType.TRTCVideoMirrorType_Enable]=!0,i[e.TRTCVideoMirrorType.TRTCVideoMirrorType_Disable]=!1,i)[t]},i.prototype._getTRTCCloudDeviceType=function(t){return{camera:e.TRTCDeviceType.TRTCDeviceTypeCamera,microphone:e.TRTCDeviceType.TRTCDeviceTypeMic,speaker:e.TRTCDeviceType.TRTCDeviceTypeSpeaker}[t]},i.prototype._getTRTCCloudDeviceState=function(t){return{add:e.TRTCDeviceState.TRTCDeviceStateAdd,remove:e.TRTCDeviceState.TRTCDeviceStateRemove,active:e.TRTCDeviceState.TRTCDeviceStateActive}[t]},i.prototype._generateLocalVideoData=function(){var e={view:this._getLocalView(),publish:this._getIsVideoPublish(),option:p({profile:this._getVideoProfile()},this._getVideoPlayOption())};return this._getIsMobile()?e&&Object.assign(e.option,{useFrontCamera:this._getIsFrontCamera()}):e&&Object.assign(e.option,{cameraId:this._getCurrentCameraId()}),e},i.prototype._generateLocalTestVideoData=function(){return{view:this._getLocalTestView(),publish:!1,option:p({cameraId:this._getCurrentCameraId(),profile:this._getVideoProfile()},this._getVideoPlayOption())}},i.prototype._generateLocalAudioData=function(){return{publish:this._getIsAudioPublish(),option:{microphoneId:this._getCurrentMicrophoneId(),profile:this._getAudioProfile()}}},i.prototype._generateRemoteVideoData=function(e,t){return this._remoteStreamConfig.get("".concat(e,"_").concat(this._getTRTCStreamType(t)))},i.prototype._addTRTCEvents=function(){var t=this;this._trtc.on(l.default.EVENT.ERROR,(function(e){var i;e&&t.emit("onError",null===(i=null==e?void 0:e.getCode)||void 0===i?void 0:i.getCode(),e.message)})),this._trtc.on(l.default.EVENT.REMOTE_USER_ENTER,(function(e){(null==e?void 0:e.userId)&&t.emit("onRemoteUserEnterRoom",e.userId)})),this._trtc.on(l.default.EVENT.REMOTE_USER_EXIT,(function(e){(null==e?void 0:e.userId)&&t.emit("onRemoteUserLeaveRoom",e.userId)})),this._trtc.on(l.default.EVENT.REMOTE_AUDIO_AVAILABLE,(function(e){(null==e?void 0:e.userId)&&t.emit("onUserAudioAvailable",e.userId,!0)})),this._trtc.on(l.default.EVENT.REMOTE_AUDIO_UNAVAILABLE,(function(e){(null==e?void 0:e.userId)&&t.emit("onUserAudioAvailable",e.userId,!1)})),this._trtc.on(l.default.EVENT.REMOTE_VIDEO_AVAILABLE,(function(e){t._emitVideoAvailable(e,!0)})),this._trtc.on(l.default.EVENT.REMOTE_VIDEO_UNAVAILABLE,(function(e){t._emitVideoAvailable(e,!1)})),this._trtc.on(l.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(l.default.EVENT.NETWORK_QUALITY,(function(i){var o=i.uplinkNetworkQuality,r=i.downlinkNetworkQuality,n=t.client?t.client.getUserId():"",s=[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],a=new b(n,s[o]),c=new b("remote",s[r]);t.emit("onNetworkQuality",a,[c])})),this._trtc.on(l.default.EVENT.SCREEN_SHARE_STOPPED,(function(){t.emit("onScreenCaptureStopped",{reason:0}),t._isSharingScreen=!1})),this._trtc.on(l.default.EVENT.PUBLISH_STATE_CHANGED,(function(i){var o=i.mediaType;"started"===i.state&&("audio"===o?t.emit("onSendFirstLocalAudioFrame"):"video"===o?t.emit("onSendFirstLocalVideoFrame",{streamType:e.TRTCVideoStreamType.TRTCVideoStreamTypeBig}):"screen"===o&&t.emit("onSendFirstLocalVideoFrame",{streamType:e.TRTCVideoStreamType.TRTCVideoStreamTypeSub}))}))},i.prototype._removeTRTCEvents=function(){this._trtc.off("*")},i.prototype._emitVideoAvailable=function(e,t){var i=e.userId,o=e.streamType;t?this._remoteStreamMap.set("".concat(i,"_").concat(o),!0):this._remoteStreamMap.delete("".concat(i,"_").concat(o)),o===l.default.TYPE.STREAM_TYPE_SUB?i&&this.emit("onUserSubStreamAvailable",i,t):i&&this.emit("onUserVideoAvailable",i,t)},i.prototype._setLocalView=function(e){this._localView=e},i.prototype._getLocalView=function(){return this._localView},i.prototype._setIsMobile=function(e){this._isMobile=e},i.prototype._getIsMobile=function(){return this._isMobile},i.prototype._setIsFrontCamera=function(e){this._isFrontCamera=e},i.prototype._getIsFrontCamera=function(){return this._isFrontCamera},i.prototype._setIsVideoPublish=function(e){this._isVideoPublish=e},i.prototype._getIsVideoPublish=function(){return this._isVideoPublish},i.prototype._setVideoProfile=function(e){this._videoProfile=e},i.prototype._getVideoProfile=function(){return this._videoProfile},i.prototype._setVideoPlayOption=function(e){this._videoPlayOption=e},i.prototype._getVideoPlayOption=function(){return this._videoPlayOption},i.prototype._setLocalTestView=function(e){this._localTestView=e},i.prototype._getLocalTestView=function(){return this._localTestView},i.prototype._setScreenShareParams=function(e){var t=e.view,i=e.systemAudio,o=e.fillMode,r=e.profile;$(t)||(this._screenShareParams.view=t),$(i)||(this._screenShareParams.option.systemAudio=i),$(o)||(this._screenShareParams.option.fillMode=o),$(r)||(this._screenShareParams.option.profile=r)},i.prototype._getScreenShareParams=function(){return this._screenShareParams},i.prototype._setIsAudioPublish=function(e){this._isAudioPublish=e},i.prototype._getIsAudioPublish=function(){return this._isAudioPublish},i.prototype._setAudioProfile=function(e){this._audioProfile=e},i.prototype._getAudioProfile=function(){return this._audioProfile},i.prototype._setCurrentCameraId=function(e){this._currentCameraId=e},i.prototype._getCurrentCameraId=function(){return this._currentCameraId},i.prototype._setCurrentMicrophoneId=function(e){this._currentMicrophoneId=e},i.prototype._getCurrentMicrophoneId=function(){return this._currentMicrophoneId},i.prototype._setCurrentSpeakerId=function(e){this._currentSpeakerId=e},i.prototype._getCurrentSpeakerId=function(){return this._currentSpeakerId},i.prototype._setRemoteStreamConfig=function(e,t,i){var o={userId:e,streamType:this._getTRTCStreamType(t),option:{}},r=i.view,n=i.mirrorType,s=i.fillMode;$(r)||(o.view=r),$(n)||(o.option.mirror=this._getTRTCMirror(n)),$(s)||(o.option.fillMode=this._getTRTCFillMode(s)),this._remoteStreamConfig.set("".concat(e,"_").concat(this._getTRTCStreamType(t)),o)},i.prototype.handleDeviceChange=function(){return R(this,void 0,void 0,(function(){var t=this;return C(this,(function(i){return l.default.getCameraList().then((function(i){return R(t,void 0,void 0,(function(){return C(this,(function(t){switch(t.label){case 0:return this._cameraList.length===i.length?[2]:[4,this.deviceChangeManage(this._cameraList,i,e.TRTCDeviceType.TRTCDeviceTypeCamera)];case 1:return t.sent(),this._cameraList=i,[2]}}))}))})),l.default.getMicrophoneList().then((function(i){return R(t,void 0,void 0,(function(){return C(this,(function(t){switch(t.label){case 0:return[4,this.deviceChangeManage(this._microphoneList,i,e.TRTCDeviceType.TRTCDeviceTypeMic)];case 1:return t.sent(),this._microphoneList=i,[2]}}))}))})),l.default.getSpeakerList().then((function(i){return R(t,void 0,void 0,(function(){return C(this,(function(t){switch(t.label){case 0:return[4,this.deviceChangeManage(this._speakerList,i,e.TRTCDeviceType.TRTCDeviceTypeSpeaker)];case 1:return t.sent(),this._speakerList=i,[2]}}))}))})),[2]}))}))},i.prototype.isSameDevice=function(e,t){var i=e&&e.deviceId&&e.groupId&&e.label,o=t&&t.deviceId&&t.groupId&&t.label;return!(!i||!o)&&e.deviceId===t.deviceId&&e.groupId===t.groupId&&e.label===t.label},i.prototype.deviceChangeManage=function(t,i,o){return R(this,void 0,void 0,(function(){var r,n,s,a,c;return C(this,(function(u){switch(u.label){case 0:return r=void 0,t.length!==i.length&&(n=(i||[]).map((function(e){return e.deviceId})),s=new y,t.length>i.length?(s=t.filter((function(e){return!n.includes(e.deviceId)}))[0]||{},r=e.TRTCDeviceState.TRTCDeviceStateRemove):(n=(t||[]).map((function(e){return e.deviceId})),s=i.filter((function(e){return!n.includes(e.deviceId)}))[0]||{},r=e.TRTCDeviceState.TRTCDeviceStateAdd),a=s.deviceId,this.emitOnDeviceChange(a,o,r)),c=this.getDefaultDeviceInfo(i),o!==e.TRTCDeviceType.TRTCDeviceTypeCamera||r!==e.TRTCDeviceState.TRTCDeviceStateRemove?[3,3]:this.isSameDevice(this._currentCamera,c)?[2]:c.deviceId?[4,this.autoChangeDevice(o,c)]:[3,2];case 1:u.sent(),u.label=2;case 2:u.label=3;case 3:return o!==e.TRTCDeviceType.TRTCDeviceTypeMic?[3,6]:this.isSameDevice(this._currentMicrophone,c)?[2]:c.deviceId?[4,this.autoChangeDevice(o,c)]:[3,5];case 4:u.sent(),u.label=5;case 5:u.label=6;case 6:return o!==e.TRTCDeviceType.TRTCDeviceTypeSpeaker?[3,9]:this.isSameDevice(this._currentSpeaker,c)?[2]:c.deviceId?[4,this.autoChangeDevice(o,c)]:[3,8];case 7:u.sent(),u.label=8;case 8:u.label=9;case 9:return[2]}}))}))},i.prototype.getDefaultDeviceInfo=function(e){var t=new y;if(0===e.length)return t;var i=e.filter((function(e){return"default"===e.deviceId}));return t=i.length>0?i[0]:e[0]},i.prototype.autoChangeDevice=function(t,i){return R(this,void 0,void 0,(function(){var o,r,n,s,a;return C(this,(function(c){switch(c.label){case 0:if(o=i.deviceId,t!==e.TRTCDeviceType.TRTCDeviceTypeCamera)return[3,8];c.label=1;case 1:return c.trys.push([1,3,,4]),[4,this._trtc.updateLocalVideo({option:{cameraId:o}})];case 2:return c.sent(),[3,4];case 3:return r=c.sent(),console.log("error",JSON.stringify(r)),r.code,l.default.ERROR_CODE.OPERATION_ABORT,[3,4];case 4:return c.trys.push([4,6,,7]),[4,this._testTrtc.updateLocalVideo({option:{cameraId:o}})];case 5:return c.sent(),[3,7];case 6:return n=c.sent(),console.log("testTRTC error",JSON.stringify(n)),n.code,l.default.ERROR_CODE.OPERATION_ABORT,[3,7];case 7:this._currentCameraId=o,this._currentCamera=i,this.emitOnDeviceChange(o,t,e.TRTCDeviceState.TRTCDeviceStateActive),c.label=8;case 8:if(t!==e.TRTCDeviceType.TRTCDeviceTypeMic)return[3,16];c.label=9;case 9:return c.trys.push([9,11,,12]),[4,this._trtc.updateLocalAudio({option:{microphoneId:o}})];case 10:return c.sent(),[3,12];case 11:return s=c.sent(),console.log("error",JSON.stringify(s)),s.code,l.default.ERROR_CODE.OPERATION_ABORT,[3,12];case 12:return c.trys.push([12,14,,15]),[4,this._testTrtc.updateLocalAudio({option:{microphoneId:o}})];case 13:return c.sent(),[3,15];case 14:return a=c.sent(),console.log("testTRTC error",JSON.stringify(a)),a.code,l.default.ERROR_CODE.OPERATION_ABORT,[3,15];case 15:this._currentMicId=o,this._currentMicrophone=i,this.emitOnDeviceChange(o,t,e.TRTCDeviceState.TRTCDeviceStateActive),c.label=16;case 16:return t!==e.TRTCDeviceType.TRTCDeviceTypeSpeaker?[3,18]:[4,l.default.setCurrentSpeaker(o)];case 17:c.sent(),this._currentSpeakerId=o,this._currentSpeaker=i,this.emitOnDeviceChange(o,t,e.TRTCDeviceState.TRTCDeviceStateActive),c.label=18;case 18:return[2]}}))}))},i.prototype.emitOnDeviceChange=function(e,t,i){this.emit("onDeviceChange",e,t,i)},i}(function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var i=function(){for(var t=0,i=e;t<i.length;t++)ee(this,new(0,i[t])(this))},o=i.prototype,r=0,n=e;r<n.length;r++){var s=n[r];ee(i,s),ee(o,s.prototype)}return i}(t.EventEmitter));e.Rect=B,e.TRTCDeviceInfo=y,e.TRTCImageBuffer=k,e.TRTCLocalStatistics=P,e.TRTCMixUser=j,e.TRTCNetworkQosParam=F,e.TRTCParams=g,e.TRTCPublishCDNParam=w,e.TRTCQualityInfo=b,e.TRTCRenderParams=M,e.TRTCScreenCaptureSourceInfo=N,e.TRTCStatistics=L,e.TRTCTranscodingConfig=U,e.TRTCVideoEncParam=V,e.TRTCVolumeInfo=D,e.default=ae,Object.defineProperty(e,"__esModule",{value:!0})},"object"==typeof exports&&"undefined"!=typeof module?factory(exports,require("events"),require("trtc-sdk-v5")):"function"==typeof define&&define.amd?define(["exports","events","trtc-sdk-v5"],factory):factory((global="undefined"!=typeof globalThis?globalThis:global||self).TRTC={},global.events,global.TRTC);
package/.eslintrc.js DELETED
@@ -1,88 +0,0 @@
1
- module.exports = {
2
- parser: '@typescript-eslint/parser',
3
- extends: ['eslint-config-tencent'],
4
- rules: {
5
- indent: ['error', 2, { SwitchCase: 1 }], // 缩进
6
- semi: ['error', 'always'],
7
- 'no-unused-vars': [
8
- // 禁止出现未使用过的变量
9
- 'error',
10
- {
11
- args: 'none', // 不检查参数
12
- },
13
- ],
14
- "@typescript-eslint/no-unused-vars": [
15
- "error",
16
- { "argsIgnorePattern": "^_" }
17
- ],
18
- // 要求构造函数首字母大写 (要求调用 new 操作符时有首字母大小的函数,允许调用首字母大写的函数时没有 new 操作符。)
19
- 'new-cap': [
20
- 2,
21
- {
22
- newIsCap: true, // 要求调用 `new` 操作符时有首字母大小的函数
23
- capIsNew: false, // 允许调用首字母大写的函数时没有 `new` 操作符
24
- },
25
- ],
26
- 'no-console': 'off', // 禁用 console
27
- 'no-empty': 'warn', // 禁止出现空语句块
28
- 'linebreak-style': 'off', // 强制使用一致的换行风格
29
- 'require-jsdoc': 'off',
30
- 'max-len': [
31
- 'warn',
32
- {
33
- code: 160,
34
- ignoreComments: true, // 忽略所有拖尾注释和行内注释
35
- ignoreUrls: true, // 忽略含有链接的行
36
- },
37
- ],
38
- 'valid-jsdoc': [
39
- 'warn',
40
- {
41
- prefer: {
42
- return: 'returns', // instead of @return use @returns
43
- },
44
- requireReturn: false, // if and only if the function or method has a return statement or returns a value e.g.
45
- requireReturnDescription: false, // allows missing description in return tags
46
- },
47
- ],
48
- 'object-curly-spacing': [
49
- 'error',
50
- 'always', // 要求花括号内有空格
51
- ],
52
- eqeqeq: [
53
- 'error',
54
- 'always', // enforces the use of === and !== in every situation
55
- ],
56
- 'no-alert': 'error', // 禁止使用alert confirm prompt
57
- 'no-nested-ternary': 'error', // 禁止使用嵌套的三目运算
58
- 'space-unary-ops': [
59
- 'error',
60
- {
61
- words: true, // 一元操作符,例如:new、delete、typeof、void、yield 后需要有空格
62
- nonwords: false, // 一元操作符: -、+、--、++、!、!! 前不能有空格
63
- },
64
- ],
65
- 'key-spacing': [
66
- 'error',
67
- {
68
- mode: 'strict', // enforces exactly one space before or after colons in object literals. 禁止对齐
69
- beforeColon: false, // disallows spaces between the key and the colon in object literals
70
- afterColon: true, // requires at least one space between the colon and the value in object literals
71
- },
72
- ],
73
- 'space-infix-ops': 'error', // 中缀操作符周围有空格
74
- 'no-else-return': [
75
- 'error',
76
- {
77
- allowElseIf: false, // disallows else if blocks after a return
78
- },
79
- ],
80
- 'prefer-rest-params': 'off', // 用arguments没什么不好的
81
- 'guard-for-in': 'error', // for in时需检测hasOwnProperty,避免遍历到继承来的属性方法
82
- 'prefer-spread': 'off', // 用apply也挺好的,es2015的spread syntax不是个必选项
83
- 'no-underscore-dangle': 'off', // 允许使用悬空下划线, 主要用来表示对象中的 "私有" 成员. ref: https://eslint.bootcss.com/docs/rules/no-underscore-dangle
84
- 'no-param-reassign': 'off', // 赋值给声明为函数参数的变量可能会引起误解,并导致混淆行为, TODO: 后续删除 ref: https://cloud.tencent.com/developer/section/1135734
85
- 'no-multi-spaces': 'error',
86
- 'camelcase': 'off',
87
- },
88
- };
package/.prettierrc DELETED
@@ -1,5 +0,0 @@
1
- {
2
- "printWidth": 200,
3
- "trailingComma": "all",
4
- "singleQuote": true
5
- }
package/CHANGELOG.md DELETED
@@ -1,58 +0,0 @@
1
- ## [1.0.7] (2023-04-18)
2
-
3
- #### 修复
4
- - 修复没有本地流情况下切换设备报错的问题。
5
- - 修复发布流时没有本地流的时候设置 isPublished 为 true 的问题。
6
- - 修复本地播放流没有设置 videoProfile 的问题。
7
- - 修复摄像头拔出时本地播放流没有切换摄像头的问题。
8
-
9
-
10
- ## [1.0.5] (2023-02-06)
11
-
12
- #### 修复
13
- - 修复主播切换至观众时,未设置推流状态问题。
14
- - http + ip 环境时,navigator.mediaDeices 为 undefined,无法监听设备切换。
15
-
16
-
17
- ## [1.0.4] (2022-09-22)
18
-
19
- #### 优化
20
- - 进房支持额外参数,[WebRTC](https://web.sdk.qcloud.com/trtc/webrtc/doc/zh-cn/tutorial-01-info-changelog.html) 必须要 ≥ v4.15.2。
21
-
22
-
23
- ## [1.0.3] (2022-12-08)
24
-
25
- #### 新增
26
- - 增加 onFirstVideoFrame, onMicDidReady 事件。
27
- - 为 onNetworkQuality 事件增加 remoteQuality 参数。
28
- - mute 操作增加状态变量,用于记录用户的操作记录。
29
- - 辅流推屏幕分享, 不向下兼容。WebRTC ≥ 4.15.0。
30
- - 屏幕分享接口增加参数: 本地预览/编码参数设置。
31
-
32
- #### 修复
33
- - 停止预览时,将本地预览流设置为 null。
34
- - 观众切换为主播推流后, 没有设置推流状态问题修复。
35
- - muteAudio --> enterRoom --> startLocalPreview --> startLocalAudio 后会将 audio 推出去问题修复。
36
- - muteAudio&muteVideo -> 进房 -> startLocalPreview&startLocalAuido -> unmuteAuido&unmuteVideo -> stopLocalPreview -> muteVideo -> startLocalPreview -> unmuteVideo。此时远端收不到 onUserVideoAvailable hasVideo 为 1 问题修复。
37
- - muteAudio&muteVideo -> 进房 -> startLocalPreview&startLocalAuido -> unmuteAuido&unmuteVideo 抛出的 onUserAudioAvailable 错误问题修复。
38
- - setVideoProfile 没有设置本地预览流问题修复。
39
-
40
- #### 优化
41
- - muteLocalVideo/muteLocalAudio 方法对其 [Electron SDK API](https://web.sdk.qcloud.com/trtc/electron/doc/zh-cn/trtc_electron_sdk/TRTCCloud.html#muteLocalVideo)。
42
- - 开发进房不上行时, 将本地预览和推出去的流分成了 2 个,导致 audio-volume 中没有本地音量. 因为推出去的流没有进行播放. 因此需要将本地流播放, 只是不展示。
43
- - 设置本地预览播放本地流,而不是推出去的视频流。
44
- - TRTCAudioQuality 对齐 [Electron SDK API](https://web.sdk.qcloud.com/trtc/electron/doc/zh-cn/trtc_electron_sdk/TRTCCloud.html#muteLocalVideo)。
45
- - 本地预览流中可能会产生不必要的流初始化。
46
- - 对外暴露 TRTCVideoResolutionMode。
47
-
48
-
49
- ## [1.0.2] (2022-09-22)
50
-
51
- #### 新增
52
- - startScreenShare 屏幕分享增加 screenAudio 参数,用于是否开启系统声音。
53
-
54
-
55
- ## [1.0.1] (2022-09-13)
56
-
57
- #### 修复
58
- - [setLocalRenderParams]() 问题处理。
@@ -1,12 +0,0 @@
1
- const path = require('path');
2
- const apiPath = path.join(__dirname, '../../', 'docs', 'api');
3
- const fs = require('fs');
4
- var files = fs.readdirSync(apiPath);
5
-
6
- files.forEach(file => {
7
- if (path.extname(file) === '.html') {
8
- var htmlPath = path.join(apiPath, file);
9
- console.log('delete file', htmlPath);
10
- fs.unlinkSync(htmlPath);
11
- }
12
- });
@@ -1,141 +0,0 @@
1
- const replace = require('replace');
2
- const path = require('path');
3
- const apiPath = path.join(__dirname, '../../', 'docs', 'api');
4
- const pretty = require('pretty');
5
- const fs = require('fs');
6
-
7
- var files = fs.readdirSync(apiPath);
8
- var replacements = [
9
- {
10
- find: '<header>',
11
- replace: '<header style="display:none">',
12
- },
13
- // {
14
- // find: '<h4 class="name" id="Client">',
15
- // replace: '<h4 class="name" style="display:none" id="Client">'
16
- // },
17
- // {
18
- // find: '<h4 class="name" id="Stream">',
19
- // replace: '<h4 class="name" style="display:none" id="Stream">'
20
- // },
21
- // {
22
- // find: '<h4 class="name" id="LocalStream">',
23
- // replace: '<h4 class="name" style="display:none" id="LocalStream">'
24
- // },
25
- // {
26
- // find: '<h4 class="name" id="RemoteStream">',
27
- // replace: '<h4 class="name" style="display:none" id="RemoteStream">'
28
- // },
29
- {
30
- find: `<p>!</p>`,
31
- replace: `<p>注意:</p>`,
32
- },
33
- {
34
- find: '<blockquote',
35
- replace: '<blockquote style="border-left: 6px solid #00a4ff;margin: 0 0 24px;padding: 12px;background: #dcf4ff;"',
36
- },
37
- // {
38
- // find: '<li><a href="tutorial-00-info-update-guideline.html">SDK 升级指引</a>',
39
- // replace:
40
- // '<ul><li style="margin:10px 0 5px 0">相关信息</li><li><a href="tutorial-00-info-update-guideline.html">SDK 升级指引</a>'
41
- // },
42
- // {
43
- // find: '<li><a href="tutorial-10-basic-get-started-with-demo.html">快速跑通 Demo</a>',
44
- // replace:
45
- // '</ul><ul><li style="margin:10px 0 5px 0">基础教程</li><li><a href="tutorial-10-basic-get-started-with-demo.html">快速跑通 Demo</a>'
46
- // },
47
- // {
48
- // find: '<a href="tutorial-07-basic-detect-volume.html">音量大小检测</a></li>',
49
- // replace: '<a href="tutorial-07-basic-detect-volume.html">音量大小检测</a></li><ul/>'
50
- // },
51
- // {
52
- // find:
53
- // '<li><a href="tutorial-20-advanced-customized-capture-rendering.html">自定义采集与自定义播放渲染</a>',
54
- // replace:
55
- // '<ul><li style="margin:10px 0 5px 0">进阶教程</li><li><a href="tutorial-20-advanced-customized-capture-rendering.html">自定义采集与自定义播放渲染</a>'
56
- // },
57
- // {
58
- // find: '<a href="tutorial-25-advanced-device-change.html">检测设备插拔行为</a></li>',
59
- // replace: '<a href="tutorial-25-advanced-device-change.html">检测设备插拔行为</a></li></ul>'
60
- // },
61
- {
62
- find: '<pre class="prettyprint',
63
- replace: '<pre class="highlight lang-javascript',
64
- },
65
- {
66
- find: '<html lang="en">',
67
- replace: '<html lang="zh-cmn-Hans">',
68
- },
69
- /* ,
70
- {
71
- find: '<pre class="prettyprint source',
72
- replace: '<pre class="prettyprint source linenums'
73
- },
74
- {
75
- find: 'class="prettyprint"><code>',
76
- replace: 'class="prettyprint source linenums"><code>'
77
- } */
78
- {
79
- find: '_HACK_JSDOC',
80
- replace: '',
81
- },
82
- ];
83
-
84
- files.forEach((file) => {
85
- if (path.extname(file) === '.html') {
86
- // console.log(__dirname, file, path.join(apiPath, file));
87
- // console.log(fs.readFileSync(path.join(apiPath, file)).toString());
88
- var htmlPath = path.join(apiPath, file);
89
- let htmlContent = fs.readFileSync(htmlPath).toString();
90
-
91
- if (file === 'index.html' || file === 'TRTCCloud.html') {
92
- htmlContent = htmlContent.replace(/#.Audio/g, '');
93
- htmlContent = htmlContent.replace(/Audio#/g, '');
94
-
95
- htmlContent = htmlContent.replace(/#.Beauty/g, '');
96
- htmlContent = htmlContent.replace(/Beauty#/g, '');
97
-
98
- htmlContent = htmlContent.replace(/#.Camera/g, '');
99
- htmlContent = htmlContent.replace(/Camera#/g, '');
100
-
101
- htmlContent = htmlContent.replace(/#.Mic/g, '');
102
- htmlContent = htmlContent.replace(/Mic#/g, '');
103
-
104
- htmlContent = htmlContent.replace(/#.MixCDN/g, '');
105
- htmlContent = htmlContent.replace(/MixCDN#/g, '');
106
-
107
- htmlContent = htmlContent.replace(/#.Video/g, '');
108
- htmlContent = htmlContent.replace(/Video#/g, '');
109
-
110
- htmlContent = htmlContent.replace(/#.Share/g, '');
111
- htmlContent = htmlContent.replace(/Share#/g, '');
112
- }
113
- if (file.includes('.html')) {
114
- htmlContent = htmlContent.replace(/TRTCCallback#/g, '');
115
- }
116
- if (file === 'TRTCCloud.html') {
117
- // Audio、Video、Camera 等模块的方法加上了 static
118
- htmlContent = htmlContent.replace(/\(static\) /g, '');
119
- // 针对 getTRTCShareInstance、destroyTRTCShareInstance 需要再加上 static
120
- htmlContent = htmlContent.replace('</span>getTRTCShareInstance', '(static) </span>getTRTCShareInstance');
121
- htmlContent = htmlContent.replace('</span>destroyTRTCShareInstance', '(static) </span>destroyTRTCShareInstance');
122
- }
123
-
124
- fs.writeFile(htmlPath, pretty(htmlContent, { ocd: true }), function (err) {
125
- if (err) {
126
- return console.error(err);
127
- }
128
- console.log(htmlPath, '格式化成功!');
129
-
130
- replacements.forEach(function (obj) {
131
- replace({
132
- regex: obj.find,
133
- replacement: obj.replace,
134
- paths: [htmlPath],
135
- recursive: false,
136
- silent: true,
137
- });
138
- });
139
- });
140
- }
141
- });
@@ -1,42 +0,0 @@
1
- {
2
- "plugins": ["jsdoc-plugin-typescript", "plugins/markdown"],
3
- "sourceType": "module",
4
- "typescript": {
5
- "moduleRoot": "src"
6
- },
7
- "source": {
8
- "include": [
9
- "./build/ts2js/src/index.js",
10
- "./build/ts2js/src/Audio.js",
11
- "./build/ts2js/src/Video.js",
12
- "./build/ts2js/src/Camera.js",
13
- "./build/ts2js/src/Mic.js",
14
- "./build/ts2js/src/Share.js",
15
- "./build/ts2js/src/MixCDN.js",
16
- "./build/ts2js/src/common/trtc_define.js"
17
- ],
18
- "includePattern": ".+\\.js(doc)?$"
19
- },
20
- "opts": {
21
- "access": "undefined, public",
22
- "encoding": "utf8",
23
- "recurse": true,
24
- "verbose": true,
25
- "readme": "./docs/main.md",
26
- "template": "../../node_modules/docdash-blue",
27
- "destination": "docs/api"
28
- },
29
- "docdash": {
30
- "sort": false,
31
- "search": true,
32
- "collapse": true,
33
- "static": true,
34
- "sectionOrder": ["Namespaces", "Classes", "Modules", "Externals", "Events", "Mixins", "Tutorials", "Interfaces"]
35
- },
36
- "templates": {
37
- "default": {
38
- "outputSourceFiles": false,
39
- "useLongnameInNav": true
40
- }
41
- }
42
- }
@@ -1,29 +0,0 @@
1
- const replace = require('replace');
2
- const fs = require('fs');
3
- const pkg = require('../package.json');
4
-
5
- var srcPaths = ['./build/template/npm-package/package.json', './build/template/npm-package/README.md'];
6
- var distPaths = ['./dist/npm-package/package.json', './dist/npm-package/README.md'];
7
-
8
- var replacements = [
9
- {
10
- find: '<@VERSION@>',
11
- replace: pkg.version,
12
- },
13
- ];
14
-
15
- srcPaths.forEach((src, index) => {
16
- console.log(src);
17
- console.log(distPaths[index]);
18
- fs.writeFile(distPaths[index], fs.readFileSync(src).toString(), function (err) {
19
- replacements.forEach(function (obj) {
20
- replace({
21
- regex: obj.find,
22
- replacement: obj.replace,
23
- paths: [distPaths[index]],
24
- recursive: true,
25
- silent: true,
26
- });
27
- });
28
- });
29
- });