trtc-sdk-v5 5.7.1-beta.13 → 5.7.1-beta.14
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 +50 -2
- package/package.json +1 -1
- package/plugins/cdn-streaming/package.json +1 -1
- package/plugins/video-effect/basic-beauty/package.json +1 -1
- package/plugins/video-effect/beauty/package.json +1 -1
- package/plugins/video-effect/virtual-background/package.json +1 -1
- package/plugins/video-effect/watermark/package.json +1 -1
- package/plugins/video-effect/watermark/watermark.esm.js +1 -1
- package/plugins/video-effect/watermark/watermark.iife.js +1 -1
- package/trtc.esm.js +29 -28
- package/trtc.js +1 -1
package/index.d.ts
CHANGED
|
@@ -629,7 +629,7 @@ declare const TRTCEvent: {
|
|
|
629
629
|
* @default 'connection-state-changed'
|
|
630
630
|
* @memberof module:EVENT
|
|
631
631
|
* @example
|
|
632
|
-
* trtc.on(TRTC.CONNECTION_STATE_CHANGED, event => {
|
|
632
|
+
* trtc.on(TRTC.EVENT.CONNECTION_STATE_CHANGED, event => {
|
|
633
633
|
* const prevState = event.prevState;
|
|
634
634
|
* const curState = event.state;
|
|
635
635
|
* });
|
|
@@ -1407,8 +1407,9 @@ declare interface TRTCEventTypes {
|
|
|
1407
1407
|
* - {@link module:ERROR_CODE.OPERATION_ABORT OPERATION_ABORT}
|
|
1408
1408
|
* @example
|
|
1409
1409
|
* const config = {
|
|
1410
|
-
* view: document.getElementById(userId),
|
|
1410
|
+
* view: document.getElementById(userId), // you can use a new view to update the position of video.
|
|
1411
1411
|
* userId,
|
|
1412
|
+
* streamType: TRTC.TYPE.STREAM_TYPE_MAIN
|
|
1412
1413
|
* }
|
|
1413
1414
|
* await trtc.updateRemoteVideo(config);
|
|
1414
1415
|
* @memberof TRTC
|
|
@@ -1691,6 +1692,53 @@ declare interface TRTCEventTypes {
|
|
|
1691
1692
|
readonly VIDEO_PLAY_STATE_CHANGED: "video-play-state-changed";
|
|
1692
1693
|
readonly SCREEN_SHARE_STOPPED: "screen-share-stopped";
|
|
1693
1694
|
readonly DEVICE_CHANGED: "device-changed";
|
|
1695
|
+
/**
|
|
1696
|
+
* Enter a video call room.<br>
|
|
1697
|
+
* - 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.
|
|
1698
|
+
* - 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.
|
|
1699
|
+
* - By default, the SDK automatically plays remote audio. You need to call {@link TRTC#startRemoteVideo startRemoteVideo()} to play remote video.
|
|
1700
|
+
*
|
|
1701
|
+
* @param {object} options Enter room parameters
|
|
1702
|
+
* @param {number} options.sdkAppId sdkAppId <br>
|
|
1703
|
+
* 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).
|
|
1704
|
+
* @param {string} options.userId User ID <br>
|
|
1705
|
+
* 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.
|
|
1706
|
+
* @param {string} options.userSig UserSig signature <br>
|
|
1707
|
+
* Please refer to [UserSig related](https://www.tencentcloud.com/document/product/647/35166) for the calculation method of userSig.
|
|
1708
|
+
* @param {number=} options.roomId
|
|
1709
|
+
* the value must be an integer between 1 and 4294967294<br>
|
|
1710
|
+
* <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>
|
|
1711
|
+
* @param {string=} options.strRoomId
|
|
1712
|
+
* String type room id, the length is limited to 64 bytes, and only supports the following characters:
|
|
1713
|
+
* - Uppercase and lowercase English letters (a-zA-Z)
|
|
1714
|
+
* - Numbers (0-9)
|
|
1715
|
+
* - Space ! # $ % & ( ) + - : ; < = . > ? @ [ ] ^ _ { } | ~ ,
|
|
1716
|
+
* <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>
|
|
1717
|
+
* @param {string} [options.scene] Application scene, currently supports the following two scenes:
|
|
1718
|
+
* - {@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}.
|
|
1719
|
+
* - {@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.
|
|
1720
|
+
* @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:
|
|
1721
|
+
* - {@link module:TYPE.ROLE_ANCHOR TRTC.TYPE.ROLE_ANCHOR} (default) Anchor
|
|
1722
|
+
* - {@link module:TYPE.ROLE_AUDIENCE TRTC.TYPE.ROLE_AUDIENCE} Audience
|
|
1723
|
+
* 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.
|
|
1724
|
+
* @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.
|
|
1725
|
+
* @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.
|
|
1726
|
+
* - 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).
|
|
1727
|
+
* @param {boolean} [options.enableAutoPlayDialog] Whether to enable the SDK's automatic playback failure dialog box, default: true.
|
|
1728
|
+
* - 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.
|
|
1729
|
+
* - Can be set to false in order to turn off. Refer to {@tutorial 21-advanced-auto-play-policy}.
|
|
1730
|
+
* @param {string|ProxyServer} [options.proxy] proxy config. Refer to {@tutorial 34-advanced-proxy}.
|
|
1731
|
+
* @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=).
|
|
1732
|
+
* @throws
|
|
1733
|
+
* - {@link module:ERROR_CODE.INVALID_PARAMETER INVALID_PARAMETER}
|
|
1734
|
+
* - {@link module:ERROR_CODE.OPERATION_FAILED OPERATION_FAILED}
|
|
1735
|
+
* - {@link module:ERROR_CODE.OPERATION_ABORT OPERATION_ABORT}
|
|
1736
|
+
* - {@link module:ERROR_CODE.ENV_NOT_SUPPORTED ENV_NOT_SUPPORTED}
|
|
1737
|
+
* - {@link module:ERROR_CODE.SERVER_ERROR SERVER_ERROR}
|
|
1738
|
+
* @example
|
|
1739
|
+
* const trtc = TRTC.create();
|
|
1740
|
+
* await trtc.enterRoom({ roomId: 8888, sdkAppId, userId, userSig });
|
|
1741
|
+
*/
|
|
1694
1742
|
readonly PUBLISH_STATE_CHANGED: "publish-state-changed";
|
|
1695
1743
|
readonly TRACK: "track";
|
|
1696
1744
|
readonly STATISTICS: "statistics";
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var
|
|
1
|
+
var U=Object.defineProperty;var C=(a,e,t)=>e in a?U(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t;var u=(a,e,t)=>(C(a,typeof e!="symbol"?e+"":e,t),t);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,t,n,g){var p;let{RtcError:r,ErrorCode:d,ErrorCodeDictionary:o}=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:o.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:o.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:o.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:o.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:o.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:t,x:n=0,y:g=0,size:r="cover"}=e,{settings:d}=this._core.room.videoManager.cameraTrack,o;try{o=await this._core.utils.loadImage(t)}catch(y){let{RtcError:h,ErrorCode:N}=this.core.errorModule;throw new h({code:N.INVALID_PARAMETER,message:`load image failed, url: ${t}`})}let{width:m,height:l}=d,{width:c,height:p}=o,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(o,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,
|
|
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,t)=>e in r?S(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var f=(r,e)=>{for(var t in e)S(r,t,{get:e[t],enumerable:!0})},L=(r,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of y(e))!P.call(r,i)&&i!==t&&S(r,i,{get:()=>e[i],enumerable:!(o=C(e,i))||o.enumerable});return r};var k=r=>L(S({},"__esModule",{value:!0}),r);var d=(r,e,t)=>(x(r,typeof e!="symbol"?e+"":e,t),t);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,t,o,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:o});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:o});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:o});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:o});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:o})}}}}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:t,x:o=0,y:i=0,size:a="cover"}=e,{settings:l}=this._core.room.videoManager.cameraTrack,s;try{s=await this._core.utils.loadImage(t)}catch(G){let{RtcError:N,ErrorCode:U}=this.core.errorModule;throw new N({code:U.INVALID_PARAMETER,message:`load image failed, url: ${t}`})}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-o,n),E.height=Math.min(c-i,m),_==null||_.drawImage(s,0,0,n,m),this._core.room.videoManager.setWatermark({x:o,y:i,imageUrl:E.toDataURL("image/png")})}};d(R,"Name","Watermark");var A=R;var V=A;return k(B);})().default;
|