trtc-sdk-v5 5.7.1 → 5.7.2-beta.1

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/index.d.ts CHANGED
@@ -83,7 +83,6 @@ declare interface RemoteVideoConfig {
83
83
  small?: boolean;
84
84
  receiveWhenViewVisible?: boolean;
85
85
  viewRoot?: HTMLElement;
86
- canvasRender?: boolean;
87
86
  };
88
87
  }
89
88
  declare interface StopRemoteVideoConfig {
@@ -630,7 +629,7 @@ declare const TRTCEvent: {
630
629
  * @default 'connection-state-changed'
631
630
  * @memberof module:EVENT
632
631
  * @example
633
- * trtc.on(TRTC.EVENT.CONNECTION_STATE_CHANGED, event => {
632
+ * trtc.on(TRTC.CONNECTION_STATE_CHANGED, event => {
634
633
  * const prevState = event.prevState;
635
634
  * const curState = event.state;
636
635
  * });
@@ -1408,9 +1407,8 @@ declare interface TRTCEventTypes {
1408
1407
  * - {@link module:ERROR_CODE.OPERATION_ABORT OPERATION_ABORT}
1409
1408
  * @example
1410
1409
  * const config = {
1411
- * view: document.getElementById(userId), // you can use a new view to update the position of video.
1410
+ * view: document.getElementById(userId),
1412
1411
  * userId,
1413
- * streamType: TRTC.TYPE.STREAM_TYPE_MAIN
1414
1412
  * }
1415
1413
  * await trtc.updateRemoteVideo(config);
1416
1414
  * @memberof TRTC
@@ -1693,53 +1691,6 @@ declare interface TRTCEventTypes {
1693
1691
  readonly VIDEO_PLAY_STATE_CHANGED: "video-play-state-changed";
1694
1692
  readonly SCREEN_SHARE_STOPPED: "screen-share-stopped";
1695
1693
  readonly DEVICE_CHANGED: "device-changed";
1696
- /**
1697
- * Enter a video call room.<br>
1698
- * - Entering a room means starting a video call session. Only after entering the room successfully can you make audio and video calls with other users in the room.
1699
- * - You can publish local audio and video streams through {@link TRTC#startLocalVideo startLocalVideo()} and {@link TRTC#startLocalAudio startLocalAudio()} respectively. After successful publishing, other users in the room will receive the {@link module:EVENT.REMOTE_AUDIO_AVAILABLE REMOTE_AUDIO_AVAILABLE} and {@link module:EVENT.REMOTE_VIDEO_AVAILABLE REMOTE_VIDEO_AVAILABLE} event notifications.
1700
- * - By default, the SDK automatically plays remote audio. You need to call {@link TRTC#startRemoteVideo startRemoteVideo()} to play remote video.
1701
- *
1702
- * @param {object} options Enter room parameters
1703
- * @param {number} options.sdkAppId sdkAppId <br>
1704
- * You can obtain the sdkAppId information in the **Application Information** section after creating a new application by clicking **Application Management** > **Create Application** in the [TRTC Console](https://console.intl.cloud.tencent.com/trtc).
1705
- * @param {string} options.userId User ID <br>
1706
- * It is recommended to limit the length to 32 bytes, and only allow uppercase and lowercase English letters (a-zA-Z), numbers (0-9), underscores, and hyphens.
1707
- * @param {string} options.userSig UserSig signature <br>
1708
- * Please refer to [UserSig related](https://www.tencentcloud.com/document/product/647/35166) for the calculation method of userSig.
1709
- * @param {number=} options.roomId
1710
- * the value must be an integer between 1 and 4294967294<br>
1711
- * <font color="red">If you need to use a string type room id, please use the strRoomId parameter. One of roomId and strRoomId must be passed in. If both are passed in, the roomId will be selected first.</font>
1712
- * @param {string=} options.strRoomId
1713
- * String type room id, the length is limited to 64 bytes, and only supports the following characters:
1714
- * - Uppercase and lowercase English letters (a-zA-Z)
1715
- * - Numbers (0-9)
1716
- * - Space ! # $ % & ( ) + - : ; < = . > ? @ [ ] ^ _ { } | ~ ,
1717
- * <font color="red">Note: It is recommended to use a numeric type roomId. The string type room id "123" is not the same room as the numeric type room id 123.</font>
1718
- * @param {string} [options.scene] Application scene, currently supports the following two scenes:
1719
- * - {@link module:TYPE.SCENE_RTC TRTC.TYPE.SCENE_RTC} (default) Real-time call scene, which is suitable for 1-to-1 audio and video calls, or online meetings with up to 300 participants. {@tutorial 04-info-uplink-limits}.
1720
- * - {@link module:TYPE.SCENE_LIVE TRTC.TYPE.SCENE_LIVE} Interactive live streaming scene, which is suitable for online live streaming scenes with up to 100,000 people, but you need to specify the role field in the options parameter introduced next.
1721
- * @param {string=} [options.role] User role, only meaningful in the {@link module:TYPE.SCENE_LIVE TRTC.TYPE.SCENE_LIVE} scene, and the {@link module:TYPE.SCENE_RTC TRTC.TYPE.SCENE_RTC} scene does not need to specify the role. Currently supports two roles:
1722
- * - {@link module:TYPE.ROLE_ANCHOR TRTC.TYPE.ROLE_ANCHOR} (default) Anchor
1723
- * - {@link module:TYPE.ROLE_AUDIENCE TRTC.TYPE.ROLE_AUDIENCE} Audience
1724
- * Note: The audience role does not have the permission to publish local audio and video, only the permission to watch remote streams. If the audience wants to interact with the anchor by connecting to the microphone, please switch the role to the anchor through {@link TRTC#switchRole switchRole()} before publishing local audio and video.
1725
- * @param {boolean} [options.autoReceiveAudio=true] Whether to automatically receive audio. When a remote user publishes audio, the SDK automatically plays the remote user's audio.
1726
- * @param {boolean} [options.autoReceiveVideo=false] Whether to automatically receive video. When a remote user publishes video, the SDK automatically subscribes and decodes the remote video. You need to call {@link TRTC#startRemoteVideo startRemoteVideo} to play the remote video.
1727
- * - The default value was changed to `false` since v5.6.0. Refer to [Breaking Changed for v5.6.0](https://web.sdk.qcloud.com/trtc/webrtc/v5/doc/en/tutorial-00-info-update-guideline.html).
1728
- * @param {boolean} [options.enableAutoPlayDialog] Whether to enable the SDK's automatic playback failure dialog box, default: true.
1729
- * - Enabled by default. When automatic playback fails, the SDK will pop up a dialog box to guide the user to click the page to restore audio and video playback.
1730
- * - Can be set to false in order to turn off. Refer to {@tutorial 21-advanced-auto-play-policy}.
1731
- * @param {string|ProxyServer} [options.proxy] proxy config. Refer to {@tutorial 34-advanced-proxy}.
1732
- * @param {boolean} [options.privateMapKey] Key for entering a room. If permission control is required, please carry this parameter (empty or incorrect value will cause a failure in entering the room).<br>[privateMapKey permission configuration](https://www.tencentcloud.com/document/product/647/35157?lang=en&pg=).
1733
- * @throws
1734
- * - {@link module:ERROR_CODE.INVALID_PARAMETER INVALID_PARAMETER}
1735
- * - {@link module:ERROR_CODE.OPERATION_FAILED OPERATION_FAILED}
1736
- * - {@link module:ERROR_CODE.OPERATION_ABORT OPERATION_ABORT}
1737
- * - {@link module:ERROR_CODE.ENV_NOT_SUPPORTED ENV_NOT_SUPPORTED}
1738
- * - {@link module:ERROR_CODE.SERVER_ERROR SERVER_ERROR}
1739
- * @example
1740
- * const trtc = TRTC.create();
1741
- * await trtc.enterRoom({ roomId: 8888, sdkAppId, userId, userSig });
1742
- */
1743
1694
  readonly PUBLISH_STATE_CHANGED: "publish-state-changed";
1744
1695
  readonly TRACK: "track";
1745
1696
  readonly STATISTICS: "statistics";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "trtc-sdk-v5",
3
- "version": "5.7.1",
3
+ "version": "5.7.2-beta.1",
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/cdn-streaming",
3
- "version": "5.7.1",
3
+ "version": "5.7.2-beta.1",
4
4
  "description": "TRTC Web SDK 5.x CDN streaming plugin",
5
5
  "main": "./cdn-streaming.esm.js",
6
6
  "author": "longyuqi <longyuqi@tencent.com>",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rtc-plugin/basic-beauty",
3
- "version": "5.7.1",
3
+ "version": "5.7.2-beta.1",
4
4
  "description": "TRTC Web SDK 5.x basic-beauty plugin",
5
5
  "main": "./basic-beauty.esm.js",
6
6
  "author": "longyuqi <longyuqi@tencent.com>",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rtc-plugin/beauty",
3
- "version": "5.7.1",
3
+ "version": "5.7.2-beta.1",
4
4
  "description": "TRTC Web SDK 5.x beauty plugin",
5
5
  "main": "./beauty.esm.js",
6
6
  "author": "longyuqi <longyuqi@tencent.com>",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rtc-plugin/virtual-background",
3
- "version": "5.7.1",
3
+ "version": "5.7.2-beta.1",
4
4
  "description": "TRTC Web SDK 5.x virtual background plugin",
5
5
  "main": "./virtual-background.esm.js",
6
6
  "author": "longyuqi <longyuqi@tencent.com>",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rtc-plugin/watermark",
3
- "version": "5.7.1",
3
+ "version": "5.7.2-beta.1",
4
4
  "description": "TRTC Web SDK 5.x watermark plugin",
5
5
  "main": "./watermark.esm.js",
6
6
  "author": "longyuqi <longyuqi@tencent.com>",
@@ -1 +1 @@
1
- var U=Object.defineProperty;var C=(a,e,o)=>e in a?U(a,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):a[e]=o;var u=(a,e,o)=>(C(a,typeof e!="symbol"?e+"":e,o),o);function D(a){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(e,o,n,g){var p;let{RtcError:r,ErrorCode:d,ErrorCodeDictionary:t}=a.errorModule;if(!e)return;let{imageUrl:m}=e,c=m.split("?")[0].split(".").pop();if((c==="jpg"||c==="jpeg")&&a.log.warn("The image format is not recommended to be jpg/jpeg, because the format does not support transparency."),!((p=a.room.videoManager.cameraTrack)!=null&&p.mediaTrack))throw new r({code:d.INVALID_OPERATION,extraCode:t.INVALID_OPERATION_NEED_VIDEO,fnName:n});if(a.utils.isString(e.size)&&e.size!=="contain"&&e.size!=="cover")throw new r({code:d.INVALID_PARAMETER,extraCode:t.INVALID_PARAMETER_TYPE,message:"The size parameter must be 'contain' or 'cover'",fnName:n});if(a.utils.isNumber(e.size)&&(e.size<=0||e.size>1))throw new r({code:d.INVALID_PARAMETER,extraCode:t.INVALID_PARAMETER_RANGE,message:"The size parameter must be greater than 0",fnName:n});if(a.utils.isObject(e.size)){if(!e.size.width||!e.size.height)throw new r({code:d.INVALID_PARAMETER,extraCode:t.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 r({code:d.INVALID_PARAMETER,extraCode:t.INVALID_PARAMETER_RANGE,message:"The size parameter must be greater than 0",fnName:n})}}}}function R(a){return{name:"StopWatermarkOptions",required:!1}}var E=0,S=class S{constructor(e){this.core=e;u(this,"seq");u(this,"_core");u(this,"log");u(this,"startResolve");u(this,"startReject");E=E+1,this.seq=E,this._core=e,this.log=e.log.createChild({id:`${this.getAlias()}${E}`}),this.log.info("created")}getName(){return S.Name}getAlias(){return"w"}getValidateRule(e){switch(e){case"start":return D(this._core);case"update":return R(this._core);case"stop":return R(this._core)}}getGroup(){return"w"}async start(e){return this.doStart(e)}async update(e){return await this.stop(),this.doStart(e)}async stop(){return this._core.room.videoManager.deleteWatermark()}async doStart(e){let{imageUrl:o,x:n=0,y:g=0,size:r="cover"}=e,{settings:d}=this._core.room.videoManager.cameraTrack,t;try{t=await this._core.utils.loadImage(o)}catch(y){let{RtcError:h,ErrorCode:N}=this.core.errorModule;throw new h({code:N.INVALID_PARAMETER,message:`load image failed, url: ${o}`})}let{width:m,height:l}=d,{width:c,height:p}=t,i=c,s=p;this._core.utils.isObject(r)&&(i=(r==null?void 0:r.width)||i,s=(r==null?void 0:r.height)||s),this._core.utils.isNumber(r)&&(i=c*r,s=p*r);let T=c/p,O=m/l,I=T>O;r==="contain"&&(I?(i=m,s=m/T):(i=l*T,s=l)),r==="cover"&&(I?(s=l,i=l*T):(i=m,s=m/T));let b=document.createElement("canvas"),A=b.getContext("2d");return b.width=Math.min(m-n,i),b.height=Math.min(l-g,s),A==null||A.drawImage(t,0,0,i,s),this._core.room.videoManager.setWatermark({x:n,y:g,imageUrl:b.toDataURL("image/png")})}};u(S,"Name","Watermark");var _=S;var G=_;export{_ as Watermark,G as default};
1
+ var h=Object.defineProperty;var C=(a,e,o)=>e in a?h(a,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):a[e]=o;var u=(a,e,o)=>(C(a,typeof e!="symbol"?e+"":e,o),o);function D(a){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(e,o,n,g){var p;let{RtcError:r,ErrorCode:d,ErrorCodeDictionary:t}=a.errorModule;if(!e)return;let{imageUrl:m}=e,c=m.split("?")[0].split(".").pop();if((c==="jpg"||c==="jpeg")&&a.log.warn("The image format is not recommended to be jpg/jpeg, because the format does not support transparency."),!((p=a.room.videoManager.cameraTrack)!=null&&p.mediaTrack))throw new r({code:d.INVALID_OPERATION,extraCode:t.INVALID_OPERATION_NEED_VIDEO,fnName:n});if(a.utils.isString(e.size)&&e.size!=="contain"&&e.size!=="cover")throw new r({code:d.INVALID_PARAMETER,extraCode:t.INVALID_PARAMETER_TYPE,message:"The size parameter must be 'contain' or 'cover'",fnName:n});if(a.utils.isNumber(e.size)&&(e.size<=0||e.size>1))throw new r({code:d.INVALID_PARAMETER,extraCode:t.INVALID_PARAMETER_RANGE,message:"The size parameter must be greater than 0",fnName:n});if(a.utils.isObject(e.size)){if(!e.size.width||!e.size.height)throw new r({code:d.INVALID_PARAMETER,extraCode:t.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 r({code:d.INVALID_PARAMETER,extraCode:t.INVALID_PARAMETER_RANGE,message:"The size parameter must be greater than 0",fnName:n})}}}}function R(a){return{name:"StopWatermarkOptions",required:!1}}var E=0,S=class S{constructor(e){this.core=e;u(this,"seq");u(this,"_core");u(this,"log");u(this,"startResolve");u(this,"startReject");E=E+1,this.seq=E,this._core=e,this.log=e.log.createChild({id:`${this.getAlias()}${E}`}),this.log.info("created")}getName(){return S.Name}getAlias(){return"w"}getValidateRule(e){switch(e){case"start":return D(this._core);case"update":return R(this._core);case"stop":return R(this._core)}}getGroup(){return"w"}async start(e){return this.doStart(e)}async update(e){return await this.stop(),this.doStart(e)}async stop(){return this._core.room.videoManager.deleteWatermark()}async doStart(e){let{imageUrl:o,x:n=0,y:g=0,size:r="cover"}=e,{settings:d}=this._core.room.videoManager.cameraTrack,t;try{t=await this._core.utils.loadImage(o)}catch(y){let{RtcError:N,ErrorCode:U}=this.core.errorModule;throw new N({code:U.INVALID_PARAMETER,message:`load image failed, url: ${o}`})}let{width:m,height:l}=d,{width:c,height:p}=t,i=c,s=p;this._core.utils.isObject(r)&&(i=(r==null?void 0:r.width)||i,s=(r==null?void 0:r.height)||s),this._core.utils.isNumber(r)&&(i=c*r,s=p*r);let T=c/p,O=m/l,I=T>O;r==="contain"&&(I?(i=m,s=m/T):(i=l*T,s=l)),r==="cover"&&(I?(s=l,i=l*T):(i=m,s=m/T));let b=document.createElement("canvas"),A=b.getContext("2d");return b.width=Math.min(m-n,i),b.height=Math.min(l-g,s),A==null||A.drawImage(t,0,0,i,s),this._core.room.videoManager.setWatermark({x:n,y:g,imageUrl:b.toDataURL("image/png")})}};u(S,"Name","Watermark");var _=S;var G=_;export{_ as Watermark,G as default};
@@ -1 +1 @@
1
- "use strict";var Watermark=(()=>{var S=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var P=Object.prototype.hasOwnProperty;var x=(r,e,o)=>e in r?S(r,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[e]=o;var f=(r,e)=>{for(var o in e)S(r,o,{get:e[o],enumerable:!0})},L=(r,e,o,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of y(e))!P.call(r,i)&&i!==o&&S(r,i,{get:()=>e[i],enumerable:!(t=C(e,i))||t.enumerable});return r};var k=r=>L(S({},"__esModule",{value:!0}),r);var d=(r,e,o)=>(x(r,typeof e!="symbol"?e+"":e,o),o);var B={};f(B,{Watermark:()=>A,default:()=>V});function O(r){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(e,o,t,i){var T;let{RtcError:a,ErrorCode:l,ErrorCodeDictionary:s}=r.errorModule;if(!e)return;let{imageUrl:u}=e,p=u.split("?")[0].split(".").pop();if((p==="jpg"||p==="jpeg")&&r.log.warn("The image format is not recommended to be jpg/jpeg, because the format does not support transparency."),!((T=r.room.videoManager.cameraTrack)!=null&&T.mediaTrack))throw new a({code:l.INVALID_OPERATION,extraCode:s.INVALID_OPERATION_NEED_VIDEO,fnName:t});if(r.utils.isString(e.size)&&e.size!=="contain"&&e.size!=="cover")throw new a({code:l.INVALID_PARAMETER,extraCode:s.INVALID_PARAMETER_TYPE,message:"The size parameter must be 'contain' or 'cover'",fnName:t});if(r.utils.isNumber(e.size)&&(e.size<=0||e.size>1))throw new a({code:l.INVALID_PARAMETER,extraCode:s.INVALID_PARAMETER_RANGE,message:"The size parameter must be greater than 0",fnName:t});if(r.utils.isObject(e.size)){if(!e.size.width||!e.size.height)throw new a({code:l.INVALID_PARAMETER,extraCode:s.INVALID_PARAMETER_TYPE,message:"The size parameter must be an object with width and height properties",fnName:t});if(e.size.width<=0||e.size.height<=0)throw new a({code:l.INVALID_PARAMETER,extraCode:s.INVALID_PARAMETER_RANGE,message:"The size parameter must be greater than 0",fnName:t})}}}}function I(r){return{name:"StopWatermarkOptions",required:!1}}var g=0,R=class R{constructor(e){this.core=e;d(this,"seq");d(this,"_core");d(this,"log");d(this,"startResolve");d(this,"startReject");g=g+1,this.seq=g,this._core=e,this.log=e.log.createChild({id:`${this.getAlias()}${g}`}),this.log.info("created")}getName(){return R.Name}getAlias(){return"w"}getValidateRule(e){switch(e){case"start":return O(this._core);case"update":return I(this._core);case"stop":return I(this._core)}}getGroup(){return"w"}async start(e){return this.doStart(e)}async update(e){return await this.stop(),this.doStart(e)}async stop(){return this._core.room.videoManager.deleteWatermark()}async doStart(e){let{imageUrl:o,x:t=0,y:i=0,size:a="cover"}=e,{settings:l}=this._core.room.videoManager.cameraTrack,s;try{s=await this._core.utils.loadImage(o)}catch(G){let{RtcError:N,ErrorCode:U}=this.core.errorModule;throw new N({code:U.INVALID_PARAMETER,message:`load image failed, url: ${o}`})}let{width:u,height:c}=l,{width:p,height:T}=s,n=p,m=T;this._core.utils.isObject(a)&&(n=(a==null?void 0:a.width)||n,m=(a==null?void 0:a.height)||m),this._core.utils.isNumber(a)&&(n=p*a,m=T*a);let b=p/T,h=u/c,D=b>h;a==="contain"&&(D?(n=u,m=u/b):(n=c*b,m=c)),a==="cover"&&(D?(m=c,n=c*b):(n=u,m=u/b));let E=document.createElement("canvas"),_=E.getContext("2d");return E.width=Math.min(u-t,n),E.height=Math.min(c-i,m),_==null||_.drawImage(s,0,0,n,m),this._core.room.videoManager.setWatermark({x:t,y:i,imageUrl:E.toDataURL("image/png")})}};d(R,"Name","Watermark");var A=R;var V=A;return k(B);})().default;
1
+ "use strict";var Watermark=(()=>{var S=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var P=Object.prototype.hasOwnProperty;var x=(r,e,o)=>e in r?S(r,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[e]=o;var f=(r,e)=>{for(var o in e)S(r,o,{get:e[o],enumerable:!0})},L=(r,e,o,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of y(e))!P.call(r,i)&&i!==o&&S(r,i,{get:()=>e[i],enumerable:!(t=C(e,i))||t.enumerable});return r};var k=r=>L(S({},"__esModule",{value:!0}),r);var d=(r,e,o)=>(x(r,typeof e!="symbol"?e+"":e,o),o);var B={};f(B,{Watermark:()=>A,default:()=>V});function O(r){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(e,o,t,i){var T;let{RtcError:a,ErrorCode:l,ErrorCodeDictionary:s}=r.errorModule;if(!e)return;let{imageUrl:u}=e,p=u.split("?")[0].split(".").pop();if((p==="jpg"||p==="jpeg")&&r.log.warn("The image format is not recommended to be jpg/jpeg, because the format does not support transparency."),!((T=r.room.videoManager.cameraTrack)!=null&&T.mediaTrack))throw new a({code:l.INVALID_OPERATION,extraCode:s.INVALID_OPERATION_NEED_VIDEO,fnName:t});if(r.utils.isString(e.size)&&e.size!=="contain"&&e.size!=="cover")throw new a({code:l.INVALID_PARAMETER,extraCode:s.INVALID_PARAMETER_TYPE,message:"The size parameter must be 'contain' or 'cover'",fnName:t});if(r.utils.isNumber(e.size)&&(e.size<=0||e.size>1))throw new a({code:l.INVALID_PARAMETER,extraCode:s.INVALID_PARAMETER_RANGE,message:"The size parameter must be greater than 0",fnName:t});if(r.utils.isObject(e.size)){if(!e.size.width||!e.size.height)throw new a({code:l.INVALID_PARAMETER,extraCode:s.INVALID_PARAMETER_TYPE,message:"The size parameter must be an object with width and height properties",fnName:t});if(e.size.width<=0||e.size.height<=0)throw new a({code:l.INVALID_PARAMETER,extraCode:s.INVALID_PARAMETER_RANGE,message:"The size parameter must be greater than 0",fnName:t})}}}}function I(r){return{name:"StopWatermarkOptions",required:!1}}var g=0,R=class R{constructor(e){this.core=e;d(this,"seq");d(this,"_core");d(this,"log");d(this,"startResolve");d(this,"startReject");g=g+1,this.seq=g,this._core=e,this.log=e.log.createChild({id:`${this.getAlias()}${g}`}),this.log.info("created")}getName(){return R.Name}getAlias(){return"w"}getValidateRule(e){switch(e){case"start":return O(this._core);case"update":return I(this._core);case"stop":return I(this._core)}}getGroup(){return"w"}async start(e){return this.doStart(e)}async update(e){return await this.stop(),this.doStart(e)}async stop(){return this._core.room.videoManager.deleteWatermark()}async doStart(e){let{imageUrl:o,x:t=0,y:i=0,size:a="cover"}=e,{settings:l}=this._core.room.videoManager.cameraTrack,s;try{s=await this._core.utils.loadImage(o)}catch(G){let{RtcError:U,ErrorCode:h}=this.core.errorModule;throw new U({code:h.INVALID_PARAMETER,message:`load image failed, url: ${o}`})}let{width:u,height:c}=l,{width:p,height:T}=s,n=p,m=T;this._core.utils.isObject(a)&&(n=(a==null?void 0:a.width)||n,m=(a==null?void 0:a.height)||m),this._core.utils.isNumber(a)&&(n=p*a,m=T*a);let b=p/T,N=u/c,D=b>N;a==="contain"&&(D?(n=u,m=u/b):(n=c*b,m=c)),a==="cover"&&(D?(m=c,n=c*b):(n=u,m=u/b));let E=document.createElement("canvas"),_=E.getContext("2d");return E.width=Math.min(u-t,n),E.height=Math.min(c-i,m),_==null||_.drawImage(s,0,0,n,m),this._core.room.videoManager.setWatermark({x:t,y:i,imageUrl:E.toDataURL("image/png")})}};d(R,"Name","Watermark");var A=R;var V=A;return k(B);})().default;