
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@tencentcloud/call-uikit-wechat
Advanced tools
An Open-source Voice & Video Calling UI Component Based on Tencent Cloud Service.
本文将介绍如何用最短的时间完成 TUICallKit 组件的接入,跟随本文档,您将完成如下几个关键步骤,并最终得到一个包含完备 UI 界面的视频通话功能。
TUICallkit
├─ component // UI 组件
├─ calling // 呼叫中 UI 组件(单人通话)
└─ connected // 通话中 UI 组件(单人通话)
├─ groupCalling // 呼叫中 UI 组件(多人通话)
└─ groupConnected // 通话中 UI 组件(多人通话)
├─ static // UI icon 图片
TUICallEngine // TUICallEngine 逻辑文件
lib // SDK
为方便您的使用,本组件配套多篇使用指引:
如果您想要了解TUICallKit,请阅读 组件介绍 TUICallKit
如果您想把我们的功能直接嵌入到您的项目中,请阅读 快速接入 TUICallKit
如果您想要了解详细 API ,请阅读 API 概览
由于 TUICallKit 所使用的小程序标签有更苛刻的权限要求,因此集成 TUICallKit 的第一步就是要开通小程序的类目和标签使用权限,否则无法使用,这包括如下步骤:
在 微信公众平台 > 开发 > 开发管理 > 开发设置 > 服务器域名中设置 request 合法域名 和 socket 合法域名,如下图所示:
https://official.opensso.tencent-cloud.com
https://yun.tim.qq.com
https://cloud.tencent.com
https://webim.tim.qq.com
https://query.tencent-cloud.com
https://web.sdk.qcloud.com
wss://wss.im.qcloud.com
wss://wss.tim.qq.com
TUICallKit 是基于腾讯云 即时通信 IM 和 实时音视频 TRTC 两项付费 PaaS 服务构建出的音视频通信组件。您可以按照如下步骤开通相关的服务并体验 7 天的免费试用服务:
IM 音视频通话能力针对不同的业务需求提供了差异化的付费版本供您选择,您可以在 IM 购买页 了解包含功能并选购您适合的版本。
即日起至2022年10月01日0点前,购买音视频通话能力包基础版可获赠解锁相同有效期的小程序端通话功能授权。在活动结束前购买的音视频通话能力包在有效期内不受活动结束影响仍可使用小程序通话功能,活动结束后的新购或续期需选择体验版、进阶版、尊享版来获取小程序通话功能授权,基础版亦可单独加购小程序功能授权进行解锁。
单击免费体验以后,部分之前使用过 实时音视频 TRTC 服务的用户会提示:
[-100013]:TRTC service is suspended. Please check if the package balance is 0 or the Tencent Cloud accountis in arrears
因为新的 IM 音视频通话能力是整合了腾讯云实时音视频 TRTC 和 即时通信 IM 两个基础的 PaaS 服务,所以当 实时音视频 TRTC 的免费额度(10000分钟)已经过期或者耗尽,就会导致开通此项服务失败,这里您可以单击 TRTC 控制台,找到对应 SDKAppID 的应用管理页,示例如图,开通后付费功能后,再次启用应用即可正常体验音视频通话能力。
npm i @tencentcloud/call-uikit-wechat
mkdir -p ./TUICallKit && cp -r node_modules/@tencentcloud/call-uikit-wechat/ ./TUICallKit
{
"usingComponents": {
"TUICallKit": "/TUICallKit/TUICallKit/TUICallKit"
}
}
<TUICallKit
id="TUICallKit-component" //用于获取子组件对象方法
config="{{config}}" //将config中的参数传递给callkit
></TUICallKit>
config参数
参数 | 类型 | 说明 | 是否必传 |
---|---|---|---|
sdkAppID | String | IM 的应用 ID | 是 |
userID | String | 当前用户的 ID | 是 |
userSig | String | 鉴权的票据 | 是 |
type | Number | 通话的媒体类型 | 否 |
tim | Any | TIM 实例 | 否 |
Page({
/**
* 页面的初始数据
*/
data: {
config: {
sdkAppID: 123, // 替换为您自己账号下的 sdkAppID
userID: 'jane', // 填写当前用的 userID
userSig: 'xxxxxxxxxxxx', // 通过 genTestUserSig(userID) 生成
type: 2, //通话的类型
tim: null, // tim 参数适用于业务中已存在 TIM 实例,为保证 TIM 实例唯一性
}
}
})
这里详细介绍一下 config 中的几个参数:
onLoad() {
this.TUICallKit = this.selectComponent('#TUICallKit-component');
this.TUICallKit.init();
}
onUnload() {
this.TUICallKit.destroyed();
},
填写如下代码,就可以实现一对一视频通话。
// 发起1对1视频通话,假设被邀请人的userId为: 1111, type 1:语音通话,2:视频通话。
this.TUICallKit.call({ userID: '1111', type: 2 });
如果您需要自定义昵称或头像,可以使用如下接口进行更新:
this.TUICallKit.setSelfInfo("昵称", "头像 URL");
FAQs
An Open-source Voice & Video Calling UI Component Based on Tencent Cloud Service.
The npm package @tencentcloud/call-uikit-wechat receives a total of 45 weekly downloads. As such, @tencentcloud/call-uikit-wechat popularity was classified as not popular.
We found that @tencentcloud/call-uikit-wechat demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.