trtc-sdk-v5 5.11.2-beta.6 → 5.11.2-wasm.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.
Files changed (41) hide show
  1. package/assets/av_processing.wasm +0 -0
  2. package/assets/worker.js +17 -0
  3. package/package.json +4 -6
  4. package/plugins/cdn-streaming/cdn-streaming.esm.js +1 -1
  5. package/plugins/cdn-streaming/cdn-streaming.umd.js +1 -1
  6. package/plugins/cdn-streaming/package.json +1 -1
  7. package/plugins/cross-room/cross-room.esm.js +1 -1
  8. package/plugins/cross-room/cross-room.umd.js +1 -1
  9. package/plugins/cross-room/package.json +1 -1
  10. package/plugins/custom-encryption/custom-encryption.esm.js +1 -1
  11. package/plugins/custom-encryption/custom-encryption.umd.js +1 -1
  12. package/plugins/custom-encryption/package.json +1 -1
  13. package/plugins/device-detector/device-detector.esm.js +36 -24
  14. package/plugins/device-detector/device-detector.umd.js +21 -7
  15. package/plugins/device-detector/package.json +1 -1
  16. package/plugins/small-stream-auto-switcher/package.json +1 -1
  17. package/plugins/small-stream-auto-switcher/small-stream-auto-switcher.esm.js +1 -1
  18. package/plugins/small-stream-auto-switcher/small-stream-auto-switcher.umd.js +1 -1
  19. package/plugins/video-decoder/package.json +1 -1
  20. package/plugins/video-decoder/video-decoder.esm.js +1 -1
  21. package/plugins/video-decoder/video-decoder.umd.js +1 -1
  22. package/plugins/video-effect/basic-beauty/basic-beauty.esm.js +1 -1
  23. package/plugins/video-effect/basic-beauty/basic-beauty.umd.js +1 -1
  24. package/plugins/video-effect/basic-beauty/package.json +1 -1
  25. package/plugins/video-effect/beauty/beauty.esm.js +1 -1
  26. package/plugins/video-effect/beauty/beauty.umd.js +1 -1
  27. package/plugins/video-effect/beauty/package.json +1 -1
  28. package/plugins/video-effect/video-mixer/package.json +1 -1
  29. package/plugins/video-effect/video-mixer/video-mixer.esm.js +1 -1
  30. package/plugins/video-effect/video-mixer/video-mixer.umd.js +1 -1
  31. package/plugins/video-effect/virtual-background/package.json +1 -1
  32. package/plugins/video-effect/virtual-background/virtual-background.esm.js +1 -1
  33. package/plugins/video-effect/virtual-background/virtual-background.umd.js +1 -1
  34. package/plugins/video-effect/watermark/package.json +1 -1
  35. package/plugins/video-effect/watermark/watermark.esm.js +1 -1
  36. package/plugins/video-effect/watermark/watermark.umd.js +1 -1
  37. package/plugins/voice-changer/package.json +1 -1
  38. package/plugins/voice-changer/voice-changer.esm.js +1 -1
  39. package/plugins/voice-changer/voice-changer.umd.js +1 -1
  40. package/trtc.esm.js +64 -43
  41. package/trtc.js +1 -1
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rtc-plugin/watermark",
3
- "version": "5.11.2-beta.6",
3
+ "version": "5.11.2-wasm.2",
4
4
  "description": "TRTC Web SDK 5.x watermark plugin",
5
5
  "main": "./watermark.esm.js",
6
6
  "module": "./watermark.esm.js",
