trtc-sdk-v5 5.18.3 → 5.18.4-beta.2

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trtc-sdk-v5",
3
- "version": "5.18.3",
3
+ "version": "5.18.4-beta.2",
4
4
  "description": "Tencent Cloud RTC SDK for Web",
5
5
  "main": "trtc.js",
6
6
  "types": "index.d.ts",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rtc-plugin/audio-player",
3
- "version": "5.18.3",
3
+ "version": "5.18.4-beta.2",
4
4
  "description": "TRTC Web SDK AudioPlayer plugin - unified audio player supporting PCM, URL, and Track sources",
5
5
  "main": "./audio-player.esm.js",
6
6
  "module": "./audio-player.esm.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rtc-plugin/cdn-streaming",
3
- "version": "5.18.3",
3
+ "version": "5.18.4-beta.2",
4
4
  "description": "TRTC Web SDK 5.x CDN streaming plugin",
5
5
  "main": "./cdn-streaming.esm.js",
6
6
  "module": "./cdn-streaming.esm.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rtc-plugin/chorus",
3
- "version": "5.18.3",
3
+ "version": "5.18.4-beta.2",
4
4
  "description": "TRTC Web SDK 5.x Chorus plugin",
5
5
  "main": "./chorus.esm.js",
6
6
  "module": "./chorus.esm.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rtc-plugin/cross-room",
3
- "version": "5.18.3",
3
+ "version": "5.18.4-beta.2",
4
4
  "description": "TRTC Web SDK 5.x Cross Room plugin",
5
5
  "main": "./cross-room.esm.js",
6
6
  "module": "./cross-room.esm.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rtc-plugin/custom-encryption",
3
- "version": "5.18.3",
3
+ "version": "5.18.4-beta.2",
4
4
  "main": "./custom-encryption.esm.js",
5
5
  "module": "./custom-encryption.esm.js",
6
6
  "types": "./custom-encryption.esm.d.ts"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rtc-plugin/device-detector",
3
- "version": "5.18.3",
3
+ "version": "5.18.4-beta.2",
4
4
  "description": "TRTC Web SDK 5.x device detector plugin",
5
5
  "main": "./device-detector.esm.js",
6
6
  "module": "./device-detector.esm.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rtc-plugin/lebplayer",
3
- "version": "5.18.3",
3
+ "version": "5.18.4-beta.2",
4
4
  "description": "TRTC Web SDK 5.x LEBPlayer plugin",
5
5
  "main": "./lebplayer.esm.js",
6
6
  "module": "./lebplayer.esm.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rtc-plugin/realtime-transcriber",
3
- "version": "5.18.3",
3
+ "version": "5.18.4-beta.2",
4
4
  "description": "TRTC Web SDK 5.x Realtime Transcriber plugin",
5
5
  "main": "./realtime-transcriber.esm.js",
6
6
  "module": "./realtime-transcriber.esm.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rtc-plugin/small-stream-auto-switcher",
3
- "version": "5.18.3",
3
+ "version": "5.18.4-beta.2",
4
4
  "description": "",
5
5
  "main": "./small-stream-auto-switcher.esm.js",
6
6
  "keywords": [],
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rtc-plugin/video-decoder",
3
- "version": "5.18.3",
3
+ "version": "5.18.4-beta.2",
4
4
  "description": "Video decoder plugin for TRTC",
5
5
  "main": "./video-decoder.esm.js",
6
6
  "module": "./video-decoder.esm.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rtc-plugin/basic-beauty",
3
- "version": "5.18.3",
3
+ "version": "5.18.4-beta.2",
4
4
  "description": "TRTC Web SDK 5.x basic-beauty plugin",
5
5
  "main": "./basic-beauty.esm.js",
6
6
  "module": "./basic-beauty.esm.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rtc-plugin/beauty",
3
- "version": "5.18.3",
3
+ "version": "5.18.4-beta.2",
4
4
  "description": "TRTC Web SDK 5.x beauty plugin",
5
5
  "main": "./beauty.esm.js",
6
6
  "module": "./beauty.esm.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rtc-plugin/face-detection",
3
- "version": "5.18.3",
3
+ "version": "5.18.4-beta.2",
4
4
  "description": "TRTC Web SDK 5.x face detection plugin",