@@ -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
+ 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){const{RtcError:s,ErrorCode:o,ErrorCodeDictionary:n}=e.errorModule;if(!t)return;const{imageUrl:c}=t,d=c.split("?")[0].split(".").pop();if("jpg"!==d&&"jpeg"!==d||e.log.warn("The image format is not recommended to be jpg/jpeg, because the format does not support transparency."),!e.room.videoManager.cameraTrack?.mediaTrack)throw new s({code:o.INVALID_OPERATION,extraCode:n.INVALID_OPERATION_NEED_VIDEO,fnName:a});if(e.utils.isString(t.size)&&"contain"!==t.size&&"cover"!==t.size)throw new s({code:o.INVALID_PARAMETER,extraCode:n.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:o.INVALID_PARAMETER,extraCode:n.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:o.INVALID_PARAMETER,extraCode:n.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:o.INVALID_PARAMETER,extraCode:n.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,wSeq+=1,this.seq=wSeq,this._core=e,this.log=e.log.createChild({id:`${this.getAlias()}${wSeq}`}),this.log.info("created")}seq;_core;log;startResolve;startReject;static Name="Watermark";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:s,rotation:o}=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}=s;const{width:m,height:h}=n;this._core.utils.isRotate90Or270(o)&&([c,d]=[d,c]);let u=m,l=h;this._core.utils.isObject(i)&&(u=i?.width||u,l=i?.height||l),this._core.utils.isNumber(i)&&(u=m*i,l=h*i);const g=m/h,p=g>c/d;"contain"===i&&(p?(u=c,l=c/g):(u=d*g,l=d)),"cover"===i&&(p?(l=d,u=d*g):(u=c,l=c/g));const A=document.createElement("canvas"),E=A.getContext("2d");return A.width=Math.min(c-r,u),A.height=Math.min(d-a,l),E?.drawImage(n,0,0,u,l),A.toDataURL("image/png")}},index_default=Watermark;export{index_default as default};export{Watermark};
@@ -1 +1 @@
1
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Watermark=e()}(this,(function(){"use strict";function t(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function e(e){return function(){var r=this,n=arguments;return new Promise((function(o,i){var a=e.apply(r,n);function c(e){t(a,o,i,c,u,"next",e)}function u(e){t(a,o,i,c,u,"throw",e)}c(void 0)}))}}function r(t,e,r){return e&&function(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,o(n.key),n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function n(){n=function(){return e};var t,e={},r=Object.prototype,o=r.hasOwnProperty,i=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},c=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",s=a.toStringTag||"@@toStringTag";function f(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{f({},"")}catch(t){f=function(t,e,r){return t[e]=r}}function h(t,e,r,n){var o=e&&e.prototype instanceof g?e:g,a=Object.create(o.prototype),c=new R(n||[]);return i(a,"_invoke",{value:N(t,r,c)}),a}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=h;var p="suspendedStart",d="suspendedYield",y="executing",v="completed",m={};function g(){}function w(){}function b(){}var E={};f(E,c,(function(){return this}));var x=Object.getPrototypeOf,_=x&&x(x(O([])));_&&_!==r&&o.call(_,c)&&(E=_);var L=b.prototype=g.prototype=Object.create(E);function A(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function k(t,e){function r(n,i,a,c){var u=l(t[n],t,i);if("throw"!==u.type){var s=u.arg,f=s.value;return f&&"object"==typeof f&&o.call(f,"__await")?e.resolve(f.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(f).then((function(t){s.value=t,a(s)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var n;i(this,"_invoke",{value:function(t,o){function i(){return new e((function(e,n){r(t,o,e,n)}))}return n=n?n.then(i,i):i()}})}function N(e,r,n){var o=p;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===v){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=T(c,n);if(u){if(u===m)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var s=l(e,r,n);if("normal"===s.type){if(o=n.done?v:d,s.arg===m)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=v,n.method="throw",n.arg=s.arg)}}}function T(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,T(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=l(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,m;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,m):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function I(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function R(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(I,this),this.reset(!0)}function O(e){if(e||""===e){var r=e[c];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function r(){for(;++n<e.length;)if(o.call(e,n))return r.value=e[n],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(typeof e+" is not iterable")}return w.prototype=b,i(L,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:w,configurable:!0}),w.displayName=f(b,s,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,f(t,s,"GeneratorFunction")),t.prototype=Object.create(L),t},e.awrap=function(t){return{__await:t}},A(k.prototype),f(k.prototype,u,(function(){return this})),e.AsyncIterator=k,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new k(h(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},A(L),f(L,s,"Generator"),f(L,c,(function(){return this})),f(L,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=O,R.prototype={constructor:R,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(j),!e)for(var r in this)"t"===r.charAt(0)&&o.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=o.call(a,"catchLoc"),s=o.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),j(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;j(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:O(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),m}},e}function o(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e);if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t,"string");return"symbol"==typeof e?e:e+""}function i(t){return i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},i(t)}var a=Object.defineProperty,c=function(t,e,r){return function(t,e,r){return e in t?a(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r}(t,"symbol"!==i(e)?e+"":e,r)};function u(t){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(e,r,n,o){var i,a=t.errorModule,c=a.RtcError,u=a.ErrorCode,s=a.ErrorCodeDictionary;if(e){var f=e.imageUrl.split("?")[0].split(".").pop();if("jpg"!==f&&"jpeg"!==f||t.log.warn("The image format is not recommended to be jpg/jpeg, because the format does not support transparency."),!(null==(i=t.room.videoManager.cameraTrack)?void 0:i.mediaTrack))throw new c({code:u.INVALID_OPERATION,extraCode:s.INVALID_OPERATION_NEED_VIDEO,fnName:n});if(t.utils.isString(e.size)&&"contain"!==e.size&&"cover"!==e.size)throw new c({code:u.INVALID_PARAMETER,extraCode:s.INVALID_PARAMETER_TYPE,message:"The size parameter must be 'contain' or 'cover'",fnName:n});if(t.utils.isNumber(e.size)&&(e.size<=0||e.size>1))throw new c({code:u.INVALID_PARAMETER,extraCode:s.INVALID_PARAMETER_RANGE,message:"The size parameter must be greater than 0",fnName:n});if(t.utils.isObject(e.size)){if(!e.size.width||!e.size.height)throw new c({code:u.INVALID_PARAMETER,extraCode:s.INVALID_PARAMETER_TYPE,message:"The size parameter must be an object with width and height properties",fnName:n});if(e.size.width<=0||e.size.height<=0)throw new c({code:u.INVALID_PARAMETER,extraCode:s.INVALID_PARAMETER_RANGE,message:"The size parameter must be greater than 0",fnName:n})}}}}}var s=0,f=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.core=e,c(this,"seq"),c(this,"_core"),c(this,"log"),c(this,"startResolve"),c(this,"startReject"),s+=1,this.seq=s,this._core=e,this.log=e.log.createChild({id:"".concat(this.getAlias()).concat(s)}),this.log.info("created")}return r(t,[{key:"getName",value:function(){return t.Name}},{key:"getAlias",value:function(){return"w"}},{key:"getValidateRule",value:function(t){switch(t){case"start":case"update":return u(this._core);case"stop":return this._core,{name:"StopWatermarkOptions",required:!1}}}},{key:"getGroup",value:function(){return"w"}},{key:"start",value:(h=e(n().mark((function t(e){return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.doStart(e));case 1:case"end":return t.stop()}}),t,this)}))),function(t){return h.apply(this,arguments)})},{key:"update",value:(f=e(n().mark((function t(e){return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:this.doStart(e);case 1:case"end":return t.stop()}}),t,this)}))),function(t){return f.apply(this,arguments)})},{key:"stop",value:(a=e(n().mark((function t(){return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this._core.room.videoManager.deleteWatermark());case 1:case"end":return t.stop()}}),t,this)}))),function(){return a.apply(this,arguments)})},{key:"doStart",value:(i=e(n().mark((function t(e){var r,o,i,a,c;return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.x,o=void 0===r?0:r,i=e.y,a=void 0===i?0:i,t.next=3,this.processWatermark(e);case 3:return c=t.sent,t.abrupt("return",this._core.room.videoManager.setWatermark({x:o,y:a,imageUrl:c}));case 5:case"end":return t.stop()}}),t,this)}))),function(t){return i.apply(this,arguments)})},{key:"processWatermark",value:(o=e(n().mark((function t(e){var r,o,i,a,c,u,s,f,h,l,p,d,y,v,m,g,w,b,E,x,_,L,A,k,N,T;return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.imageUrl,o=e.x,i=void 0===o?0:o,a=e.y,c=void 0===a?0:a,u=e.size,s=void 0===u?"cover":u,f=this._core.room.videoManager.cameraTrack,h=f.settings,l=f.rotation,t.prev=2,t.next=5,this._core.utils.loadImage(r);case 5:p=t.sent,t.next=12;break;case 8:throw t.prev=8,t.t0=t.catch(2),d=this.core.errorModule,y=d.RtcError,v=d.ErrorCode,new y({code:v.INVALID_PARAMETER,message:"load image failed, url: ".concat(r)});case 12:return m=h.width,g=h.height,b=(w=p).width,E=w.height,this._core.utils.isRotate90Or270(l)&&(m=(x=[g,m])[0],g=x[1]),_=b,L=E,this._core.utils.isObject(s)&&(_=(null==s?void 0:s.width)||_,L=(null==s?void 0:s.height)||L),this._core.utils.isNumber(s)&&(_=b*s,L=E*s),k=(A=b/E)>m/g,"contain"===s&&(k?(_=m,L=m/A):(_=g*A,L=g)),"cover"===s&&(k?(L=g,_=g*A):(_=m,L=m/A)),N=document.createElement("canvas"),T=N.getContext("2d"),N.width=Math.min(m-i,_),N.height=Math.min(g-c,L),null==T||T.drawImage(p,0,0,_,L),t.abrupt("return",N.toDataURL("image/png"));case 29:case"end":return t.stop()}}),t,this,[[2,8]])}))),function(t){return o.apply(this,arguments)})}]);var o,i,a,f,h}();return c(f,"Name","Watermark"),f}));
1
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Watermark=e()}(this,(function(){"use strict";function t(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function e(e){return function(){var r=this,n=arguments;return new Promise((function(o,i){var a=e.apply(r,n);function c(e){t(a,o,i,c,u,"next",e)}function u(e){t(a,o,i,c,u,"throw",e)}c(void 0)}))}}function r(t,e,r){return e&&function(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,i(n.key),n)}}(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function n(t,e,r){return(e=i(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function o(){o=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,i=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},c=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",s=a.toStringTag||"@@toStringTag";function h(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{h({},"")}catch(t){h=function(t,e,r){return t[e]=r}}function f(t,e,r,n){var o=e&&e.prototype instanceof g?e:g,a=Object.create(o.prototype),c=new R(n||[]);return i(a,"_invoke",{value:N(t,r,c)}),a}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=f;var p="suspendedStart",d="suspendedYield",v="executing",y="completed",m={};function g(){}function w(){}function b(){}var E={};h(E,c,(function(){return this}));var x=Object.getPrototypeOf,_=x&&x(x(O([])));_&&_!==r&&n.call(_,c)&&(E=_);var L=b.prototype=g.prototype=Object.create(E);function A(t){["next","throw","return"].forEach((function(e){h(t,e,(function(t){return this._invoke(e,t)}))}))}function k(t,e){function r(o,i,a,c){var u=l(t[o],t,i);if("throw"!==u.type){var s=u.arg,h=s.value;return h&&"object"==typeof h&&n.call(h,"__await")?e.resolve(h.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(h).then((function(t){s.value=t,a(s)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var o;i(this,"_invoke",{value:function(t,n){function i(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(i,i):i()}})}function N(e,r,n){var o=p;return function(i,a){if(o===v)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=T(c,n);if(u){if(u===m)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=y,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=v;var s=l(e,r,n);if("normal"===s.type){if(o=n.done?y:d,s.arg===m)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=y,n.method="throw",n.arg=s.arg)}}}function T(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,T(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=l(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,m;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,m):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function I(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function j(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function R(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(I,this),this.reset(!0)}function O(e){if(e||""===e){var r=e[c];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(typeof e+" is not iterable")}return w.prototype=b,i(L,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:w,configurable:!0}),w.displayName=h(b,s,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,b):(t.__proto__=b,h(t,s,"GeneratorFunction")),t.prototype=Object.create(L),t},e.awrap=function(t){return{__await:t}},A(k.prototype),h(k.prototype,u,(function(){return this})),e.AsyncIterator=k,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new k(f(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},A(L),h(L,s,"Generator"),h(L,c,(function(){return this})),h(L,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=O,R.prototype={constructor:R,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(j),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),s=n.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),m},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),j(r),m}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;j(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:O(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),m}},e}function i(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e);if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}var a;function c(t){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(e,r,n,o){var i,a=t.errorModule,c=a.RtcError,u=a.ErrorCode,s=a.ErrorCodeDictionary;if(e){var h=e.imageUrl.split("?")[0].split(".").pop();if("jpg"!==h&&"jpeg"!==h||t.log.warn("The image format is not recommended to be jpg/jpeg, because the format does not support transparency."),null===(i=t.room.videoManager.cameraTrack)||void 0===i||!i.mediaTrack)throw new c({code:u.INVALID_OPERATION,extraCode:s.INVALID_OPERATION_NEED_VIDEO,fnName:n});if(t.utils.isString(e.size)&&"contain"!==e.size&&"cover"!==e.size)throw new c({code:u.INVALID_PARAMETER,extraCode:s.INVALID_PARAMETER_TYPE,message:"The size parameter must be 'contain' or 'cover'",fnName:n});if(t.utils.isNumber(e.size)&&(e.size<=0||e.size>1))throw new c({code:u.INVALID_PARAMETER,extraCode:s.INVALID_PARAMETER_RANGE,message:"The size parameter must be greater than 0",fnName:n});if(t.utils.isObject(e.size)){if(!e.size.width||!e.size.height)throw new c({code:u.INVALID_PARAMETER,extraCode:s.INVALID_PARAMETER_TYPE,message:"The size parameter must be an object with width and height properties",fnName:n});if(e.size.width<=0||e.size.height<=0)throw new c({code:u.INVALID_PARAMETER,extraCode:s.INVALID_PARAMETER_RANGE,message:"The size parameter must be greater than 0",fnName:n})}}}}}var u=0,s=(a=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),n(this,"seq",void 0),n(this,"_core",void 0),n(this,"log",void 0),n(this,"startResolve",void 0),n(this,"startReject",void 0),this.core=e,u+=1,this.seq=u,this._core=e,this.log=e.log.createChild({id:"".concat(this.getAlias()).concat(u)}),this.log.info("created")}return r(t,[{key:"getName",value:function(){return t.Name}},{key:"getAlias",value:function(){return"w"}},{key:"getValidateRule",value:function(t){switch(t){case"start":case"update":return c(this._core);case"stop":return this._core,{name:"StopWatermarkOptions",required:!1}}}},{key:"getGroup",value:function(){return"w"}},{key:"start",value:(f=e(o().mark((function t(e){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.doStart(e));case 1:case"end":return t.stop()}}),t,this)}))),function(t){return f.apply(this,arguments)})},{key:"update",value:(h=e(o().mark((function t(e){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:this.doStart(e);case 1:case"end":return t.stop()}}),t,this)}))),function(t){return h.apply(this,arguments)})},{key:"stop",value:(s=e(o().mark((function t(){return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this._core.room.videoManager.deleteWatermark());case 1:case"end":return t.stop()}}),t,this)}))),function(){return s.apply(this,arguments)})},{key:"doStart",value:(a=e(o().mark((function t(e){var r,n,i,a,c;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.x,n=void 0===r?0:r,i=e.y,a=void 0===i?0:i,t.next=3,this.processWatermark(e);case 3:return c=t.sent,t.abrupt("return",this._core.room.videoManager.setWatermark({x:n,y:a,imageUrl:c}));case 5:case"end":return t.stop()}}),t,this)}))),function(t){return a.apply(this,arguments)})},{key:"processWatermark",value:(i=e(o().mark((function t(e){var r,n,i,a,c,u,s,h,f,l,p,d,v,y,m,g,w,b,E,x,_,L,A,k,N,T;return o().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.imageUrl,n=e.x,i=void 0===n?0:n,a=e.y,c=void 0===a?0:a,u=e.size,s=void 0===u?"cover":u,h=this._core.room.videoManager.cameraTrack,f=h.settings,l=h.rotation,t.prev=2,t.next=5,this._core.utils.loadImage(r);case 5:p=t.sent,t.next=12;break;case 8:throw t.prev=8,t.t0=t.catch(2),d=this.core.errorModule,v=d.RtcError,y=d.ErrorCode,new v({code:y.INVALID_PARAMETER,message:"load image failed, url: ".concat(r)});case 12:return m=f.width,g=f.height,b=(w=p).width,E=w.height,this._core.utils.isRotate90Or270(l)&&(m=(x=[g,m])[0],g=x[1]),_=b,L=E,this._core.utils.isObject(s)&&(_=(null==s?void 0:s.width)||_,L=(null==s?void 0:s.height)||L),this._core.utils.isNumber(s)&&(_=b*s,L=E*s),k=(A=b/E)>m/g,"contain"===s&&(k?(_=m,L=m/A):(_=g*A,L=g)),"cover"===s&&(k?(L=g,_=g*A):(_=m,L=m/A)),N=document.createElement("canvas"),T=N.getContext("2d"),N.width=Math.min(m-i,_),N.height=Math.min(g-c,L),null==T||T.drawImage(p,0,0,_,L),t.abrupt("return",N.toDataURL("image/png"));case 29:case"end":return t.stop()}}),t,this,[[2,8]])}))),function(t){return i.apply(this,arguments)})}]);var i,a,s,h,f}(),n(a,"Name","Watermark"),a);return s}));
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rtc-plugin/voice-changer",
3
- "version": "5.11.2-beta.6",
3
+ "version": "5.11.2-wasm.2",
4
4
  "description": "",
5
5
  "main": "./voice-changer.esm.js",
6
6
  "keywords": [],