5
5
  "main": "./face-detection.esm.js",
6
6
  "module": "./face-detection.esm.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rtc-plugin/video-mixer",
3
- "version": "5.18.3",
3
+ "version": "5.18.4-beta.2",
4
4
  "description": "TRTC Web SDK 5.x videoMixer plugin",
5
5
  "main": "./video-mixer.esm.js",
6
6
  "module": "./video-mixer.esm.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rtc-plugin/virtual-background",
3
- "version": "5.18.3",
3
+ "version": "5.18.4-beta.2",
4
4
  "description": "TRTC Web SDK 5.x virtual background plugin",
5
5
  "main": "./virtual-background.esm.js",
6
6
  "module": "./virtual-background.esm.js",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rtc-plugin/watermark",
3
- "version": "5.18.3",
3
+ "version": "5.18.4-beta.2",
4
4
  "description": "TRTC Web SDK 5.x watermark plugin",
5
5
  "main": "./watermark.esm.js",
6
6
  "module": "./watermark.esm.js",
@@ -1,8 +1,9 @@
1
1
  export interface WatermarkOptions {
2
- imageUrl: string;
2
+ imageUrl?: string;
3
3
  x: number;
4
4
  y: number;
5
5
  size?: Size | number | 'contain' | 'cover';
6
+ videoBlur?: number;
6
7
  }
7
8
 
8
9
  export interface Size {
@@ -1 +1 @@
1
- var __defProp=Object.defineProperty,__defNormalProp=(e,t,r)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,__publicField=(e,t,r)=>__defNormalProp(e,"symbol"!=typeof t?t+"":t,r);function startValidateRule(e){return{name:"WatermarkOptions",type:"object",required:!0,allowEmpty:!1,properties:{imageUrl:{required:!0,type:"string"},x:{required:!1,type:"number"},y:{required:!1,type:"number"},size:{required:!1,type:["string","object","number"]}},validate(t,r,a,i){var o;const{RtcError:s,ErrorCode:n,ErrorCodeDictionary:c}=e.errorModule;if(!t)return;const{imageUrl:d}=t,l=d.split("?")[0].split(".").pop();if("jpg"!==l&&"jpeg"!==l||e.log.warn("The image format is not recommended to be jpg/jpeg, because the format does not support transparency."),!(null==(o=e.room.videoManager.cameraTrack)?void 0:o.mediaTrack))throw new s({code:n.INVALID_OPERATION,extraCode:c.INVALID_OPERATION_NEED_VIDEO,fnName:a});if(e.utils.isString(t.size)&&"contain"!==t.size&&"cover"!==t.size)throw new s({code:n.INVALID_PARAMETER,extraCode:c.INVALID_PARAMETER_TYPE,message:"The size parameter must be 'contain' or 'cover'",fnName:a});if(e.utils.isNumber(t.size)&&(t.size<=0||t.size>1))throw new s({code:n.INVALID_PARAMETER,extraCode:c.INVALID_PARAMETER_RANGE,message:"The size parameter must be greater than 0",fnName:a});if(e.utils.isObject(t.size)){if(!t.size.width||!t.size.height)throw new s({code:n.INVALID_PARAMETER,extraCode:c.INVALID_PARAMETER_TYPE,message:"The size parameter must be an object with width and height properties",fnName:a});if(t.size.width<=0||t.size.height<=0)throw new s({code:n.INVALID_PARAMETER,extraCode:c.INVALID_PARAMETER_RANGE,message:"The size parameter must be greater than 0",fnName:a})}}}}function stopValidateRule(e){return{name:"StopWatermarkOptions",required:!1}}var wSeq=0,_Watermark=class e{constructor(e){this.core=e,__publicField(this,"seq"),__publicField(this,"_core"),__publicField(this,"log"),__publicField(this,"startResolve"),__publicField(this,"startReject"),wSeq+=1,this.seq=wSeq,this._core=e,this.log=e.log.createChild({id:`${this.getAlias()}${wSeq}`}),this.log.info("created")}getName(){return e.Name}getAlias(){return"w"}getValidateRule(e){switch(e){case"start":case"update":return startValidateRule(this._core);case"stop":return stopValidateRule(this._core)}}getGroup(){return"w"}async start(e){return this.doStart(e)}async update(e){this.doStart(e)}async stop(){return this._core.room.videoManager.deleteWatermark()}async doStart(e){const{x:t=0,y:r=0}=e,a=await this.processWatermark(e);return this._core.room.videoManager.setWatermark({x:t,y:r,imageUrl:a})}async processWatermark(e){const{imageUrl:t,x:r=0,y:a=0,size:i="cover"}=e,{settings:o,rotation:s}=this._core.room.videoManager.cameraTrack;let n;try{n=await this._core.utils.loadImage(t)}catch(e){const{RtcError:r,ErrorCode:a}=this.core.errorModule;throw new r({code:a.INVALID_PARAMETER,message:`load image failed, url: ${t}`})}let{width:c,height:d}=o;const{width:l,height:m}=n;this._core.utils.isRotate90Or270(s)&&([c,d]=[d,c]);let u=l,h=m;this._core.utils.isObject(i)&&(u=(null==i?void 0:i.width)||u,h=(null==i?void 0:i.height)||h),this._core.utils.isNumber(i)&&(u=l*i,h=m*i);const _=l/m,p=_>c/d;"contain"===i&&(p?(u=c,h=c/_):(u=d*_,h=d)),"cover"===i&&(p?(h=d,u=d*_):(u=c,h=c/_));const g=document.createElement("canvas"),A=g.getContext("2d");return g.width=Math.min(c-r,u),g.height=Math.min(d-a,h),null==A||A.drawImage(n,0,0,u,h),g.toDataURL("image/png")}};__publicField(_Watermark,"Name","Watermark");var Watermark=_Watermark,index_default=Watermark;export{index_default as default};export{Watermark};
1
+ var __defProp=Object.defineProperty,__defNormalProp=(e,t,r)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,__publicField=(e,t,r)=>__defNormalProp(e,"symbol"!=typeof t?t+"":t,r);function startValidateRule(e){return{name:"WatermarkOptions",type:"object",required:!0,allowEmpty:!1,properties:{imageUrl:{required:!1,type:"string"},x:{required:!1,type:"number"},y:{required:!1,type:"number"},size:{required:!1,type:["string","object","number"]},videoBlur:{required:!1,type:"number"}},validate(t,r,i,a){var o;const{RtcError:s,ErrorCode:n,ErrorCodeDictionary:d}=e.errorModule;if(!t)return;const{imageUrl:l}=t;if(l){const t=l.split("?")[0].split(".").pop();"jpg"!==t&&"jpeg"!==t||e.log.warn("The image format is not recommended to be jpg/jpeg, because the format does not support transparency.")}if(!l&&(e.utils.isUndefined(t.videoBlur)||t.videoBlur<=0))throw new s({code:n.INVALID_PARAMETER,message:"At least one of imageUrl or videoBlur must be provided",fnName:i});if(!(null==(o=e.room.videoManager.cameraTrack)?void 0:o.mediaTrack))throw new s({code:n.INVALID_OPERATION,extraCode:d.INVALID_OPERATION_NEED_VIDEO,fnName:i});if(e.utils.isString(t.size)&&"contain"!==t.size&&"cover"!==t.size)throw new s({code:n.INVALID_PARAMETER,extraCode:d.INVALID_PARAMETER_TYPE,message:"The size parameter must be 'contain' or 'cover'",fnName:i});if(e.utils.isNumber(t.size)&&(t.size<=0||t.size>1))throw new s({code:n.INVALID_PARAMETER,extraCode:d.INVALID_PARAMETER_RANGE,message:"The size parameter must be greater than 0",fnName:i});if(e.utils.isObject(t.size)){if(!t.size.width||!t.size.height)throw new s({code:n.INVALID_PARAMETER,extraCode:d.INVALID_PARAMETER_TYPE,message:"The size parameter must be an object with width and height properties",fnName:i});if(t.size.width<=0||t.size.height<=0)throw new s({code:n.INVALID_PARAMETER,extraCode:d.INVALID_PARAMETER_RANGE,message:"The size parameter must be greater than 0",fnName:i})}if(e.utils.isNumber(t.videoBlur)&&(t.videoBlur<0||t.videoBlur>50))throw new s({code:n.INVALID_PARAMETER,extraCode:d.INVALID_PARAMETER_RANGE,message:"The videoBlur parameter must be between 0 and 50",fnName:i})}}}function stopValidateRule(e){return{name:"StopWatermarkOptions",required:!1}}var wSeq=0,_Watermark=class e{constructor(e){this.core=e,__publicField(this,"seq"),__publicField(this,"_core"),__publicField(this,"log"),__publicField(this,"startResolve"),__publicField(this,"startReject"),wSeq+=1,this.seq=wSeq,this._core=e,this.log=e.log.createChild({id:`${this.getAlias()}${wSeq}`}),this.log.info("created")}getName(){return e.Name}getAlias(){return"w"}getValidateRule(e){switch(e){case"start":case"update":return startValidateRule(this._core);case"stop":return stopValidateRule(this._core)}}getGroup(){return"w"}async start(e){return this.doStart(e)}async update(e){this.doStart(e)}async stop(){return this._core.room.videoManager.setVideoBlur(0),this._core.room.videoManager.deleteWatermark()}async doStart(e){const{x:t=0,y:r=0,videoBlur:i=0,imageUrl:a}=e;if(this._core.room.videoManager.setVideoBlur(i),a){const i=await this.processWatermark(e);return this._core.room.videoManager.setWatermark({x:t,y:r,imageUrl:i})}}async processWatermark(e){const{imageUrl:t,x:r=0,y:i=0,size:a="cover"}=e,{settings:o,rotation:s}=this._core.room.videoManager.cameraTrack;let n;try{n=await this._core.utils.loadImage(t)}catch(e){const{RtcError:r,ErrorCode:i}=this.core.errorModule;throw new r({code:i.INVALID_PARAMETER,message:`load image failed, url: ${t}`})}let{width:d,height:l}=o;const{width:c,height:u}=n;this._core.utils.isRotate90Or270(s)&&([d,l]=[l,d]);let m=c,h=u;this._core.utils.isObject(a)&&(m=(null==a?void 0:a.width)||m,h=(null==a?void 0:a.height)||h),this._core.utils.isNumber(a)&&(m=c*a,h=u*a);const _=c/u,p=_>d/l;"contain"===a&&(p?(m=d,h=d/_):(m=l*_,h=l)),"cover"===a&&(p?(h=l,m=l*_):(m=d,h=d/_));const g=document.createElement("canvas"),A=g.getContext("2d");return g.width=Math.min(d-r,m),g.height=Math.min(l-i,h),null==A||A.drawImage(n,0,0,m,h),g.toDataURL("image/png")}};__publicField(_Watermark,"Name","Watermark");var Watermark=_Watermark,index_default=Watermark;export{index_default as default};export{Watermark};
@@ -1,3 +1,3 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).Watermark=t()}(this,function(){"use strict";function e(e,t,r,n,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void r(e)}u.done?t(c):Promise.resolve(c).then(n,o)}function t(t){return function(){var r=this,n=arguments;return new Promise(function(o,i){var a=t.apply(r,n);function u(t){e(a,o,i,u,c,"next",t)}function c(t){e(a,o,i,u,c,"throw",t)}u(void 0)})}}function r(e,t,r){return t&&function(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,i(n.key),n)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function n(){
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).Watermark=t()}(this,function(){"use strict";function e(e,t,r,o,n,i,a){try{var u=e[i](a),c=u.value}catch(e){return void r(e)}u.done?t(c):Promise.resolve(c).then(o,n)}function t(t){return function(){var r=this,o=arguments;return new Promise(function(n,i){var a=t.apply(r,o);function u(t){e(a,n,i,u,c,"next",t)}function c(t){e(a,n,i,u,c,"throw",t)}u(void 0)})}}function r(e,t,r){return t&&function(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,i(o.key),o)}}(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function o(){
2
2
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
3
- var e,t,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",a=r.toStringTag||"@@toStringTag";function u(r,n,i,a){var u=n&&n.prototype instanceof s?n:s,f=Object.create(u.prototype);return o(f,"_invoke",function(r,n,o){var i,a,u,s=0,f=o||[],l=!1,p={p:0,n:0,v:e,a:h,f:h.bind(e,4),d:function(t,r){return i=t,a=0,u=e,p.n=r,c}};function h(r,n){for(a=r,u=n,t=0;!l&&s&&!o&&t<f.length;t++){var o,i=f[t],h=p.p,m=i[2];r>3?(o=m===n)&&(u=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=h&&((o=r<2&&h<i[1])?(a=0,p.v=n,p.n=i[1]):h<m&&(o=r<3||i[0]>n||n>m)&&(i[4]=r,i[5]=n,p.n=m,a=0))}if(o||r>1)return c;throw l=!0,n}return function(o,f,m){if(s>1)throw TypeError("Generator is already running");for(l&&1===f&&h(f,m),a=f,u=m;(t=a<2?e:u)||!l;){i||(a?a<3?(a>1&&(p.n=-1),h(a,u)):p.n=u:p.v=u);try{if(s=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(l=p.n<0)?u:r.call(n,p))!==c)break}catch(t){i=e,a=1,u=t}finally{s=1}}return{value:t,done:l}}}(r,i,a),!0),f}var c={};function s(){}function f(){}function l(){}t=Object.getPrototypeOf;var p=[][i]?t(t([][i]())):(o(t={},i,function(){return this}),t),h=l.prototype=s.prototype=Object.create(p);function m(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,o(e,a,"GeneratorFunction")),e.prototype=Object.create(h),e}return f.prototype=l,o(h,"constructor",l),o(l,"constructor",f),f.displayName="GeneratorFunction",o(l,a,"GeneratorFunction"),o(h),o(h,a,"Generator"),o(h,i,function(){return this}),o(h,"toString",function(){return"[object Generator]"}),(n=function(){return{w:u,m:m}})()}function o(e,t,r,n){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}o=function(e,t,r,n){function a(t,r){o(e,t,function(e){return this._invoke(t,r,e)})}t?i?i(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(a("next",0),a("throw",1),a("return",2))},o(e,t,r,n)}function i(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t);if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:t+""}function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}var u=Object.defineProperty,c=function(e,t,r){return function(e,t,r){return t in e?u(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r}(e,"symbol"!==a(t)?t+"":t,r)};function s(e){return{name:"WatermarkOptions",type:"object",required:!0,allowEmpty:!1,properties:{imageUrl:{required:!0,type:"string"},x:{required:!1,type:"number"},y:{required:!1,type:"number"},size:{required:!1,type:["string","object","number"]}},validate:function(t,r,n,o){var i,a=e.errorModule,u=a.RtcError,c=a.ErrorCode,s=a.ErrorCodeDictionary;if(t){var f=t.imageUrl.split("?")[0].split(".").pop();if("jpg"!==f&&"jpeg"!==f||e.log.warn("The image format is not recommended to be jpg/jpeg, because the format does not support transparency."),!(null==(i=e.room.videoManager.cameraTrack)?void 0:i.mediaTrack))throw new u({code:c.INVALID_OPERATION,extraCode:s.INVALID_OPERATION_NEED_VIDEO,fnName:n});if(e.utils.isString(t.size)&&"contain"!==t.size&&"cover"!==t.size)throw new u({code:c.INVALID_PARAMETER,extraCode:s.INVALID_PARAMETER_TYPE,message:"The size parameter must be 'contain' or 'cover'",fnName:n});if(e.utils.isNumber(t.size)&&(t.size<=0||t.size>1))throw new u({code:c.INVALID_PARAMETER,extraCode:s.INVALID_PARAMETER_RANGE,message:"The size parameter must be greater than 0",fnName:n});if(e.utils.isObject(t.size)){if(!t.size.width||!t.size.height)throw new u({code:c.INVALID_PARAMETER,extraCode:s.INVALID_PARAMETER_TYPE,message:"The size parameter must be an object with width and height properties",fnName:n});if(t.size.width<=0||t.size.height<=0)throw new u({code:c.INVALID_PARAMETER,extraCode:s.INVALID_PARAMETER_RANGE,message:"The size parameter must be greater than 0",fnName:n})}}}}}var f=0,l=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.core=t,c(this,"seq"),c(this,"_core"),c(this,"log"),c(this,"startResolve"),c(this,"startReject"),f+=1,this.seq=f,this._core=t,this.log=t.log.createChild({id:"".concat(this.getAlias()).concat(f)}),this.log.info("created")}return r(e,[{key:"getName",value:function(){return e.Name}},{key:"getAlias",value:function(){return"w"}},{key:"getValidateRule",value:function(e){switch(e){case"start":case"update":return s(this._core);case"stop":return this._core,{name:"StopWatermarkOptions",required:!1}}}},{key:"getGroup",value:function(){return"w"}},{key:"start",value:(l=t(n().m(function e(t){return n().w(function(e){for(;;)if(0===e.n)return e.a(2,this.doStart(t))},e,this)})),function(e){return l.apply(this,arguments)})},{key:"update",value:(u=t(n().m(function e(t){return n().w(function(e){for(;;)switch(e.n){case 0:this.doStart(t);case 1:return e.a(2)}},e,this)})),function(e){return u.apply(this,arguments)})},{key:"stop",value:(a=t(n().m(function e(){return n().w(function(e){for(;;)if(0===e.n)return e.a(2,this._core.room.videoManager.deleteWatermark())},e,this)})),function(){return a.apply(this,arguments)})},{key:"doStart",value:(i=t(n().m(function e(t){var r,o,i,a,u;return n().w(function(e){for(;;)switch(e.n){case 0:return r=t.x,o=void 0===r?0:r,i=t.y,a=void 0===i?0:i,e.n=1,this.processWatermark(t);case 1:return u=e.v,e.a(2,this._core.room.videoManager.setWatermark({x:o,y:a,imageUrl:u}))}},e,this)})),function(e){return i.apply(this,arguments)})},{key:"processWatermark",value:(o=t(n().m(function e(t){var r,o,i,a,u,c,s,f,l,p,h,m,d,y,v,g,b,w,E,A,_,T,R,I,N,j;return n().w(function(e){for(;;)switch(e.p=e.n){case 0:return r=t.imageUrl,o=t.x,i=void 0===o?0:o,a=t.y,u=void 0===a?0:a,c=t.size,s=void 0===c?"cover":c,f=this._core.room.videoManager.cameraTrack,l=f.settings,p=f.rotation,e.p=1,e.n=2,this._core.utils.loadImage(r);case 2:h=e.v,e.n=4;break;case 3:throw e.p=3,e.v,m=this.core.errorModule,d=m.RtcError,y=m.ErrorCode,new d({code:y.INVALID_PARAMETER,message:"load image failed, url: ".concat(r)});case 4:return v=l.width,g=l.height,w=(b=h).width,E=b.height,this._core.utils.isRotate90Or270(p)&&(v=(A=[g,v])[0],g=A[1]),_=w,T=E,this._core.utils.isObject(s)&&(_=(null==s?void 0:s.width)||_,T=(null==s?void 0:s.height)||T),this._core.utils.isNumber(s)&&(_=w*s,T=E*s),I=(R=w/E)>v/g,"contain"===s&&(I?(_=v,T=v/R):(_=g*R,T=g)),"cover"===s&&(I?(T=g,_=g*R):(_=v,T=v/R)),N=document.createElement("canvas"),j=N.getContext("2d"),N.width=Math.min(v-i,_),N.height=Math.min(g-u,T),null==j||j.drawImage(h,0,0,_,T),e.a(2,N.toDataURL("image/png"))}},e,this,[[1,3]])})),function(e){return o.apply(this,arguments)})}]);var o,i,a,u,l}();return c(l,"Name","Watermark"),l});
3
+ var e,t,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",a=r.toStringTag||"@@toStringTag";function u(r,o,i,a){var u=o&&o.prototype instanceof s?o:s,f=Object.create(u.prototype);return n(f,"_invoke",function(r,o,n){var i,a,u,s=0,f=n||[],l=!1,d={p:0,n:0,v:e,a:m,f:m.bind(e,4),d:function(t,r){return i=t,a=0,u=e,d.n=r,c}};function m(r,o){for(a=r,u=o,t=0;!l&&s&&!n&&t<f.length;t++){var n,i=f[t],m=d.p,h=i[2];r>3?(n=h===o)&&(u=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=m&&((n=r<2&&m<i[1])?(a=0,d.v=o,d.n=i[1]):m<h&&(n=r<3||i[0]>o||o>h)&&(i[4]=r,i[5]=o,d.n=h,a=0))}if(n||r>1)return c;throw l=!0,o}return function(n,f,h){if(s>1)throw TypeError("Generator is already running");for(l&&1===f&&m(f,h),a=f,u=h;(t=a<2?e:u)||!l;){i||(a?a<3?(a>1&&(d.n=-1),m(a,u)):d.n=u:d.v=u);try{if(s=2,i){if(a||(n="next"),t=i[n]){if(!(t=t.call(i,u)))throw TypeError("iterator result is not an object");if(!t.done)return t;u=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(u=TypeError("The iterator does not provide a '"+n+"' method"),a=1);i=e}else if((t=(l=d.n<0)?u:r.call(o,d))!==c)break}catch(t){i=e,a=1,u=t}finally{s=1}}return{value:t,done:l}}}(r,i,a),!0),f}var c={};function s(){}function f(){}function l(){}t=Object.getPrototypeOf;var d=[][i]?t(t([][i]())):(n(t={},i,function(){return this}),t),m=l.prototype=s.prototype=Object.create(d);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,l):(e.__proto__=l,n(e,a,"GeneratorFunction")),e.prototype=Object.create(m),e}return f.prototype=l,n(m,"constructor",l),n(l,"constructor",f),f.displayName="GeneratorFunction",n(l,a,"GeneratorFunction"),n(m),n(m,a,"Generator"),n(m,i,function(){return this}),n(m,"toString",function(){return"[object Generator]"}),(o=function(){return{w:u,m:h}})()}function n(e,t,r,o){var i=Object.defineProperty;try{i({},"",{})}catch(e){i=0}n=function(e,t,r,o){function a(t,r){n(e,t,function(e){return this._invoke(t,r,e)})}t?i?i(e,t,{value:r,enumerable:!o,configurable:!o,writable:!o}):e[t]=r:(a("next",0),a("throw",1),a("return",2))},n(e,t,r,o)}function i(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,t);if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==typeof t?t:t+""}function a(e){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a(e)}var u=Object.defineProperty,c=function(e,t,r){return function(e,t,r){return t in e?u(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r}(e,"symbol"!==a(t)?t+"":t,r)};function s(e){return{name:"WatermarkOptions",type:"object",required:!0,allowEmpty:!1,properties:{imageUrl:{required:!1,type:"string"},x:{required:!1,type:"number"},y:{required:!1,type:"number"},size:{required:!1,type:["string","object","number"]},videoBlur:{required:!1,type:"number"}},validate:function(t,r,o,n){var i,a=e.errorModule,u=a.RtcError,c=a.ErrorCode,s=a.ErrorCodeDictionary;if(t){var f=t.imageUrl;if(f){var l=f.split("?")[0].split(".").pop();"jpg"!==l&&"jpeg"!==l||e.log.warn("The image format is not recommended to be jpg/jpeg, because the format does not support transparency.")}if(!f&&(e.utils.isUndefined(t.videoBlur)||t.videoBlur<=0))throw new u({code:c.INVALID_PARAMETER,message:"At least one of imageUrl or videoBlur must be provided",fnName:o});if(!(null==(i=e.room.videoManager.cameraTrack)?void 0:i.mediaTrack))throw new u({code:c.INVALID_OPERATION,extraCode:s.INVALID_OPERATION_NEED_VIDEO,fnName:o});if(e.utils.isString(t.size)&&"contain"!==t.size&&"cover"!==t.size)throw new u({code:c.INVALID_PARAMETER,extraCode:s.INVALID_PARAMETER_TYPE,message:"The size parameter must be 'contain' or 'cover'",fnName:o});if(e.utils.isNumber(t.size)&&(t.size<=0||t.size>1))throw new u({code:c.INVALID_PARAMETER,extraCode:s.INVALID_PARAMETER_RANGE,message:"The size parameter must be greater than 0",fnName:o});if(e.utils.isObject(t.size)){if(!t.size.width||!t.size.height)throw new u({code:c.INVALID_PARAMETER,extraCode:s.INVALID_PARAMETER_TYPE,message:"The size parameter must be an object with width and height properties",fnName:o});if(t.size.width<=0||t.size.height<=0)throw new u({code:c.INVALID_PARAMETER,extraCode:s.INVALID_PARAMETER_RANGE,message:"The size parameter must be greater than 0",fnName:o})}if(e.utils.isNumber(t.videoBlur)&&(t.videoBlur<0||t.videoBlur>50))throw new u({code:c.INVALID_PARAMETER,extraCode:s.INVALID_PARAMETER_RANGE,message:"The videoBlur parameter must be between 0 and 50",fnName:o})}}}}var f=0,l=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.core=t,c(this,"seq"),c(this,"_core"),c(this,"log"),c(this,"startResolve"),c(this,"startReject"),f+=1,this.seq=f,this._core=t,this.log=t.log.createChild({id:"".concat(this.getAlias()).concat(f)}),this.log.info("created")}return r(e,[{key:"getName",value:function(){return e.Name}},{key:"getAlias",value:function(){return"w"}},{key:"getValidateRule",value:function(e){switch(e){case"start":case"update":return s(this._core);case"stop":return this._core,{name:"StopWatermarkOptions",required:!1}}}},{key:"getGroup",value:function(){return"w"}},{key:"start",value:(l=t(o().m(function e(t){return o().w(function(e){for(;;)if(0===e.n)return e.a(2,this.doStart(t))},e,this)})),function(e){return l.apply(this,arguments)})},{key:"update",value:(u=t(o().m(function e(t){return o().w(function(e){for(;;)switch(e.n){case 0:this.doStart(t);case 1:return e.a(2)}},e,this)})),function(e){return u.apply(this,arguments)})},{key:"stop",value:(a=t(o().m(function e(){return o().w(function(e){for(;;)if(0===e.n)return this._core.room.videoManager.setVideoBlur(0),e.a(2,this._core.room.videoManager.deleteWatermark())},e,this)})),function(){return a.apply(this,arguments)})},{key:"doStart",value:(i=t(o().m(function e(t){var r,n,i,a,u,c,s,f;return o().w(function(e){for(;;)switch(e.n){case 0:if(r=t.x,n=void 0===r?0:r,i=t.y,a=void 0===i?0:i,u=t.videoBlur,c=void 0===u?0:u,s=t.imageUrl,this._core.room.videoManager.setVideoBlur(c),!s){e.n=2;break}return e.n=1,this.processWatermark(t);case 1:return f=e.v,e.a(2,this._core.room.videoManager.setWatermark({x:n,y:a,imageUrl:f}));case 2:return e.a(2)}},e,this)})),function(e){return i.apply(this,arguments)})},{key:"processWatermark",value:(n=t(o().m(function e(t){var r,n,i,a,u,c,s,f,l,d,m,h,p,v,y,g,b,w,A,E,_,R,T,N,I,P;return o().w(function(e){for(;;)switch(e.p=e.n){case 0:return r=t.imageUrl,n=t.x,i=void 0===n?0:n,a=t.y,u=void 0===a?0:a,c=t.size,s=void 0===c?"cover":c,f=this._core.room.videoManager.cameraTrack,l=f.settings,d=f.rotation,e.p=1,e.n=2,this._core.utils.loadImage(r);case 2:m=e.v,e.n=4;break;case 3:throw e.p=3,e.v,h=this.core.errorModule,p=h.RtcError,v=h.ErrorCode,new p({code:v.INVALID_PARAMETER,message:"load image failed, url: ".concat(r)});case 4:return y=l.width,g=l.height,w=(b=m).width,A=b.height,this._core.utils.isRotate90Or270(d)&&(y=(E=[g,y])[0],g=E[1]),_=w,R=A,this._core.utils.isObject(s)&&(_=(null==s?void 0:s.width)||_,R=(null==s?void 0:s.height)||R),this._core.utils.isNumber(s)&&(_=w*s,R=A*s),N=(T=w/A)>y/g,"contain"===s&&(N?(_=y,R=y/T):(_=g*T,R=g)),"cover"===s&&(N?(R=g,_=g*T):(_=y,R=y/T)),I=document.createElement("canvas"),P=I.getContext("2d"),I.width=Math.min(y-i,_),I.height=Math.min(g-u,R),null==P||P.drawImage(m,0,0,_,R),e.a(2,I.toDataURL("image/png"))}},e,this,[[1,3]])})),function(e){return n.apply(this,arguments)})}]);var n,i,a,u,l}();return c(l,"Name","Watermark"),l});
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rtc-plugin/voice-changer",
3
- "version": "5.18.3",
3
+ "version": "5.18.4-beta.2",
4
4
  "description": "",
5
5
  "main": "./voice-changer.esm.js",
6
6
  "keywords": [],