atomicx-core sdk API 文档
atomicx-core sdk
atomicx-core sdk 是腾讯云最新推出的面向即时通信、音视频通话、视频直播、语聊房等场景的全新一代基于响应式的 API,您可以非常快速的在基于这组 API 构建自己的 UI 页面,它支持房间管理、屏幕分享、成员管理、麦位控制、基础美颜等丰富功能,同时确保720P和1080P高清画质,在70%丢包率的弱网环境下仍能保持高质量音视频传输。此外,SDK 采用48kHz高音质采样,结合腾讯天籁实验室的3A处理算法,消除回声和啸叫,实现全链路128kbps高音质立体声,为用户带来清晰沉浸的互动体验,本页面包含 atomicx-core sdk 的所有API接口,按功能模块分类展示。
State 模块列表
🔐 基础模块
- LoginState - 用户身份认证与登录管理
- DeviceState - 设备状态管理(摄像头、麦克风、扬声器)
🏠 房间模块
- RoomState - 房间状态管理(创建、加入、预约等)
- RoomParticipantState - 房间参与者管理(成员列表、权限控制)
📺 直播模块
- LiveListState - 直播列表与直播间管理
- LiveSeatState - 直播麦位管理
- LiveAudienceState - 直播观众管理
- LiveMonitorState - 直播监控管理
🎤 连麦与互动
- CoGuestState - 观众连麦管理
- CoHostState - 主播连麦管理
- BattleState - 主播 PK 对战管理
- BarrageState - 弹幕消息管理
💬 即时通信模块
- MessageListState - 消息列表管理
- MessageInputState - 消息输入管理
- MessageActionState - 消息操作管理(转发、引用、撤回等)
- ConversationListState - 会话列表管理
- ContactListState - 联系人列表管理
- SearchState - 搜索功能管理
⚙️ 设置模块
- C2CSettingState - 单聊设置管理
- GroupSettingState - 群聊设置管理
🎨 高级功能
- VideoMixerState - 视频混流管理
- VirtualBackgroundState - 虚拟背景管理
- ASRState - 语音识别(ASR)管理
- SeatStore - 麦位存储管理
- FreeBeautyState - 免费美颜功能管理
📝 类型定义
- Interface - 接口类型定义
LoginState
🔐 用户身份认证与登录管理模块
核心功能:提供用户登录、登出、个人信息管理等基础身份认证功能,是整个系统的用户身份基础。
技术特点:支持多种登录方式、用户信息缓存、登录状态持久化等功能,确保用户身份的安全性和可靠性。
业务价值:为所有业务模块提供统一的用户身份认证服务,是系统安全和用户体验的基础保障。
应用场景:用户登录、身份验证、个人信息管理、权限控制等核心身份认证场景。
响应式数据
loginUserInfo
Ref<LoginUserInfo | null>
示例
import { useLoginState } from 'tuikit-atomicx-vue3';
const { loginUserInfo } = useLoginState();
// 监听用户信息变化
watch(loginUserInfo, (newUserInfo) => {
if (newUserInfo) {
console.log('用户信息更新:', newUserInfo);
console.log('用户ID:', newUserInfo.userID);
console.log('用户昵称:', newUserInfo.nickname);
console.log('用户头像:', newUserInfo.avatarURL);
}
});
// 获取当前用户信息
const currentUser = loginUserInfo.value;
if (currentUser) {
console.log('当前登录用户:', currentUser.nickname);
}
接口函数
login
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| sdkAppId | number |
是 | 应用的 SDKAppID |
| userId | string |
是 | 用户ID |
| userSig | string |
是 | 用户签名 |
示例
import { useLoginState } from 'tuikit-atomicx-vue3';
const { login } = useLoginState();
// 登录系统
await login({
sdkAppId: 1400000001,
userId: 'user_123456',
userSig: 'xxx'
});
logout
示例
import { useLoginState } from 'tuikit-atomicx-vue3';
const { logout } = useLoginState();
// 退出登录
await logout();
setSelfInfo
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| userName | string |
否 | 用户昵称 |
| avatarUrl | string |
否 | 头像URL |
| customInfo | Record<string, any> |
否 | 自定义信息 |
示例
import { useLoginState } from 'tuikit-atomicx-vue3';
const { setSelfInfo } = useLoginState();
// 设置用户个人信息
await setSelfInfo({
userName: '张三',
avatarUrl: 'https://example.com/avatar.png',
customInfo: { level: 5 }
});
DeviceState
🎥 设备状态管理模块
核心功能:管理摄像头、麦克风等音视频设备的控制,提供设备状态监控、权限检查等基础设备服务。
技术特点:支持多设备管理、设备状态实时监控、权限动态检查、设备故障自动恢复等高级功能。
业务价值:为直播系统提供稳定的设备基础,确保音视频采集的可靠性和用户体验。
应用场景:设备管理、权限控制、音视频采集、设备故障处理等基础技术场景。
响应式数据
microphoneStatus
Ref<DeviceStatus>
示例
import { useDeviceState } from 'tuikit-atomicx-vue3';
const { microphoneStatus } = useDeviceState();
// 监听数据变化
watch(microphoneStatus, (newValue) => {
console.log('microphoneStatus 更新:', newValue);
});
// 直接访问数据
console.log('当前 microphoneStatus:', microphoneStatus.value);
microphoneList
Ref<TUIDeviceInfo[]>
示例
import { useDeviceState } from 'tuikit-atomicx-vue3';
const { microphoneList } = useDeviceState();
// 监听数据变化
watch(microphoneList, (newValue) => {
console.log('microphoneList 更新:', newValue);
});
// 直接访问数据
console.log('当前 microphoneList:', microphoneList.value);
currentMicrophone
Ref<TUIDeviceInfo | null>
示例
import { useDeviceState } from 'tuikit-atomicx-vue3';
const { currentMicrophone } = useDeviceState();
// 监听数据变化
watch(currentMicrophone, (newValue) => {
console.log('currentMicrophone 更新:', newValue);
});
// 直接访问数据
console.log('当前 currentMicrophone:', currentMicrophone.value);
microphoneLastError
Ref<DeviceError>
示例
import { useDeviceState } from 'tuikit-atomicx-vue3';
const { microphoneLastError } = useDeviceState();
// 监听数据变化
watch(microphoneLastError, (newValue) => {
console.log('microphoneLastError 更新:', newValue);
});
// 直接访问数据
console.log('当前 microphoneLastError:', microphoneLastError.value);
captureVolume
Ref<any>
示例
import { useDeviceState } from 'tuikit-atomicx-vue3';
const { captureVolume } = useDeviceState();
// 监听数据变化
watch(captureVolume, (newValue) => {
console.log('captureVolume 更新:', newValue);
});
// 直接访问数据
console.log('当前 captureVolume:', captureVolume.value);
currentMicVolume
Ref<any>
示例
import { useDeviceState } from 'tuikit-atomicx-vue3';
const { currentMicVolume } = useDeviceState();
// 监听数据变化
watch(currentMicVolume, (newValue) => {
console.log('currentMicVolume 更新:', newValue);
});
// 直接访问数据
console.log('当前 currentMicVolume:', currentMicVolume.value);
isMicrophoneTesting
Ref<any>
示例
import { useDeviceState } from 'tuikit-atomicx-vue3';
const { isMicrophoneTesting } = useDeviceState();
// 监听数据变化
watch(isMicrophoneTesting, (newValue) => {
console.log('isMicrophoneTesting 更新:', newValue);
});
// 直接访问数据
console.log('当前 isMicrophoneTesting:', isMicrophoneTesting.value);
testingMicVolume
Ref<any>
示例
import { useDeviceState } from 'tuikit-atomicx-vue3';
const { testingMicVolume } = useDeviceState();
// 监听数据变化
watch(testingMicVolume, (newValue) => {
console.log('testingMicVolume 更新:', newValue);
});
// 直接访问数据
console.log('当前 testingMicVolume:', testingMicVolume.value);
cameraStatus
Ref<DeviceStatus>
示例
import { useDeviceState } from 'tuikit-atomicx-vue3';
const { cameraStatus } = useDeviceState();
// 监听数据变化
watch(cameraStatus, (newValue) => {
console.log('cameraStatus 更新:', newValue);
});
// 直接访问数据
console.log('当前 cameraStatus:', cameraStatus.value);
cameraList
Ref<TUIDeviceInfo[]>
示例
import { useDeviceState } from 'tuikit-atomicx-vue3';
const { cameraList } = useDeviceState();
// 监听数据变化
watch(cameraList, (newValue) => {
console.log('cameraList 更新:', newValue);
});
// 直接访问数据
console.log('当前 cameraList:', cameraList.value);
currentCamera
Ref<TUIDeviceInfo | null>
示例
import { useDeviceState } from 'tuikit-atomicx-vue3';
const { currentCamera } = useDeviceState();
// 监听数据变化
watch(currentCamera, (newValue) => {
console.log('currentCamera 更新:', newValue);
});
// 直接访问数据
console.log('当前 currentCamera:', currentCamera.value);
cameraLastError
Ref<DeviceError>
示例
import { useDeviceState } from 'tuikit-atomicx-vue3';
const { cameraLastError } = useDeviceState();
// 监听数据变化
watch(cameraLastError, (newValue) => {
console.log('cameraLastError 更新:', newValue);
});
// 直接访问数据
console.log('当前 cameraLastError:', cameraLastError.value);
isCameraTesting
Ref<any>
示例
import { useDeviceState } from 'tuikit-atomicx-vue3';
const { isCameraTesting } = useDeviceState();
// 监听数据变化
watch(isCameraTesting, (newValue) => {
console.log('isCameraTesting 更新:', newValue);
});
// 直接访问数据
console.log('当前 isCameraTesting:', isCameraTesting.value);
isCameraTestLoading
Ref<any>
示例
import { useDeviceState } from 'tuikit-atomicx-vue3';
const { isCameraTestLoading } = useDeviceState();
// 监听数据变化
watch(isCameraTestLoading, (newValue) => {
console.log('isCameraTestLoading 更新:', newValue);
});
// 直接访问数据
console.log('当前 isCameraTestLoading:', isCameraTestLoading.value);
isFrontCamera
Ref<any>
示例
import { useDeviceState } from 'tuikit-atomicx-vue3';
const { isFrontCamera } = useDeviceState();
// 监听数据变化
watch(isFrontCamera, (newValue) => {
console.log('isFrontCamera 更新:', newValue);
});
// 直接访问数据
console.log('当前 isFrontCamera:', isFrontCamera.value);
localMirrorType
Ref<any>
示例
import { useDeviceState } from 'tuikit-atomicx-vue3';
const { localMirrorType } = useDeviceState();
// 监听数据变化
watch(localMirrorType, (newValue) => {
console.log('localMirrorType 更新:', newValue);
});
// 直接访问数据
console.log('当前 localMirrorType:', localMirrorType.value);
localVideoQuality
Ref<any>
示例
import { useDeviceState } from 'tuikit-atomicx-vue3';
const { localVideoQuality } = useDeviceState();
// 监听数据变化
watch(localVideoQuality, (newValue) => {
console.log('localVideoQuality 更新:', newValue);
});
// 直接访问数据
console.log('当前 localVideoQuality:', localVideoQuality.value);
speakerList
Ref<TUIDeviceInfo[]>
示例
import { useDeviceState } from 'tuikit-atomicx-vue3';
const { speakerList } = useDeviceState();
// 监听数据变化
watch(speakerList, (newValue) => {
console.log('speakerList 更新:', newValue);
});
// 直接访问数据
console.log('当前 speakerList:', speakerList.value);
currentSpeaker
Ref<TUIDeviceInfo | null>
示例
import { useDeviceState } from 'tuikit-atomicx-vue3';
const { currentSpeaker } = useDeviceState();
// 监听数据变化
watch(currentSpeaker, (newValue) => {
console.log('currentSpeaker 更新:', newValue);
});
// 直接访问数据
console.log('当前 currentSpeaker:', currentSpeaker.value);
outputVolume
Ref<any>
示例
import { useDeviceState } from 'tuikit-atomicx-vue3';
const { outputVolume } = useDeviceState();
// 监听数据变化
watch(outputVolume, (newValue) => {
console.log('outputVolume 更新:', newValue);
});
// 直接访问数据
console.log('当前 outputVolume:', outputVolume.value);
currentAudioRoute
Ref<AudioRoute>
示例
import { useDeviceState } from 'tuikit-atomicx-vue3';
const { currentAudioRoute } = useDeviceState();
// 监听数据变化
watch(currentAudioRoute, (newValue) => {
console.log('currentAudioRoute 更新:', newValue);
});
// 直接访问数据
console.log('当前 currentAudioRoute:', currentAudioRoute.value);
isSpeakerTesting
Ref<any>
示例
import { useDeviceState } from 'tuikit-atomicx-vue3';
const { isSpeakerTesting } = useDeviceState();
// 监听数据变化
watch(isSpeakerTesting, (newValue) => {
console.log('isSpeakerTesting 更新:', newValue);
});
// 直接访问数据
console.log('当前 isSpeakerTesting:', isSpeakerTesting.value);
screenStatus
Ref<DeviceStatus>
示例
import { useDeviceState } from 'tuikit-atomicx-vue3';
const { screenStatus } = useDeviceState();
// 监听数据变化
watch(screenStatus, (newValue) => {
console.log('screenStatus 更新:', newValue);
});
// 直接访问数据
console.log('当前 screenStatus:', screenStatus.value);
networkInfo
Ref<NetworkInfo | null>
示例
import { useDeviceState } from 'tuikit-atomicx-vue3';
const { networkInfo } = useDeviceState();
// 监听数据变化
watch(networkInfo, (newValue) => {
console.log('networkInfo 更新:', newValue);
});
// 直接访问数据
console.log('当前 networkInfo:', networkInfo.value);
接口函数
openLocalMicrophone
示例
import { useDeviceState } from 'tuikit-atomicx-vue3';
const { openLocalMicrophone } = useDeviceState();
// 开启麦克风
try {
await openLocalMicrophone();
console.log('麦克风开启成功');
} catch (error) {
console.error('麦克风开启失败:', error);
}
closeLocalMicrophone
示例
import { useDeviceState } from 'tuikit-atomicx-vue3';
const { closeLocalMicrophone } = useDeviceState();
// 关闭麦克风
await closeLocalMicrophone();
muteLocalAudio
示例
import { useDeviceState } from 'tuikit-atomicx-vue3';
const { muteLocalAudio } = useDeviceState();
// 静音本地音频
await muteLocalAudio();
unmuteLocalAudio
示例
import { useDeviceState } from 'tuikit-atomicx-vue3';
const { unmuteLocalAudio } = useDeviceState();
// 取消静音本地音频
await unmuteLocalAudio();
getMicrophoneList
示例
import { useDeviceState } from 'tuikit-atomicx-vue3';
const { getMicrophoneList, microphoneList } = useDeviceState();
// 获取麦克风列表
try {
await getMicrophoneList();
console.log('麦克风列表:', microphoneList.value);
} catch (error) {
console.error('获取麦克风列表失败:', error);
}
setCurrentMicrophone
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| deviceId | string |
是 | 麦克风设备ID |
示例
import { useDeviceState } from 'tuikit-atomicx-vue3';
const { setCurrentMicrophone } = useDeviceState();
// 切换麦克风设备,输入您需要指定的麦克风 deviceId
await setCurrentMicrophone({
deviceId: 'default'
});
startMicrophoneTest
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| interval | number |
否 | 检测间隔时间(毫秒) |
示例
import { useDeviceState } from 'tuikit-atomicx-vue3';
const { startMicrophoneTest } = useDeviceState();
// 开始麦克风测试,例每 200ms 检测一次音量
await startMicrophoneTest({
interval: 200
});
setCaptureVolume
参数
| 参数名 | 类型 | 描述 |
|---|---|---|
| volume | number |
音量大小(0-100) |
示例
import { useDeviceState } from 'tuikit-atomicx-vue3';
const { setCaptureVolume } = useDeviceState();
// 例如设置采集音量为 80%
await setCaptureVolume(80);
setOutputVolume
参数
| 参数名 | 类型 | 描述 |
|---|---|---|
| volume | number |
音量大小(0-100) |
示例
import { useDeviceState } from 'tuikit-atomicx-vue3';
const { setOutputVolume } = useDeviceState();
// 例如设置播放音量为 60%
await setOutputVolume(60);
stopMicrophoneTest
示例
import { useDeviceState } from 'tuikit-atomicx-vue3';
const { stopMicrophoneTest } = useDeviceState();
// 停止麦克风测试
await stopMicrophoneTest();
getSpeakerList
示例
import { useDeviceState } from 'tuikit-atomicx-vue3';
const { getSpeakerList, speakerList } = useDeviceState();
// 获取扬声器列表
try {
await getSpeakerList();
console.log('扬声器列表:', speakerList.value);
} catch (error) {
console.error('获取扬声器列表失败:', error);
}
setCurrentSpeaker
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| deviceId | string |
是 | 扬声器设备ID |
示例
import { useDeviceState } from 'tuikit-atomicx-vue3';
const { setCurrentSpeaker } = useDeviceState();
// 切换扬声器设备
await setCurrentSpeaker({
deviceId: 'default'
});
setAudioRoute
参数
| 参数名 | 类型 | 描述 |
|---|---|---|
| output | AudioRoute |
音频路由类型 |
示例
import { useDeviceState, AudioRoute } from 'tuikit-atomicx-vue3';
const { setAudioRoute } = useDeviceState();
// 设置为扬声器模式
await setAudioRoute(AudioRoute.Speakerphone);
// 设置为听筒模式
await setAudioRoute(AudioRoute.Earpiece);
startSpeakerTest
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| filePath | string |
是 | 测试音频文件路径 |
示例
import { useDeviceState } from 'tuikit-atomicx-vue3';
const { startSpeakerTest } = useDeviceState();
// 播放测试音频进行扬声器测试
await startSpeakerTest({
filePath: '/assets/audio/test.mp3'
});
stopSpeakerTest
示例
import { useDeviceState } from 'tuikit-atomicx-vue3';
const { stopSpeakerTest } = useDeviceState();
// 停止扬声器测试
await stopSpeakerTest();
openLocalCamera
示例
import { useDeviceState } from 'tuikit-atomicx-vue3';
const { openLocalCamera } = useDeviceState();
// 开启摄像头
try {
await openLocalCamera();
console.log('摄像头开启成功');
} catch (error) {
console.error('摄像头开启失败:', error);
}
closeLocalCamera
示例
import { useDeviceState } from 'tuikit-atomicx-vue3';
const { closeLocalCamera } = useDeviceState();
// 关闭摄像头
await closeLocalCamera();
getCameraList
示例
import { useDeviceState } from 'tuikit-atomicx-vue3';
const { getCameraList, cameraList } = useDeviceState();
// 获取摄像头列表
try {
await getCameraList();
console.log('摄像头列表:', cameraList.value);
} catch (error) {
console.error('获取摄像头列表失败:', error);
}
setCurrentCamera
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| deviceId | string |
是 | 摄像头设备ID |
示例
import { useDeviceState } from 'tuikit-atomicx-vue3';
const { setCurrentCamera } = useDeviceState();
// 切换摄像头设备
await setCurrentCamera({
deviceId: 'default'
});
switchCamera
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| isFrontCamera | boolean |
是 | 是否使用前置摄像头 |
示例
import { useDeviceState } from 'tuikit-atomicx-vue3';
const { switchCamera } = useDeviceState();
// 切换到前置摄像头
await switchCamera({
isFrontCamera: true
});
switchMirror
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| mirror | MirrorType |
是 | 镜像类型 |
示例
import { useDeviceState, MirrorType } from 'tuikit-atomicx-vue3';
const { switchMirror } = useDeviceState();
// 设置视频镜像模式
await switchMirror({
mirror: MirrorType.Enable
});
updateVideoQuality
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| quality | VideoQuality |
是 | 视频质量等级 |
示例
import { useDeviceState, VideoQuality } from 'tuikit-atomicx-vue3';
const { updateVideoQuality } = useDeviceState();
// 设置视频质量为高清720P
await updateVideoQuality({
quality: VideoQuality.HD720P
});
startCameraDeviceTest
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| view | string |
是 | 预览视图的DOM元素ID |
示例
import { useDeviceState } from 'tuikit-atomicx-vue3';
const { startCameraDeviceTest } = useDeviceState();
// 在指定DOM元素中预览摄像头
await startCameraDeviceTest({
view: 'camera-preview-container'
});
stopCameraDeviceTest
示例
import { useDeviceState } from 'tuikit-atomicx-vue3';
const { stopCameraDeviceTest } = useDeviceState();
// 停止摄像头测试
await stopCameraDeviceTest();
screenCaptureStopped
示例
// 内部使用,当屏幕分享停止时自动调用
screenCaptureStopped();
LiveListState
📺 直播列表管理模块
核心功能:管理直播间的完整生命周期,包括创建、加入、离开、结束等核心业务流程,支持直播列表的分页获取和实时更新。
技术特点:支持分页加载、实时状态同步、直播信息动态更新,采用响应式数据管理,确保UI与数据状态实时同步。新增liveList和liveListCursor响应式数据,提供fetchLiveList接口函数。
业务价值:为直播平台提供核心的直播间管理能力,支持大规模并发直播场景,是直播业务的基础设施。
应用场景:直播列表展示、直播间创建、直播状态管理、直播数据统计等核心业务场景。
响应式数据
currentLive
Ref<LiveInfo | null>
示例
const tuiLiveInfo = await roomEngine.getLiveInfo();
const liveInfo = getLiveInfo(tuiLiveInfo);
console.log('转换后的直播信息:', liveInfo);
liveList
Ref<any>
示例
import { useLiveListState } from 'tuikit-atomicx-vue3';
const { liveList } = useLiveListState();
// 监听数据变化
watch(liveList, (newValue) => {
console.log('liveList 更新:', newValue);
});
// 直接访问数据
console.log('当前 liveList:', liveList.value);
liveListCursor
Ref<any>
示例
import { useLiveListState } from 'tuikit-atomicx-vue3';
const { liveListCursor } = useLiveListState();
// 监听数据变化
watch(liveListCursor, (newValue) => {
console.log('liveListCursor 更新:', newValue);
});
// 直接访问数据
console.log('当前 liveListCursor:', liveListCursor.value);
接口函数
createLive
参数 (CreateLiveParams)
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| liveId | string |
是 | 直播间ID |
| liveName | string |
是 | 直播间名称 |
| notice | string |
否 | 直播间公告 |
| isMessageDisableForAllUser | boolean |
否 | 是否禁止所有用户发送消息 |
| isGiftEnabled | boolean |
否 | 是否启用礼物功能 |
| isLikeEnabled | boolean |
否 | 是否启用点赞功能 |
| isPublicVisible | boolean |
否 | 是否公开可见 |
| isSeatEnabled | boolean |
否 | 是否启用麦位功能 |
| keepOwnerOnSeat | boolean |
否 | 是否保持房主在麦位上 |
| seatLayoutTemplateId | number |
否 | 麦位布局模板ID |
| maxSeatCount | number |
否 | 最大麦位数量 |
| seatMode | TUISeatMode |
否 | 麦位模式 |
| coverUrl | string |
否 | 直播间封面URL |
| backgroundUrl | string |
否 | 直播间背景URL |
| categoryList | Array<number> |
否 | 分类列表 |
| activityStatus | number |
否 | 活动状态 |
示例
import { useLiveListState } from 'tuikit-atomicx-vue3';
const { createLive } = useLiveListState();
// Create a live room with custom settings
await createLive({
liveId: 'live_room_123456',
liveName: 'My Live Room',
coverUrl: 'https://example.com/cover.jpg',
backgroundUrl: 'https://example.com/bg.jpg',
isSeatEnabled: true,
maxSeatCount: 8,
isPublicVisible: true,
isGiftEnabled: true
});
joinLive
参数 (JoinLiveParams)
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| liveId | string |
是 | 直播间ID |
示例
import { useLiveListState } from 'tuikit-atomicx-vue3';
const { joinLive } = useLiveListState();
// Join a live room by ID
await joinLive({
liveId: 'live_room_123456'
});
leaveLive
示例
import { useLiveListState } from 'tuikit-atomicx-vue3';
const { leaveLive } = useLiveListState();
// 离开直播间
try {
await leaveLive();
console.log('成功离开直播间');
} catch (error) {
console.error('离开直播间失败:', error);
}
endLive
示例
import { useLiveListState } from 'tuikit-atomicx-vue3';
const { endLive } = useLiveListState();
// 结束直播(主播操作)
try {
await endLive();
console.log('直播已结束');
} catch (error) {
console.error('结束直播失败:', error);
}
updateLiveInfo
参数 (UpdateLiveInfoParams)
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| liveId | string |
否 | 直播间ID |
| activityStatus | number |
否 | 活动状态 |
| categoryList | Array<number> |
否 | 分类列表 |
| coverUrl | string |
否 | 直播间封面URL |
| backgroundUrl | string |
否 | 直播间背景URL |
| isPublicVisible | boolean |
否 | 是否公开可见 |
| layoutTemplate | number |
否 | 布局模板 |
示例
import { useLiveListState } from 'tuikit-atomicx-vue3';
const { updateLiveInfo } = useLiveListState();
// Update live room info
await updateLiveInfo({
coverUrl: 'https://example.com/new-cover.jpg',
backgroundUrl: 'https://example.com/new-bg.jpg',
categoryList: [1, 2],
isPublicVisible: true,
activityStatus: 1
});
queryMetaData
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| keys | string[] |
是 | 要查询的元数据键名列表 |
示例
import { useLiveListState } from 'tuikit-atomicx-vue3';
const { queryMetaData } = useLiveListState();
// Query metadata by keys
await queryMetaData({
keys: ['roomTitle', 'announcement', 'customData']
});
updateLiveMetaData
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| metaData | Record<string, string> |
是 | 要更新的元数据键值对 |
示例
import { useLiveListState } from 'tuikit-atomicx-vue3';
const { updateLiveMetaData } = useLiveListState();
// Update live room metadata
await updateLiveMetaData({
metaData: {
roomTitle: 'New Room Title',
announcement: 'Welcome to my live room!'
}
});
fetchLiveList
参数
| 参数名 | 类型 | 必填 | 默认值 | 描述 |
|---|---|---|---|---|
| category | string |
否 | - | 直播间分类 |
| cursor | string |
否 | '' | 分页游标,首次获取传空字符串 |
| count | number |
否 | 20 | 每次获取的数量 |
示例
import { useLiveListState } from 'tuikit-atomicx-vue3';
const { fetchLiveList, liveListCursor } = useLiveListState();
// First fetch - get initial list
await fetchLiveList({
cursor: '',
count: 20
});
// Load more - use cursor for pagination
await fetchLiveList({
cursor: liveListCursor.value,
count: 20
});
LiveSeatState
🪑 直播间座位管理模块
核心功能:实现多人连麦场景下的座位控制,支持复杂的座位状态管理和音视频设备控制,包括上麦、下麦、座位锁定等完整功能。
技术特点:基于WebRTC技术,支持多路音视频流管理,提供座位锁定、设备控制、权限管理等高级功能。新增seatList、canvas、speakingUsers、networkQualities响应式数据,以及完整的座位操作接口。
业务价值:为多人互动直播提供核心技术支撑,支持PK、连麦、多人游戏等丰富的互动场景。
应用场景:多人连麦、主播PK、互动游戏、在线教育、会议直播等需要多人音视频互动的场景。
响应式数据
seatList
Ref<any>
示例
import { useLiveSeatState } from 'tuikit-atomicx-vue3';
const { seatList } = useLiveSeatState();
// 监听数据变化
watch(seatList, (newValue) => {
console.log('seatList 更新:', newValue);
});
// 直接访问数据
console.log('当前 seatList:', seatList.value);
canvas
Ref<any>
示例
import { useLiveSeatState } from 'tuikit-atomicx-vue3';
const { canvas } = useLiveSeatState();
// 监听数据变化
watch(canvas, (newValue) => {
console.log('canvas 更新:', newValue);
});
// 直接访问数据
console.log('当前 canvas:', canvas.value);
speakingUsers
Ref<any>
示例
import { useLiveSeatState } from 'tuikit-atomicx-vue3';
const { speakingUsers } = useLiveSeatState();
// 监听数据变化
watch(speakingUsers, (newValue) => {
console.log('speakingUsers 更新:', newValue);
});
// 直接访问数据
console.log('当前 speakingUsers:', speakingUsers.value);
networkQualities
Ref<any>
示例
import { useLiveSeatState } from 'tuikit-atomicx-vue3';
const { networkQualities } = useLiveSeatState();
// 监听数据变化
watch(networkQualities, (newValue) => {
console.log('networkQualities 更新:', newValue);
});
// 直接访问数据
console.log('当前 networkQualities:', networkQualities.value);
接口函数
takeSeat
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| seatIndex | number |
是 | 麦位索引 |
示例
import { useLiveSeatState } from 'tuikit-atomicx-vue3';
const { takeSeat } = useLiveSeatState();
// Take seat at index 1
await takeSeat({
seatIndex: 1
});
leaveSeat
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| seatIndex | number |
是 | 麦位索引 |
示例
import { useLiveSeatState } from 'tuikit-atomicx-vue3';
const { leaveSeat } = useLiveSeatState();
// Leave seat at index 1
await leaveSeat({
seatIndex: 1
});
lockSeat
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| seatIndex | number |
是 | 麦位索引 |
示例
import { useLiveSeatState } from 'tuikit-atomicx-vue3';
const { lockSeat } = useLiveSeatState();
// Lock seat at index 2
await lockSeat({
seatIndex: 2
});
unLockSeat
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| seatIndex | number |
是 | 麦位索引 |
示例
import { useLiveSeatState } from 'tuikit-atomicx-vue3';
const { unLockSeat } = useLiveSeatState();
// Unlock seat at index 2
await unLockSeat({
seatIndex: 2
});
kickUserOutOfSeat
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| seatIndex | number |
是 | 麦位索引 |
| userId | string |
是 | 用户ID |
示例
import { useLiveSeatState } from 'tuikit-atomicx-vue3';
const { kickUserOutOfSeat } = useLiveSeatState();
// Kick user out of seat
await kickUserOutOfSeat({
seatIndex: 1,
userId: 'user_123'
});
moveUserToSeat
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| userId | string |
是 | 要移动的用户ID |
| targetIndex | number |
是 | 目标麦位索引 |
| policy | MoveSeatPolicy |
是 | 移动策略:AbortWhenOccupied(0) - 目标麦位被占用时中止;ForceReplace(1) - 强制替换目标麦位用户;SwapPosition(2) - 与目标麦位用户交换位置 |
示例
import { useLiveSeatState, MoveSeatPolicy } from 'tuikit-atomicx-vue3';
const { moveUserToSeat } = useLiveSeatState();
// Move user to target seat with force replace policy
await moveUserToSeat({
userId: 'user_123',
targetIndex: 3,
policy: MoveSeatPolicy.ForceReplace
});
openRemoteCamera
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| userId | string |
是 | 要开启摄像头的用户ID |
| policy | DeviceControlPolicy |
是 | 设备控制策略:UnlockOnly(1) - 仅解锁设备 |
示例
import { useLiveSeatState, DeviceControlPolicy } from 'tuikit-atomicx-vue3';
const { openRemoteCamera } = useLiveSeatState();
// Allow user to open camera
try {
await openRemoteCamera({
userId: 'user123',
policy: DeviceControlPolicy.UnlockOnly
});
console.log('Camera unlocked');
} catch (error) {
console.error('Failed to unlock camera:', error);
}
closeRemoteCamera
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| userId | string |
是 | 要关闭摄像头的用户ID |
示例
import { useLiveSeatState } from 'tuikit-atomicx-vue3';
const { closeRemoteCamera } = useLiveSeatState();
// Close remote user's camera
try {
await closeRemoteCamera({ userId: 'user123' });
console.log('Camera closed');
} catch (error) {
console.error('Failed to close camera:', error);
}
openRemoteMicrophone
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| userId | string |
是 | 要开启麦克风的用户ID |
| policy | DeviceControlPolicy |
是 | 设备控制策略:UnlockOnly(1) - 仅解锁设备 |
示例
import { useLiveSeatState, DeviceControlPolicy } from 'tuikit-atomicx-vue3';
const { openRemoteMicrophone } = useLiveSeatState();
// Allow user to open microphone
try {
await openRemoteMicrophone({
userId: 'user123',
policy: DeviceControlPolicy.UnlockOnly
});
console.log('Microphone unlocked');
} catch (error) {
console.error('Failed to unlock microphone:', error);
}
closeRemoteMicrophone
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| userId | string |
是 | 要关闭麦克风的用户ID |
示例
import { useLiveSeatState } from 'tuikit-atomicx-vue3';
const { closeRemoteMicrophone } = useLiveSeatState();
// Close remote user's microphone
try {
await closeRemoteMicrophone({ userId: 'user123' });
console.log('Microphone closed');
} catch (error) {
console.error('Failed to close microphone:', error);
}
muteMicrophone
示例
import { useLiveSeatState } from 'tuikit-atomicx-vue3';
const { muteMicrophone } = useLiveSeatState();
// Mute local microphone
await muteMicrophone();
console.log('Microphone muted');
unmuteMicrophone
示例
import { useLiveSeatState } from 'tuikit-atomicx-vue3';
const { unmuteMicrophone } = useLiveSeatState();
// Unmute local microphone
await unmuteMicrophone();
console.log('Microphone unmuted');
startPlayStream
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| view | string |
是 | 视频容器元素ID |
示例
import { useLiveSeatState } from 'tuikit-atomicx-vue3';
const { startPlayStream } = useLiveSeatState();
// Start playing stream to specified container
try {
await startPlayStream({ view: 'video-container' });
console.log('Stream playing');
} catch (error) {
console.error('Failed to play stream:', error);
}
stopPlayStream
示例
import { useLiveSeatState } from 'tuikit-atomicx-vue3';
const { stopPlayStream } = useLiveSeatState();
// Stop playing stream
try {
await stopPlayStream();
console.log('Stream stopped');
} catch (error) {
console.error('Failed to stop stream:', error);
}
LiveAudienceState
👥 直播间观众管理模块
核心功能:管理直播间观众列表,提供观众权限控制、管理员设置等直播间秩序维护功能,支持实时观众统计。
技术特点:支持实时观众列表更新、权限分级管理、批量操作等高级功能,确保直播间秩序和用户体验。新增audienceList和audienceCount响应式数据。
业务价值:为直播平台提供完整的观众管理解决方案,支持大规模观众场景下的秩序维护。
应用场景:观众管理、权限控制、直播间秩序维护、观众互动管理等核心业务场景。
响应式数据
audienceList
Ref<any>
示例
import { useLiveAudienceState } from 'tuikit-atomicx-vue3';
const { audienceList } = useLiveAudienceState();
// 监听数据变化
watch(audienceList, (newValue) => {
console.log('audienceList 更新:', newValue);
});
// 直接访问数据
console.log('当前 audienceList:', audienceList.value);
audienceCount
Ref<any>
示例
import { useLiveAudienceState } from 'tuikit-atomicx-vue3';
const { audienceCount } = useLiveAudienceState();
// 监听数据变化
watch(audienceCount, (newValue) => {
console.log('audienceCount 更新:', newValue);
});
// 直接访问数据
console.log('当前 audienceCount:', audienceCount.value);
接口函数
fetchAudienceList
示例
import { useLiveAudienceState } from 'tuikit-atomicx-vue3';
const { fetchAudienceList, audienceList } = useLiveAudienceState();
// Fetch audience list
try {
const list = await fetchAudienceList();
console.log('Audience list:', list);
} catch (error) {
console.error('Failed to fetch audience list:', error);
}
setAdministrator
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| userId | string |
是 | 用户ID |
示例
import { useLiveAudienceState } from 'tuikit-atomicx-vue3';
const { setAdministrator } = useLiveAudienceState();
// Set user as administrator
await setAdministrator({
userId: 'user_123'
});
revokeAdministrator
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| userId | string |
是 | 用户ID |
示例
import { useLiveAudienceState } from 'tuikit-atomicx-vue3';
const { revokeAdministrator } = useLiveAudienceState();
// Revoke administrator privileges
await revokeAdministrator({
userId: 'user_123'
});
kickUserOutOfRoom
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| userId | string |
是 | 用户ID |
示例
import { useLiveAudienceState } from 'tuikit-atomicx-vue3';
const { kickUserOutOfRoom } = useLiveAudienceState();
// Kick user out of room
await kickUserOutOfRoom({
userId: 'user_123'
});
disableSendMessage
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| userId | string |
是 | 用户ID |
| duration | number |
否 | 禁言时长(秒) |
示例
import { useLiveAudienceState } from 'tuikit-atomicx-vue3';
const { disableSendMessage } = useLiveAudienceState();
// Disable user from sending messages for 10 minutes
await disableSendMessage({
userId: 'user_123',
duration: 600
});
LiveMonitorState
📊 直播监控管理模块
核心功能:提供直播间实时监控功能,包括直播状态监控、数据统计、异常检测等核心监控能力,支持多直播间监控。
技术特点:支持实时数据采集、多维度监控指标、智能告警机制,确保直播服务的稳定性和可靠性。新增monitorLiveInfoList响应式数据,优化监控接口。
业务价值:为直播平台提供全方位的监控保障,及时发现和处理异常情况,提升服务质量。
应用场景:直播质量监控、性能分析、异常告警、数据统计等运营管理场景。
响应式数据
monitorLiveInfoList
Ref<any>
示例
import { useLiveMonitorState } from 'tuikit-atomicx-vue3';
const { monitorLiveInfoList } = useLiveMonitorState();
// 监听数据变化
watch(monitorLiveInfoList, (newValue) => {
console.log('monitorLiveInfoList 更新:', newValue);
});
// 直接访问数据
console.log('当前 monitorLiveInfoList:', monitorLiveInfoList.value);
接口函数
init
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| config | InitConfig |
是 | 初始化配置对象 |
| baseUrl | string |
是 | API服务器基础URL |
| account | Account |
是 | 账户信息,包含 userId 和 userSig |
示例
import { useLiveMonitorState } from 'tuikit-atomicx-vue3';
const { init } = useLiveMonitorState();
// 初始化监控模块
init({
baseUrl: 'https://api.example.com',
account: {
userId: 'user123',
userSig: 'signature'
}
});
getLiveList
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| page | number |
是 | 页码,从1开始 |
| pageSize | number |
是 | 每页数量 |
示例
import { useLiveMonitorState } from 'tuikit-atomicx-vue3';
const { getLiveList } = useLiveMonitorState();
// 获取第一页直播列表
try {
const liveList = await getLiveList(1, 20);
console.log('直播列表:', liveList);
} catch (error) {
console.error('获取直播列表失败:', error);
}
// 获取更多页
const moreLives = await getLiveList(2, 20);
closeRoom
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| liveId | string |
是 | 要关闭的直播间ID |
示例
import { useLiveMonitorState } from 'tuikit-atomicx-vue3';
const { closeRoom } = useLiveMonitorState();
// 关闭违规直播间
try {
await closeRoom('live_123');
console.log('直播间已关闭');
} catch (error) {
console.error('关闭直播间失败:', error);
}
sendMessage
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| liveId | string |
是 | 直播间ID |
| message | MonitorMessage |
是 | 要发送的消息 |
示例
import { useLiveMonitorState } from 'tuikit-atomicx-vue3';
const { sendMessage } = useLiveMonitorState();
// 发送警告消息(暂不支持)
sendMessage('live_123', {
type: 'warning',
content: '请遵守直播规范'
});
startPlay
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| liveId | string |
是 | 直播间ID |
| viewId | string |
是 | 视频容器元素ID |
示例
import { useLiveMonitorState } from 'tuikit-atomicx-vue3';
const { startPlay } = useLiveMonitorState();
// 开始播放直播流
try {
await startPlay('live_123', 'video-container');
console.log('已开始播放直播');
} catch (error) {
console.error('播放失败:', error);
}
stopPlay
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| liveId | string |
是 | 直播间ID |
示例
import { useLiveMonitorState } from 'tuikit-atomicx-vue3';
const { stopPlay } = useLiveMonitorState();
// 停止播放直播流
try {
await stopPlay('live_123');
console.log('已停止播放');
} catch (error) {
console.error('停止播放失败:', error);
}
muteLiveAudio
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| liveId | string |
是 | 直播间ID |
| mute | boolean |
是 | 是否静音,true为静音,false为取消静音 |
示例
import { useLiveMonitorState } from 'tuikit-atomicx-vue3';
const { muteLiveAudio } = useLiveMonitorState();
// 静音直播音频
await muteLiveAudio('live_123', true);
// 取消静音直播音频
await muteLiveAudio('live_123', false);
CoGuestState
🎤 连麦嘉宾管理模块
核心功能:处理观众与主播之间的连麦互动,管理连麦申请、邀请、接受、拒绝等完整的连麦流程,支持连麦状态管理。
技术特点:基于实时音视频技术,支持连麦状态实时同步、音视频质量自适应、网络状况监控等高级功能。新增connected、invitees、applicants、candidates响应式数据和applyForSeat接口。
业务价值:为直播平台提供观众参与互动的核心能力,增强用户粘性和直播趣味性。
应用场景:观众连麦、互动问答、在线K歌、游戏直播等需要观众参与的互动场景。
响应式数据
candidates
Ref<any>
示例
import { useCoGuestState } from 'tuikit-atomicx-vue3';
const { candidates } = useCoGuestState();
// 监听数据变化
watch(candidates, (newValue) => {
console.log('candidates 更新:', newValue);
});
// 直接访问数据
console.log('当前 candidates:', candidates.value);
connected
Ref<any>
示例
import { useCoGuestState } from 'tuikit-atomicx-vue3';
const { connected } = useCoGuestState();
// 监听数据变化
watch(connected, (newValue) => {
console.log('connected 更新:', newValue);
});
// 直接访问数据
console.log('当前 connected:', connected.value);
invitees
Ref<any>
示例
import { useCoGuestState } from 'tuikit-atomicx-vue3';
const { invitees } = useCoGuestState();
// 监听数据变化
watch(invitees, (newValue) => {
console.log('invitees 更新:', newValue);
});
// 直接访问数据
console.log('当前 invitees:', invitees.value);
applicants
Ref<any>
示例
import { useCoGuestState } from 'tuikit-atomicx-vue3';
const { applicants } = useCoGuestState();
// 监听数据变化
watch(applicants, (newValue) => {
console.log('applicants 更新:', newValue);
});
// 直接访问数据
console.log('当前 applicants:', applicants.value);
接口函数
applyForSeat
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| seatIndex | number |
是 | 座位索引,指定要申请的座位位置 |
| timeout | number |
是 | 超时时间(毫秒),超过该时间未响应则自动取消 |
示例
import { useCoGuestState } from 'tuikit-atomicx-vue3';
const { applyForSeat } = useCoGuestState();
// 申请连麦座位
try {
await applyForSeat({
seatIndex: 1,
timeout: 30000
});
console.log('连麦申请已发送');
} catch (error) {
console.error('申请座位失败:', error);
}
cancelApplication
示例
import { useCoGuestState } from 'tuikit-atomicx-vue3';
const { cancelApplication } = useCoGuestState();
// 取消连麦申请
await cancelApplication();
console.log('连麦申请已取消');
acceptApplication
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| userId | string |
是 | 用户ID,指定要接受连麦申请的用户 |
示例
import { useCoGuestState } from 'tuikit-atomicx-vue3';
const { acceptApplication } = useCoGuestState();
// 接受连麦申请
await acceptApplication({ userId: 'user123' });
console.log('连麦申请已接受');
rejectApplication
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| userId | string |
是 | 用户ID,指定要拒绝连麦申请的用户 |
示例
import { useCoGuestState } from 'tuikit-atomicx-vue3';
const { rejectApplication } = useCoGuestState();
// 拒绝连麦申请
await rejectApplication({ userId: 'user123' });
console.log('连麦申请已拒绝');
inviteToSeat
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| userId | string |
是 | 用户ID,指定要邀请的用户 |
| seatIndex | number |
是 | 座位索引,指定连麦的座位位置 |
| timeout | number |
是 | 超时时间(毫秒),超过该时间未响应则自动取消 |
示例
import { useCoGuestState } from 'tuikit-atomicx-vue3';
const { inviteToSeat } = useCoGuestState();
// 邀请用户连麦
try {
await inviteToSeat({
userId: 'user123',
seatIndex: 1,
timeout: 30000
});
console.log('连麦邀请已发送');
} catch (error) {
console.error('邀请失败:', error);
}
cancelInvitation
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| inviteeId | string |
是 | 被邀请用户ID,指定要取消邀请的用户 |
示例
import { useCoGuestState } from 'tuikit-atomicx-vue3';
const { cancelInvitation } = useCoGuestState();
// 取消连麦邀请
await cancelInvitation({ inviteeId: 'user123' });
console.log('连麦邀请已取消');
acceptInvitation
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| inviterId | string |
是 | 邀请者用户ID,指定发送邀请的主播用户 |
示例
import { useCoGuestState } from 'tuikit-atomicx-vue3';
const { acceptInvitation } = useCoGuestState();
// 接受连麦邀请
await acceptInvitation({ inviterId: 'host123' });
console.log('连麦邀请已接受');
rejectInvitation
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| inviterId | string |
是 | 邀请者用户ID,指定发送邀请的主播用户 |
示例
import { useCoGuestState } from 'tuikit-atomicx-vue3';
const { rejectInvitation } = useCoGuestState();
// 拒绝连麦邀请
await rejectInvitation({ inviterId: 'host123' });
console.log('连麦邀请已拒绝');
disConnect
示例
import { useCoGuestState } from 'tuikit-atomicx-vue3';
const { disConnect } = useCoGuestState();
// 断开连麦连接
await disConnect();
console.log('连麦连接已断开');
CoHostState
🤝 连麦主播管理模块
核心功能:实现主播间的连麦功能,支持主播邀请、连麦申请、连麦状态管理等主播间互动功能,提供完整的主播连麦流程。
技术特点:支持多主播音视频同步、画中画显示、音视频质量优化等高级技术,确保连麦体验的流畅性。新增coHostStatus、connected、applicant、invitees、candidates响应式数据和完整的连麦控制接口。
业务价值:为直播平台提供主播间协作的核心能力,支持PK、合作直播等高级业务场景。
应用场景:主播PK、合作直播、跨平台连麦、主播互动等高级直播场景。
响应式数据
coHostStatus
Ref<any>
示例
import { useCoHostState } from 'tuikit-atomicx-vue3';
const { coHostStatus } = useCoHostState();
// 监听数据变化
watch(coHostStatus, (newValue) => {
console.log('coHostStatus 更新:', newValue);
});
// 直接访问数据
console.log('当前 coHostStatus:', coHostStatus.value);
connected
Ref<any>
示例
import { useCoHostState } from 'tuikit-atomicx-vue3';
const { connected } = useCoHostState();
// 监听数据变化
watch(connected, (newValue) => {
console.log('connected 更新:', newValue);
});
// 直接访问数据
console.log('当前 connected:', connected.value);
applicant
Ref<any>
示例
import { useCoHostState } from 'tuikit-atomicx-vue3';
const { applicant } = useCoHostState();
// 监听数据变化
watch(applicant, (newValue) => {
console.log('applicant 更新:', newValue);
});
// 直接访问数据
console.log('当前 applicant:', applicant.value);
invitees
Ref<any>
示例
import { useCoHostState } from 'tuikit-atomicx-vue3';
const { invitees } = useCoHostState();
// 监听数据变化
watch(invitees, (newValue) => {
console.log('invitees 更新:', newValue);
});
// 直接访问数据
console.log('当前 invitees:', invitees.value);
candidates
Ref<any>
示例
import { useCoHostState } from 'tuikit-atomicx-vue3';
const { candidates } = useCoHostState();
// 监听数据变化
watch(candidates, (newValue) => {
console.log('candidates 更新:', newValue);
});
// 直接访问数据
console.log('当前 candidates:', candidates.value);
接口函数
requestHostConnection
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| liveId | string |
是 | 目标直播间ID |
| layoutTemplate | CoHostLayoutTemplate |
是 | 连麦布局模板 |
| timeout | number |
是 | 请求超时时间(秒) |
| extensionInfo | string |
是 | 扩展信息 |
示例
import { useCoHostState } from 'tuikit-atomicx-vue3';
const { requestHostConnection } = useCoHostState();
// 发起连麦请求
try {
const result = await requestHostConnection({
liveId: 'live_123',
layoutTemplate: CoHostLayoutTemplate.Grid,
timeout: 30,
extensionInfo: JSON.stringify({ type: 'music' })
});
const code = result.get('live_123');
if (code === TUIConnectionCode.TUIConnectionCodeSuccess) {
console.log('连麦请求发送成功');
}
} catch (error) {
console.error('连麦请求异常:', error);
}
cancelHostConnection
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| liveId | string |
是 | 目标直播间ID |
示例
import { useCoHostState } from 'tuikit-atomicx-vue3';
const { cancelHostConnection } = useCoHostState();
// 取消连麦请求
try {
await cancelHostConnection({
liveId: 'live_123'
});
console.log('连麦请求已取消');
} catch (error) {
console.error('取消连麦请求失败:', error);
}
acceptHostConnection
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| liveId | string |
是 | 发起连麦的直播间ID |
示例
import { useCoHostState, CoHostEvent } from 'tuikit-atomicx-vue3';
const { acceptHostConnection, subscribeEvent } = useCoHostState();
// 监听连麦请求并接受
subscribeEvent(CoHostEvent.onCoHostRequestReceived, async (eventInfo) => {
const { inviter } = eventInfo;
console.log(`收到来自 ${inviter.userName} 的连麦请求`);
// 接受连麦请求
try {
await acceptHostConnection({ liveId: inviter.liveId });
console.log('已接受连麦请求');
} catch (error) {
console.error('接受连麦请求失败:', error);
}
});
rejectHostConnection
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| liveId | string |
是 | 发起连麦的直播间ID |
示例
import { useCoHostState, CoHostEvent } from 'tuikit-atomicx-vue3';
const { rejectHostConnection, subscribeEvent } = useCoHostState();
// 监听连麦请求并拒绝
subscribeEvent(CoHostEvent.onCoHostRequestReceived, async (eventInfo) => {
const { inviter } = eventInfo;
console.log(`收到来自 ${inviter.userName} 的连麦请求`);
// 拒绝连麦请求
try {
await rejectHostConnection({ liveId: inviter.liveId });
console.log('已拒绝连麦请求');
} catch (error) {
console.error('拒绝连麦请求失败:', error);
}
});
exitHostConnection
示例
import { useCoHostState, CoHostStatus } from 'tuikit-atomicx-vue3';
const { exitHostConnection, coHostStatus } = useCoHostState();
// 退出连麦
const handleExitCoHost = async () => {
if (coHostStatus.value === CoHostStatus.Connected) {
try {
await exitHostConnection();
console.log('已退出连麦');
} catch (error) {
console.error('退出连麦失败:', error);
}
}
};
BattleState
⚔️ PK对战管理模块
核心功能:管理主播间的PK对战功能,包括对战邀请、接受、拒绝、结束等完整的PK流程,支持实时比分统计。
技术特点:支持实时对战状态同步、比分计算、对战结果统计等功能。新增battleScore响应式数据,提供完整的PK对战体验。
业务价值:为直播平台提供竞技互动功能,增强直播趣味性和用户参与度。
应用场景:主播PK、才艺比拼、游戏对战、互动竞技等娱乐场景。
响应式数据
currentBattleInfo
Ref<BattleInfo>
示例
import { useBattleState } from 'tuikit-atomicx-vue3';
const { currentBattleInfo } = useBattleState();
// 监听数据变化
watch(currentBattleInfo, (newValue) => {
console.log('currentBattleInfo 更新:', newValue);
});
// 直接访问数据
console.log('当前 currentBattleInfo:', currentBattleInfo.value);
battleUsers
Ref<SeatUserInfo[]>
示例
import { useBattleState } from 'tuikit-atomicx-vue3';
const { battleUsers } = useBattleState();
// 监听数据变化
watch(battleUsers, (newValue) => {
console.log('battleUsers 更新:', newValue);
});
// 直接访问数据
console.log('当前 battleUsers:', battleUsers.value);
battleScore
Ref<any>
示例
import { useBattleState } from 'tuikit-atomicx-vue3';
const { battleScore } = useBattleState();
// 监听数据变化
watch(battleScore, (newValue) => {
console.log('battleScore 更新:', newValue);
});
// 直接访问数据
console.log('当前 battleScore:', battleScore.value);
接口函数
requestBattle
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| config | BattleConfig | 是 | PK配置信息,包含 duration(持续时间)、needResponse(是否需要响应)、extensionInfo(扩展信息) |
| userIdList | string[] | 是 | 被邀请用户ID列表 |
| timeout | number | 是 | 邀请超时时间(秒) |
示例
import { useBattleState } from 'tuikit-atomicx-vue3';
const { requestBattle } = useBattleState();
// 发起PK邀请
try {
await requestBattle({
config: {
duration: 300, // 5分钟PK
needResponse: true,
extensionInfo: { theme: 'singing' }
},
userIdList: ['user123', 'user456'],
timeout: 30 // 30秒超时
});
console.log('PK邀请发送成功');
} catch (error) {
console.error('PK邀请发送失败:', error);
}
cancelBattleRequest
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| battleId | string | 是 | PK ID |
| userIdList | string[] | 是 | 要取消邀请的用户ID列表 |
示例
import { useBattleState } from 'tuikit-atomicx-vue3';
const { cancelBattleRequest } = useBattleState();
// 取消PK邀请
try {
await cancelBattleRequest({
battleId: 'battle_123',
userIdList: ['user123', 'user456']
});
console.log('PK邀请已取消');
} catch (error) {
console.error('取消PK邀请失败:', error);
}
acceptBattle
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| battleId | string | 是 | PK ID |
示例
import { useBattleState, BattleEvent } from 'tuikit-atomicx-vue3';
const { acceptBattle, subscribeEvent } = useBattleState();
// 监听PK邀请
subscribeEvent(BattleEvent.onBattleRequestReceived, async (eventInfo) => {
const { battleId, inviter } = eventInfo;
console.log(`收到来自 ${inviter.userName} 的PK邀请`);
// 接受PK邀请
try {
await acceptBattle({ battleId });
console.log('已接受PK邀请');
} catch (error) {
console.error('接受PK邀请失败:', error);
}
});
rejectBattle
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| battleId | string | 是 | PK ID |
示例
import { useBattleState, BattleEvent } from 'tuikit-atomicx-vue3';
const { rejectBattle, subscribeEvent } = useBattleState();
// 监听PK邀请并拒绝
subscribeEvent(BattleEvent.onBattleRequestReceived, async (eventInfo) => {
const { battleId, inviter } = eventInfo;
console.log(`收到来自 ${inviter.userName} 的PK邀请`);
// 拒绝PK邀请
try {
await rejectBattle({ battleId });
console.log('已拒绝PK邀请');
} catch (error) {
console.error('拒绝PK邀请失败:', error);
}
});
exitBattle
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| battleId | string | 是 | PK ID |
示例
import { useBattleState } from 'tuikit-atomicx-vue3';
const { exitBattle, currentBattleInfo } = useBattleState();
// 退出当前PK
const handleExitBattle = async () => {
if (currentBattleInfo.value) {
try {
await exitBattle({
battleId: currentBattleInfo.value.battleId
});
console.log('已退出PK');
} catch (error) {
console.error('退出PK失败:', error);
}
}
};
BarrageState
💬 弹幕消息管理模块
核心功能:处理直播间内的文本消息、自定义消息等弹幕功能,支持弹幕发送、消息状态同步等完整弹幕系统,提供本地提示功能。
技术特点:支持高并发消息处理、实时消息同步、消息过滤、表情包支持等高级功能。新增sendTextMessage、sendCustomMessage、appendLocalTip接口函数。
业务价值:为直播平台提供核心的互动能力,增强用户参与度和直播氛围。
应用场景:弹幕互动、消息管理、表情包、聊天室等社交互动场景。
响应式数据
messageList
Ref<Barrage[]>
示例
import { useBarrageState } from 'tuikit-atomicx-vue3';
const { messageList } = useBarrageState();
// 监听数据变化
watch(messageList, (newValue) => {
console.log('messageList 更新:', newValue);
});
// 直接访问数据
console.log('当前 messageList:', messageList.value);
接口函数
sendTextMessage
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| text | string | 是 | 要发送的文本内容 |
| extensionInfo | Record<string, string> | 否 | 扩展信息,可用于自定义弹幕样式等 |
示例
import { useBarrageState } from 'tuikit-atomicx-vue3';
const { sendTextMessage } = useBarrageState();
// 发送普通文本消息
try {
await sendTextMessage({
text: '大家好,欢迎来到直播间!'
});
console.log('消息发送成功');
} catch (error) {
console.error('消息发送失败:', error);
}
// 发送带扩展信息的文本消息
await sendTextMessage({
text: '这是一条彩色弹幕',
extensionInfo: {
color: '#ff0000',
fontSize: '16px'
}
});
sendCustomMessage
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| businessId | string | 是 | 业务标识ID,用于区分不同类型的自定义消息 |
| data | string | 是 | 自定义数据内容,通常为JSON字符串 |
示例
import { useBarrageState } from 'tuikit-atomicx-vue3';
const { sendCustomMessage } = useBarrageState();
// 发送礼物消息
try {
await sendCustomMessage({
businessId: 'gift',
data: JSON.stringify({
giftId: 1,
giftName: '玫瑰花',
count: 5,
price: 10
})
});
console.log('礼物消息发送成功');
} catch (error) {
console.error('礼物消息发送失败:', error);
}
// 发送点赞消息
await sendCustomMessage({
businessId: 'like',
data: JSON.stringify({
action: 'like',
count: 1
})
});
appendLocalTip
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| message | Barrage | 是 | 要添加的弹幕消息对象 |
示例
import { useBarrageState, BarrageType } from 'tuikit-atomicx-vue3';
const { appendLocalTip } = useBarrageState();
// 添加系统提示消息
const systemTip = {
liveId: 'live123',
sender: {
userId: 'system',
userName: '系统',
avatarUrl: ''
},
sequence: Date.now(),
timestampInSecond: Math.floor(Date.now() / 1000),
messageType: BarrageType.text,
textContent: '欢迎进入直播间!',
extensionInfo: { type: 'system' }
};
appendLocalTip(systemTip);
MessageListState
📝 消息列表管理模块
核心功能:管理聊天消息列表,支持消息加载、滚动控制、已读回执、消息高亮等完整的消息展示功能。
技术特点:支持虚拟滚动、消息优化、实时更新等高性能消息处理。新增activeConversationID、messageList、hasMoreOlderMessage等响应式数据。
业务价值:为即时通信提供核心的消息展示能力,确保良好的聊天体验。
应用场景:即时通信、群聊、私聊、消息管理等通信场景。
响应式数据
activeConversationID
Ref<any>
示例
import { useMessageListState } from 'tuikit-atomicx-vue3';
const { activeConversationID } = useMessageListState();
// 监听数据变化
watch(activeConversationID, (newValue) => {
console.log('activeConversationID 更新:', newValue);
});
// 直接访问数据
console.log('当前 activeConversationID:', activeConversationID.value);
messageList
Ref<any>
示例
import { useMessageListState } from 'tuikit-atomicx-vue3';
const { messageList } = useMessageListState();
// 监听数据变化
watch(messageList, (newValue) => {
console.log('messageList 更新:', newValue);
});
// 直接访问数据
console.log('当前 messageList:', messageList.value);
hasMoreOlderMessage
Ref<any>
示例
import { useMessageListState } from 'tuikit-atomicx-vue3';
const { hasMoreOlderMessage } = useMessageListState();
// 监听数据变化
watch(hasMoreOlderMessage, (newValue) => {
console.log('hasMoreOlderMessage 更新:', newValue);
});
// 直接访问数据
console.log('当前 hasMoreOlderMessage:', hasMoreOlderMessage.value);
hasMoreNewerMessage
Ref<any>
示例
import { useMessageListState } from 'tuikit-atomicx-vue3';
const { hasMoreNewerMessage } = useMessageListState();
// 监听数据变化
watch(hasMoreNewerMessage, (newValue) => {
console.log('hasMoreNewerMessage 更新:', newValue);
});
// 直接访问数据
console.log('当前 hasMoreNewerMessage:', hasMoreNewerMessage.value);
enableReadReceipt
Ref<any>
示例
import { useMessageListState } from 'tuikit-atomicx-vue3';
const { enableReadReceipt } = useMessageListState();
// 监听数据变化
watch(enableReadReceipt, (newValue) => {
console.log('enableReadReceipt 更新:', newValue);
});
// 直接访问数据
console.log('当前 enableReadReceipt:', enableReadReceipt.value);
isDisableScroll
Ref<any>
示例
import { useMessageListState } from 'tuikit-atomicx-vue3';
const { isDisableScroll } = useMessageListState();
// 监听数据变化
watch(isDisableScroll, (newValue) => {
console.log('isDisableScroll 更新:', newValue);
});
// 直接访问数据
console.log('当前 isDisableScroll:', isDisableScroll.value);
recalledMessageIDSet
Ref<any>
示例
import { useMessageListState } from 'tuikit-atomicx-vue3';
const { recalledMessageIDSet } = useMessageListState();
// 监听数据变化
watch(recalledMessageIDSet, (newValue) => {
console.log('recalledMessageIDSet 更新:', newValue);
});
// 直接访问数据
console.log('当前 recalledMessageIDSet:', recalledMessageIDSet.value);
highlightMessageIDSet
Ref<any>
示例
import { useMessageListState } from 'tuikit-atomicx-vue3';
const { highlightMessageIDSet } = useMessageListState();
// 监听数据变化
watch(highlightMessageIDSet, (newValue) => {
console.log('highlightMessageIDSet 更新:', newValue);
});
// 直接访问数据
console.log('当前 highlightMessageIDSet:', highlightMessageIDSet.value);
接口函数
setEnableReadReceipt
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| enableReadReceipt | boolean | undefined | 是 | 是否启用已读回执 |
示例
import { useMessageListState } from 'tuikit-atomicx-vue3';
const { setEnableReadReceipt } = useMessageListState();
// 启用已读回执
setEnableReadReceipt(true);
// 禁用已读回执
setEnableReadReceipt(false);
setIsDisableScroll
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| isDisableScroll | boolean | 是 | 是否禁用滚动 |
示例
import { useMessageListState } from 'tuikit-atomicx-vue3';
const { setIsDisableScroll } = useMessageListState();
// 禁用滚动
setIsDisableScroll(true);
// 启用滚动
setIsDisableScroll(false);
highlightMessage
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| messageID | string | 是 | 要高亮的消息ID |
| duration | number | 是 | 高亮持续时间(毫秒) |
示例
import { useMessageListState } from 'tuikit-atomicx-vue3';
const { highlightMessage } = useMessageListState();
// 高亮消息3秒
highlightMessage({ messageID: 'msg123', duration: 3000 });
MessageInputState
✏️ 消息输入管理模块
核心功能:管理消息输入框的状态和行为,支持文本输入、表情包、@功能、输入状态提示等完整的输入体验。
技术特点:支持富文本编辑、输入状态同步、草稿保存等功能。新增inputRawValue、isPeerTyping响应式数据。
业务价值:为用户提供便捷的消息输入体验,提升沟通效率。
应用场景:消息编辑、表情输入、文件发送、语音输入等输入场景。
响应式数据
inputRawValue
Ref<any>
示例
import { useMessageInputState } from 'tuikit-atomicx-vue3';
const { inputRawValue } = useMessageInputState();
// 监听数据变化
watch(inputRawValue, (newValue) => {
console.log('inputRawValue 更新:', newValue);
});
// 直接访问数据
console.log('当前 inputRawValue:', inputRawValue.value);
isPeerTyping
Ref<any>
示例
import { useMessageInputState } from 'tuikit-atomicx-vue3';
const { isPeerTyping } = useMessageInputState();
// 监听数据变化
watch(isPeerTyping, (newValue) => {
console.log('isPeerTyping 更新:', newValue);
});
// 直接访问数据
console.log('当前 isPeerTyping:', isPeerTyping.value);
接口函数
updateRawValue
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| value | string | InputContent[] | 是 | 要设置的值,可以是字符串或结构化内容数组 |
示例
import { useMessageInputState, MessageContentType } from 'tuikit-atomicx-vue3';
const { updateRawValue } = useMessageInputState();
// 更新文本内容
updateRawValue('Hello World');
// 更新结构化内容
updateRawValue([
{ type: MessageContentType.TEXT, content: 'Hello ' },
{ type: MessageContentType.EMOJI, content: { key: '[smile]', text: '😊' } }
]);
setEditorInstance
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| instance | Editor | null | 是 | 编辑器实例,传入 null 表示清除当前实例 |
示例
import { useMessageInputState } from 'tuikit-atomicx-vue3';
const { setEditorInstance } = useMessageInputState();
// 设置编辑器实例
setEditorInstance(editorInstance);
// 清除编辑器实例
setEditorInstance(null);
setContent
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| content | string | InputContent[] | 是 | 要设置的内容 |
示例
import { useMessageInputState, MessageContentType } from 'tuikit-atomicx-vue3';
const { setContent } = useMessageInputState();
// 设置文本内容
setContent('Hello World');
// 设置结构化内容
setContent([
{ type: MessageContentType.TEXT, content: 'Hello ' },
{ type: MessageContentType.EMOJI, content: { key: '[smile]', text: '😊' } }
]);
insertContent
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| content | string | InputContent[] | 是 | 要插入的内容 |
| focus | boolean | 否 | 插入后是否聚焦编辑器,默认为 true |
示例
import { useMessageInputState, MessageContentType } from 'tuikit-atomicx-vue3';
const { insertContent } = useMessageInputState();
// 插入文本内容
insertContent('Hello World');
// 插入表情
insertContent([
{ type: MessageContentType.EMOJI, content: { key: '[smile]', text: '😊' } }
]);
// 插入内容但不聚焦
insertContent('Hello', false);
focusEditor
示例
import { useMessageInputState } from 'tuikit-atomicx-vue3';
const { focusEditor } = useMessageInputState();
// 聚焦编辑器
focusEditor();
blurEditor
示例
import { useMessageInputState } from 'tuikit-atomicx-vue3';
const { blurEditor } = useMessageInputState();
// 失焦编辑器
blurEditor();
sendMessage
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| msg | string | InputContent[] | 否 | 要发送的消息内容,如果不提供则使用当前输入框的值 |
示例
import { useMessageInputState, MessageContentType } from 'tuikit-atomicx-vue3';
const { sendMessage } = useMessageInputState();
// 发送文本消息
await sendMessage('Hello World');
// 发送结构化消息
await sendMessage([
{ type: MessageContentType.TEXT, content: 'Check this image: ' },
{ type: MessageContentType.IMAGE, content: imageFile }
]);
// 发送当前输入框内容
await sendMessage();
MessageActionState
🔧 消息操作管理模块
核心功能:管理消息的各种操作,包括转发、引用、复制、删除、撤回等完整的消息操作功能。
技术特点:支持批量操作、操作状态管理、权限控制等功能。新增forwardMessageIDList、isForwardMessageSelectionDone等响应式数据。
业务价值:为用户提供丰富的消息操作能力,提升使用体验。
应用场景:消息转发、消息引用、消息管理、批量操作等场景。
响应式数据
forwardMessageIDList
Ref<any>
示例
import { useMessageActionState } from 'tuikit-atomicx-vue3';
const { forwardMessageIDList } = useMessageActionState();
// 监听数据变化
watch(forwardMessageIDList, (newValue) => {
console.log('forwardMessageIDList 更新:', newValue);
});
// 直接访问数据
console.log('当前 forwardMessageIDList:', forwardMessageIDList.value);
isForwardMessageSelectionDone
Ref<any>
示例
import { useMessageActionState } from 'tuikit-atomicx-vue3';
const { isForwardMessageSelectionDone } = useMessageActionState();
// 监听数据变化
watch(isForwardMessageSelectionDone, (newValue) => {
console.log('isForwardMessageSelectionDone 更新:', newValue);
});
// 直接访问数据
console.log('当前 isForwardMessageSelectionDone:', isForwardMessageSelectionDone.value);
forwardConversationIDList
Ref<any>
示例
import { useMessageActionState } from 'tuikit-atomicx-vue3';
const { forwardConversationIDList } = useMessageActionState();
// 监听数据变化
watch(forwardConversationIDList, (newValue) => {
console.log('forwardConversationIDList 更新:', newValue);
});
// 直接访问数据
console.log('当前 forwardConversationIDList:', forwardConversationIDList.value);
quotedMessage
Ref<any>
示例
import { useMessageActionState } from 'tuikit-atomicx-vue3';
const { quotedMessage } = useMessageActionState();
// 监听数据变化
watch(quotedMessage, (newValue) => {
console.log('quotedMessage 更新:', newValue);
});
// 直接访问数据
console.log('当前 quotedMessage:', quotedMessage.value);
接口函数
forwardMessage
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| isMergeForward | boolean | 是 | 是否合并转发 |
| messageIDList | string[] | 是 | 要转发的消息ID列表 |
| conversationIDList | string[] | 是 | 目标会话ID列表 |
| useOfflinePush | boolean | 否 | 是否使用离线推送 |
示例
import { useMessageActionState } from 'tuikit-atomicx-vue3';
const { forwardMessage } = useMessageActionState();
// 合并转发消息
const results = await forwardMessage({
isMergeForward: true,
messageIDList: ['msg_001', 'msg_002'],
conversationIDList: ['C2C_user123', 'GROUP_group456']
});
// 逐条转发消息
await forwardMessage({
isMergeForward: false,
messageIDList: ['msg_001'],
conversationIDList: ['C2C_user123']
});
setForwardMessageIDList
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| messageIDList | string[] | 是 | 要转发的消息ID列表 |
示例
import { useMessageActionState } from 'tuikit-atomicx-vue3';
const { setForwardMessageIDList } = useMessageActionState();
// 设置转发消息ID列表
setForwardMessageIDList(['msg_001', 'msg_002', 'msg_003']);
setIsForwardMessageSelectionDone
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| isSelectionDone | boolean | 是 | 是否完成消息选择 |
示例
import { useMessageActionState } from 'tuikit-atomicx-vue3';
const { setIsForwardMessageSelectionDone } = useMessageActionState();
// 标记消息选择完成
setIsForwardMessageSelectionDone(true);
// 重置消息选择状态
setIsForwardMessageSelectionDone(false);
setForwardConversationIDList
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| conversationIDList | string[] | 是 | 目标会话ID列表 |
示例
import { useMessageActionState } from 'tuikit-atomicx-vue3';
const { setForwardConversationIDList } = useMessageActionState();
// 设置转发目标会话
setForwardConversationIDList(['C2C_user123', 'GROUP_group456']);
quoteMessage
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| message | MessageModel | undefined | 是 | 要引用的消息对象,传入 undefined 取消引用 |
示例
import { useMessageActionState, useMessageListState } from 'tuikit-atomicx-vue3';
const { quoteMessage } = useMessageActionState();
const { messageList } = useMessageListState();
// 引用消息
const messageToQuote = messageList.value[0];
quoteMessage(messageToQuote);
// 取消引用
quoteMessage(undefined);
clearQuotedMessage
示例
import { useMessageActionState } from 'tuikit-atomicx-vue3';
const { clearQuotedMessage } = useMessageActionState();
// 清除引用消息
clearQuotedMessage();
copyTextMessage
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| message | MessageModel | 是 | 要复制的消息对象 |
示例
import { useMessageActionState, useMessageListState } from 'tuikit-atomicx-vue3';
const { copyTextMessage } = useMessageActionState();
const { messageList } = useMessageListState();
// 复制消息文本
const message = messageList.value[0];
const success = await copyTextMessage(message);
if (success) {
console.log('复制成功');
}
deleteMessage
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| message | MessageModel | 是 | 要删除的消息对象 |
示例
import { useMessageActionState, useMessageListState } from 'tuikit-atomicx-vue3';
const { deleteMessage } = useMessageActionState();
const { messageList } = useMessageListState();
// 删除消息
const message = messageList.value[0];
try {
await deleteMessage(message);
console.log('消息删除成功');
} catch (error) {
console.error('删除失败:', error);
}
recallMessage
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| message | MessageModel | 是 | 要撤回的消息对象 |
示例
import { useMessageActionState, useMessageListState } from 'tuikit-atomicx-vue3';
const { recallMessage } = useMessageActionState();
const { messageList } = useMessageListState();
// 撤回消息
const message = messageList.value[0];
try {
await recallMessage(message);
console.log('消息撤回成功');
} catch (error) {
console.error('撤回失败(可能超过时间限制):', error);
}
resetMessageActionState
示例
import { useMessageActionState } from 'tuikit-atomicx-vue3';
const { resetMessageActionState } = useMessageActionState();
// 重置所有消息操作状态
resetMessageActionState();
ConversationListState
💼 会话列表管理模块
核心功能:管理用户的会话列表,支持会话排序、未读统计、会话操作等完整的会话管理功能。
技术特点:支持实时会话更新、智能排序、网络状态监控等功能。新增conversationList、activeConversation、totalUnRead、netStatus响应式数据。
业务价值:为用户提供清晰的会话管理界面,提升沟通效率。
应用场景:会话管理、联系人列表、群组管理、消息中心等场景。
响应式数据
conversationList
Ref<any>
示例
import { useConversationListState } from 'tuikit-atomicx-vue3';
const { conversationList } = useConversationListState();
// 监听数据变化
watch(conversationList, (newValue) => {
console.log('conversationList 更新:', newValue);
});
// 直接访问数据
console.log('当前 conversationList:', conversationList.value);
activeConversation
Ref<any>
示例
import { useConversationListState } from 'tuikit-atomicx-vue3';
const { activeConversation } = useConversationListState();
// 监听数据变化
watch(activeConversation, (newValue) => {
console.log('activeConversation 更新:', newValue);
});
// 直接访问数据
console.log('当前 activeConversation:', activeConversation.value);
totalUnRead
Ref<any>
示例
import { useConversationListState } from 'tuikit-atomicx-vue3';
const { totalUnRead } = useConversationListState();
// 监听数据变化
watch(totalUnRead, (newValue) => {
console.log('totalUnRead 更新:', newValue);
});
// 直接访问数据
console.log('当前 totalUnRead:', totalUnRead.value);
netStatus
Ref<any>
示例
import { useConversationListState } from 'tuikit-atomicx-vue3';
const { netStatus } = useConversationListState();
// 监听数据变化
watch(netStatus, (newValue) => {
console.log('netStatus 更新:', newValue);
});
// 直接访问数据
console.log('当前 netStatus:', netStatus.value);
接口函数
markConversationUnread
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| conversationID | string | 是 | 会话ID |
| isUnread | boolean | 是 | 是否标记为未读 |
示例
import { useConversationListState } from 'tuikit-atomicx-vue3';
const { markConversationUnread } = useConversationListState();
// 标记会话为未读
await markConversationUnread('C2Cuser123', true);
// 标记会话为已读
await markConversationUnread('C2Cuser123', false);
setActiveConversation
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| conversationID | string | 是 | 要设置为活跃的会话ID |
示例
import { useConversationListState } from 'tuikit-atomicx-vue3';
const { setActiveConversation } = useConversationListState();
// 切换到指定会话
await setActiveConversation('C2Cuser123');
pinConversation
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| conversationID | string | 是 | 会话ID |
| isPin | boolean | 是 | 是否置顶 |
示例
import { useConversationListState } from 'tuikit-atomicx-vue3';
const { pinConversation } = useConversationListState();
// 置顶会话
await pinConversation('C2Cuser123', true);
// 取消置顶
await pinConversation('C2Cuser123', false);
deleteConversation
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| conversationID | string | 是 | 要删除的会话ID |
示例
import { useConversationListState } from 'tuikit-atomicx-vue3';
const { deleteConversation } = useConversationListState();
// 删除会话
try {
await deleteConversation('C2Cuser123');
console.log('会话删除成功');
} catch (error) {
console.error('删除会话失败:', error);
}
muteConversation
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| conversationID | string | 是 | 会话ID |
| isMuted | boolean | 是 | 是否开启免打扰 |
示例
import { useConversationListState } from 'tuikit-atomicx-vue3';
const { muteConversation } = useConversationListState();
// 开启免打扰
await muteConversation('C2Cuser123', true);
// 关闭免打扰
await muteConversation('C2Cuser123', false);
setConversationDraft
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| conversationID | string | 是 | 会话ID |
| draftText | string | 是 | 草稿内容 |
示例
import { useConversationListState } from 'tuikit-atomicx-vue3';
const { setConversationDraft } = useConversationListState();
// 设置会话草稿
await setConversationDraft({
conversationID: 'C2Cuser123',
draftText: '这是一条草稿消息'
});
createC2CConversation
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| userID | string | 是 | 目标用户ID |
示例
import { useConversationListState } from 'tuikit-atomicx-vue3';
const { createC2CConversation } = useConversationListState();
// 创建与用户的单聊会话
try {
const conversation = await createC2CConversation('user123');
console.log('单聊会话创建成功:', conversation);
} catch (error) {
console.error('创建单聊会话失败:', error);
}
createGroupConversation
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| groupID | string | 否 | 群组ID(可选) |
| name | string | 是 | 群组名称 |
| type | string | 是 | 群组类型 |
| memberList | string[] | 否 | 初始成员列表 |
示例
import { useConversationListState } from 'tuikit-atomicx-vue3';
import TUIChatEngine from '@tencentcloud/chat-uikit-engine-lite';
const { createGroupConversation } = useConversationListState();
// 创建群聊会话
try {
const conversation = await createGroupConversation({
name: '我的群聊',
type: TUIChatEngine.TYPES.GRP_WORK,
memberList: ['user1', 'user2']
});
console.log('群聊会话创建成功:', conversation);
} catch (error) {
console.error('创建群聊会话失败:', error);
}
ContactListState
👥 联系人管理模块
核心功能:管理用户的联系人列表,包括好友管理、群组管理、黑名单管理等完整的联系人功能。
技术特点:支持联系人分组、好友申请处理、群组申请管理等功能。新增friendList、groupList、blackList等响应式数据和完整的联系人操作接口。
业务价值:为用户提供完整的社交关系管理能力,构建社交网络。
应用场景:好友管理、群组管理、联系人搜索、社交网络等场景。
响应式数据
friendList
Ref<any>
示例
import { useContactListState } from 'tuikit-atomicx-vue3';
const { friendList } = useContactListState();
// 监听数据变化
watch(friendList, (newValue) => {
console.log('friendList 更新:', newValue);
});
// 直接访问数据
console.log('当前 friendList:', friendList.value);
groupList
Ref<any>
示例
import { useContactListState } from 'tuikit-atomicx-vue3';
const { groupList } = useContactListState();
// 监听数据变化
watch(groupList, (newValue) => {
console.log('groupList 更新:', newValue);
});
// 直接访问数据
console.log('当前 groupList:', groupList.value);
blackList
Ref<any>
示例
import { useContactListState } from 'tuikit-atomicx-vue3';
const { blackList } = useContactListState();
// 监听数据变化
watch(blackList, (newValue) => {
console.log('blackList 更新:', newValue);
});
// 直接访问数据
console.log('当前 blackList:', blackList.value);
friendApplicationUnreadCount
Ref<any>
示例
import { useContactListState } from 'tuikit-atomicx-vue3';
const { friendApplicationUnreadCount } = useContactListState();
// 监听数据变化
watch(friendApplicationUnreadCount, (newValue) => {
console.log('friendApplicationUnreadCount 更新:', newValue);
});
// 直接访问数据
console.log('当前 friendApplicationUnreadCount:', friendApplicationUnreadCount.value);
friendGroupList
Ref<any>
示例
import { useContactListState } from 'tuikit-atomicx-vue3';
const { friendGroupList } = useContactListState();
// 监听数据变化
watch(friendGroupList, (newValue) => {
console.log('friendGroupList 更新:', newValue);
});
// 直接访问数据
console.log('当前 friendGroupList:', friendGroupList.value);
friendApplicationList
Ref<any>
示例
import { useContactListState } from 'tuikit-atomicx-vue3';
const { friendApplicationList } = useContactListState();
// 监听数据变化
watch(friendApplicationList, (newValue) => {
console.log('friendApplicationList 更新:', newValue);
});
// 直接访问数据
console.log('当前 friendApplicationList:', friendApplicationList.value);
groupApplicationList
Ref<any>
示例
import { useContactListState } from 'tuikit-atomicx-vue3';
const { groupApplicationList } = useContactListState();
// 监听数据变化
watch(groupApplicationList, (newValue) => {
console.log('groupApplicationList 更新:', newValue);
});
// 直接访问数据
console.log('当前 groupApplicationList:', groupApplicationList.value);
接口函数
setGroupApplicationList
示例
import { useContactListState } from 'tuikit-atomicx-vue3';
const { setGroupApplicationList } = useContactListState();
// Set group application list
await setGroupApplicationList({
applicationList: []
});
setFriendList
示例
import { useContactListState } from 'tuikit-atomicx-vue3';
const { setFriendList } = useContactListState();
// Set friend list
await setFriendList({
friendList: []
});
setGroupList
示例
import { useContactListState } from 'tuikit-atomicx-vue3';
const { setGroupList } = useContactListState();
// Set group list
await setGroupList({
groupList: []
});
setBlackList
示例
import { useContactListState } from 'tuikit-atomicx-vue3';
const { setBlackList } = useContactListState();
// Set black list
await setBlackList({
blackList: []
});
setFriendApplicationUnreadCount
示例
import { useContactListState } from 'tuikit-atomicx-vue3';
const { setFriendApplicationUnreadCount } = useContactListState();
// Set friend application unread count
await setFriendApplicationUnreadCount({
count: 5
});
setFriendGroupList
示例
import { useContactListState } from 'tuikit-atomicx-vue3';
const { setFriendGroupList } = useContactListState();
// Set friend group list
await setFriendGroupList({
groupList: []
});
setFriendApplicationList
示例
import { useContactListState } from 'tuikit-atomicx-vue3';
const { setFriendApplicationList } = useContactListState();
// Set friend application list
await setFriendApplicationList({
applicationList: []
});
initContactListWatcher
示例
import { useContactListState } from 'tuikit-atomicx-vue3';
const { initContactListWatcher } = useContactListState();
// Initialize contact list watcher
await initContactListWatcher({
autoUpdate: true
});
addFriend
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| userID | string | 是 | 要添加的用户ID |
| addSource | string | 是 | 添加来源 |
| remark | string | 否 | 好友备注 |
| groupName | string | 否 | 好友分组名称 |
| wording | string | 否 | 申请理由 |
| type | number | 否 | 申请类型 |
示例
import { useContactListState } from 'tuikit-atomicx-vue3';
const { addFriend } = useContactListState();
// 添加好友
try {
await addFriend({
userID: 'user123',
addSource: 'search',
remark: '同事小王',
groupName: '工作',
wording: '我是小李,想加您为好友'
});
console.log('好友申请发送成功');
} catch (error) {
console.error('添加好友失败:', error);
}
markFriendApplicationAsRead
示例
import { useContactListState } from 'tuikit-atomicx-vue3';
const { markFriendApplicationAsRead } = useContactListState();
// 标记好友申请为已读
try {
await markFriendApplicationAsRead();
console.log('好友申请已标记为已读');
} catch (error) {
console.error('标记已读失败:', error);
}
acceptFriendApplication
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| userID | string | 是 | 申请用户的ID |
| remark | string | 否 | 好友备注 |
| type | number | 是 | 申请类型 |
示例
import { useContactListState } from 'tuikit-atomicx-vue3';
const { acceptFriendApplication } = useContactListState();
// 接受好友申请
try {
await acceptFriendApplication({
userID: 'user123',
remark: '新朋友',
type: 1
});
console.log('好友申请已接受');
} catch (error) {
console.error('接受申请失败:', error);
}
refuseFriendApplication
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| userID | string | 是 | 申请用户的ID |
示例
import { useContactListState } from 'tuikit-atomicx-vue3';
const { refuseFriendApplication } = useContactListState();
// 拒绝好友申请
try {
await refuseFriendApplication('user123');
console.log('好友申请已拒绝');
} catch (error) {
console.error('拒绝申请失败:', error);
}
addToBlacklist
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| userIDList | string[] | 是 | 要添加到黑名单的用户ID列表 |
示例
import { useContactListState } from 'tuikit-atomicx-vue3';
const { addToBlacklist } = useContactListState();
// 添加用户到黑名单
try {
await addToBlacklist(['user123', 'user456']);
console.log('用户已添加到黑名单');
} catch (error) {
console.error('添加到黑名单失败:', error);
}
removeFromBlacklist
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| userIDList | string[] | 是 | 要从黑名单移除的用户ID列表 |
示例
import { useContactListState } from 'tuikit-atomicx-vue3';
const { removeFromBlacklist } = useContactListState();
// 从黑名单移除用户
try {
await removeFromBlacklist(['user123', 'user456']);
console.log('用户已从黑名单移除');
} catch (error) {
console.error('从黑名单移除失败:', error);
}
deleteFriend
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| userID | string | 是 | 要删除的好友用户ID |
| type | string | 否 | 删除类型 |
示例
import { useContactListState } from 'tuikit-atomicx-vue3';
const { deleteFriend } = useContactListState();
// 删除好友
try {
await deleteFriend({
userID: 'user123',
type: 'both'
});
console.log('好友删除成功');
} catch (error) {
console.error('删除好友失败:', error);
}
setFriendRemark
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| userID | string | 是 | 好友用户ID |
| remark | string | 是 | 新的备注名称 |
示例
import { useContactListState } from 'tuikit-atomicx-vue3';
const { setFriendRemark } = useContactListState();
// 设置好友备注
try {
await setFriendRemark({
userID: 'user123',
remark: '小王同事'
});
console.log('好友备注设置成功');
} catch (error) {
console.error('设置备注失败:', error);
}
createFriendGroup
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| name | string | 是 | 分组名称 |
| userIDList | string[] | 否 | 要添加到分组的用户ID列表 |
示例
import { useContactListState } from 'tuikit-atomicx-vue3';
const { createFriendGroup } = useContactListState();
// 创建好友分组
try {
await createFriendGroup({
name: '工作同事',
userIDList: ['user123', 'user456']
});
console.log('好友分组创建成功');
} catch (error) {
console.error('创建分组失败:', error);
}
deleteFriendGroup
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| name | string | 是 | 要删除的分组名称 |
示例
import { useContactListState } from 'tuikit-atomicx-vue3';
const { deleteFriendGroup } = useContactListState();
// 删除好友分组
try {
await deleteFriendGroup('工作同事');
console.log('好友分组删除成功');
} catch (error) {
console.error('删除分组失败:', error);
}
addToFriendGroup
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| name | string | 是 | 分组名称 |
| userIDList | string[] | 是 | 要添加的好友用户ID列表 |
示例
import { useContactListState } from 'tuikit-atomicx-vue3';
const { addToFriendGroup } = useContactListState();
// 添加好友到分组
try {
await addToFriendGroup({
name: '工作同事',
userIDList: ['user789']
});
console.log('好友已添加到分组');
} catch (error) {
console.error('添加到分组失败:', error);
}
removeFromFriendGroup
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| name | string | 是 | 分组名称 |
| userIDList | string[] | 是 | 要移除的好友用户ID列表 |
示例
import { useContactListState } from 'tuikit-atomicx-vue3';
const { removeFromFriendGroup } = useContactListState();
// 从分组移除好友
try {
await removeFromFriendGroup({
name: '工作同事',
userIDList: ['user789']
});
console.log('好友已从分组移除');
} catch (error) {
console.error('从分组移除失败:', error);
}
renameFriendGroup
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| oldName | string | 是 | 原分组名称 |
| newName | string | 是 | 新分组名称 |
示例
import { useContactListState } from 'tuikit-atomicx-vue3';
const { renameFriendGroup } = useContactListState();
// 重命名好友分组
try {
await renameFriendGroup({
oldName: '工作同事',
newName: '公司同事'
});
console.log('分组重命名成功');
} catch (error) {
console.error('重命名分组失败:', error);
}
joinGroup
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| groupID | string | 是 | 要加入的群组ID |
| applyMessage | string | 否 | 申请加群的理由 |
| type | string | 否 | 加群类型 |
示例
import { useContactListState } from 'tuikit-atomicx-vue3';
const { joinGroup } = useContactListState();
// 申请加入群组
try {
await joinGroup({
groupID: 'group123',
applyMessage: '我想加入这个群组学习交流'
});
console.log('加群申请已发送');
} catch (error) {
console.error('加入群组失败:', error);
}
acceptGroupApplication
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| application | GroupApplication | 是 | 群组申请对象 |
| handleMessage | string | 否 | 处理消息 |
示例
import { useContactListState } from 'tuikit-atomicx-vue3';
const { acceptGroupApplication, groupApplicationList } = useContactListState();
// 接受群组申请
try {
const application = groupApplicationList.value[0];
await acceptGroupApplication({
application: application,
handleMessage: '欢迎加入群组'
});
console.log('群组申请已接受');
} catch (error) {
console.error('接受群组申请失败:', error);
}
refuseGroupApplication
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| application | GroupApplication | 是 | 群组申请对象 |
| handleMessage | string | 否 | 拒绝理由 |
示例
import { useContactListState } from 'tuikit-atomicx-vue3';
const { refuseGroupApplication, groupApplicationList } = useContactListState();
// 拒绝群组申请
try {
const application = groupApplicationList.value[0];
await refuseGroupApplication({
application: application,
handleMessage: '暂不接受新成员'
});
console.log('群组申请已拒绝');
} catch (error) {
console.error('拒绝群组申请失败:', error);
}
C2CSettingState
👤 单聊设置管理模块
核心功能:管理单聊会话的各种设置,包括用户信息、聊天设置、权限控制等功能。
技术特点:支持实时设置同步、权限管理、个性化配置等功能。更新响应式数据为userID、avatar、signature等标准化字段。
业务价值:为用户提供个性化的单聊体验,提升沟通质量。
应用场景:单聊设置、用户信息管理、聊天权限控制等场景。
响应式数据
currentConversationRef
Ref<IConversationModel | undefined>
示例
import { useC2CSettingState } from 'tuikit-atomicx-vue3';
const { currentConversationRef } = useC2CSettingState();
// 监听数据变化
watch(currentConversationRef, (newValue) => {
console.log('currentConversationRef 更新:', newValue);
});
// 直接访问数据
console.log('当前 currentConversationRef:', currentConversationRef.value);
userIDRef
Ref<string | undefined>
示例
import { useC2CSettingState } from 'tuikit-atomicx-vue3';
const { userIDRef } = useC2CSettingState();
// 监听数据变化
watch(userIDRef, (newValue) => {
console.log('userIDRef 更新:', newValue);
});
// 直接访问数据
console.log('当前 userIDRef:', userIDRef.value);
nickRef
Ref<string | undefined>
示例
import { useC2CSettingState } from 'tuikit-atomicx-vue3';
const { nickRef } = useC2CSettingState();
// 监听数据变化
watch(nickRef, (newValue) => {
console.log('nickRef 更新:', newValue);
});
// 直接访问数据
console.log('当前 nickRef:', nickRef.value);
avatarRef
Ref<string | undefined>
示例
import { useC2CSettingState } from 'tuikit-atomicx-vue3';
const { avatarRef } = useC2CSettingState();
// 监听数据变化
watch(avatarRef, (newValue) => {
console.log('avatarRef 更新:', newValue);
});
// 直接访问数据
console.log('当前 avatarRef:', avatarRef.value);
signatureRef
Ref<string | undefined>
示例
import { useC2CSettingState } from 'tuikit-atomicx-vue3';
const { signatureRef } = useC2CSettingState();
// 监听数据变化
watch(signatureRef, (newValue) => {
console.log('signatureRef 更新:', newValue);
});
// 直接访问数据
console.log('当前 signatureRef:', signatureRef.value);
remarkRef
Ref<string | undefined>
示例
import { useC2CSettingState } from 'tuikit-atomicx-vue3';
const { remarkRef } = useC2CSettingState();
// 监听数据变化
watch(remarkRef, (newValue) => {
console.log('remarkRef 更新:', newValue);
});
// 直接访问数据
console.log('当前 remarkRef:', remarkRef.value);
isMutedRef
Ref<boolean | undefined>
示例
import { useC2CSettingState } from 'tuikit-atomicx-vue3';
const { isMutedRef } = useC2CSettingState();
// 监听数据变化
watch(isMutedRef, (newValue) => {
console.log('isMutedRef 更新:', newValue);
});
// 直接访问数据
console.log('当前 isMutedRef:', isMutedRef.value);
isPinnedRef
Ref<boolean | undefined>
示例
import { useC2CSettingState } from 'tuikit-atomicx-vue3';
const { isPinnedRef } = useC2CSettingState();
// 监听数据变化
watch(isPinnedRef, (newValue) => {
console.log('isPinnedRef 更新:', newValue);
});
// 直接访问数据
console.log('当前 isPinnedRef:', isPinnedRef.value);
isContactRef
Ref<boolean | undefined>
示例
import { useC2CSettingState } from 'tuikit-atomicx-vue3';
const { isContactRef } = useC2CSettingState();
// 监听数据变化
watch(isContactRef, (newValue) => {
console.log('isContactRef 更新:', newValue);
});
// 直接访问数据
console.log('当前 isContactRef:', isContactRef.value);
userID
Ref<any>
示例
import { useC2CSettingState } from 'tuikit-atomicx-vue3';
const { userID } = useC2CSettingState();
// 监听数据变化
watch(userID, (newValue) => {
console.log('userID 更新:', newValue);
});
// 直接访问数据
console.log('当前 userID:', userID.value);
avatar
Ref<any>
示例
import { useC2CSettingState } from 'tuikit-atomicx-vue3';
const { avatar } = useC2CSettingState();
// 监听数据变化
watch(avatar, (newValue) => {
console.log('avatar 更新:', newValue);
});
// 直接访问数据
console.log('当前 avatar:', avatar.value);
signature
Ref<any>
示例
import { useC2CSettingState } from 'tuikit-atomicx-vue3';
const { signature } = useC2CSettingState();
// 监听数据变化
watch(signature, (newValue) => {
console.log('signature 更新:', newValue);
});
// 直接访问数据
console.log('当前 signature:', signature.value);
remark
Ref<any>
示例
import { useC2CSettingState } from 'tuikit-atomicx-vue3';
const { remark } = useC2CSettingState();
// 监听数据变化
watch(remark, (newValue) => {
console.log('remark 更新:', newValue);
});
// 直接访问数据
console.log('当前 remark:', remark.value);
isMuted
Ref<any>
示例
import { useC2CSettingState } from 'tuikit-atomicx-vue3';
const { isMuted } = useC2CSettingState();
// 监听数据变化
watch(isMuted, (newValue) => {
console.log('isMuted 更新:', newValue);
});
// 直接访问数据
console.log('当前 isMuted:', isMuted.value);
isPinned
Ref<any>
示例
import { useC2CSettingState } from 'tuikit-atomicx-vue3';
const { isPinned } = useC2CSettingState();
// 监听数据变化
watch(isPinned, (newValue) => {
console.log('isPinned 更新:', newValue);
});
// 直接访问数据
console.log('当前 isPinned:', isPinned.value);
isContact
Ref<any>
示例
import { useC2CSettingState } from 'tuikit-atomicx-vue3';
const { isContact } = useC2CSettingState();
// 监听数据变化
watch(isContact, (newValue) => {
console.log('isContact 更新:', newValue);
});
// 直接访问数据
console.log('当前 isContact:', isContact.value);
接口函数
setChatPinned
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| value | boolean | 是 | 置顶状态,true为置顶,false为取消置顶 |
示例
import { useC2CSettingState } from 'tuikit-atomicx-vue3';
const { setChatPinned, isPinned } = useC2CSettingState();
// 置顶会话
setChatPinned(true);
// 取消置顶
setChatPinned(false);
// 切换置顶状态
const togglePin = () => {
setChatPinned(!isPinned.value);
};
setChatMuted
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| value | boolean | 是 | 静音状态,true为静音,false为取消静音 |
示例
import { useC2CSettingState } from 'tuikit-atomicx-vue3';
const { setChatMuted, isMuted } = useC2CSettingState();
// 静音会话
setChatMuted(true);
// 取消静音
setChatMuted(false);
// 切换静音状态
const toggleMute = () => {
setChatMuted(!isMuted.value);
};
setUserRemark
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| remark | string | 是 | 要设置的备注名 |
示例
import { useC2CSettingState } from 'tuikit-atomicx-vue3';
const { setUserRemark, userID, isContact } = useC2CSettingState();
// 设置好友备注
const updateRemark = (newRemark: string) => {
if (isContact.value && userID.value) {
setUserRemark(newRemark);
console.log('备注设置成功');
} else {
console.log('只能为好友设置备注');
}
};
// 使用示例
updateRemark('我的好朋友');
GroupSettingState
👥 群聊设置管理模块
核心功能:管理群聊的各种设置和操作,包括群信息管理、成员管理、权限控制等完整的群管理功能。
技术特点:支持群权限管理、成员操作、群设置同步等功能。新增groupID、groupType、groupName等完整的群信息响应式数据和管理接口。
业务价值:为群主和管理员提供完整的群管理能力,维护群秩序。
应用场景:群管理、成员管理、权限控制、群设置等场景。
响应式数据
groupID
Ref<any>
示例
import { useGroupSettingState } from 'tuikit-atomicx-vue3';
const { groupID } = useGroupSettingState();
// 监听数据变化
watch(groupID, (newValue) => {
console.log('groupID 更新:', newValue);
});
// 直接访问数据
console.log('当前 groupID:', groupID.value);
groupType
Ref<any>
示例
import { useGroupSettingState } from 'tuikit-atomicx-vue3';
const { groupType } = useGroupSettingState();
// 监听数据变化
watch(groupType, (newValue) => {
console.log('groupType 更新:', newValue);
});
// 直接访问数据
console.log('当前 groupType:', groupType.value);
groupName
Ref<any>
示例
import { useGroupSettingState } from 'tuikit-atomicx-vue3';
const { groupName } = useGroupSettingState();
// 监听数据变化
watch(groupName, (newValue) => {
console.log('groupName 更新:', newValue);
});
// 直接访问数据
console.log('当前 groupName:', groupName.value);
avatar
Ref<any>
示例
import { useGroupSettingState } from 'tuikit-atomicx-vue3';
const { avatar } = useGroupSettingState();
// 监听数据变化
watch(avatar, (newValue) => {
console.log('avatar 更新:', newValue);
});
// 直接访问数据
console.log('当前 avatar:', avatar.value);
introduction
Ref<any>
示例
import { useGroupSettingState } from 'tuikit-atomicx-vue3';
const { introduction } = useGroupSettingState();
// 监听数据变化
watch(introduction, (newValue) => {
console.log('introduction 更新:', newValue);
});
// 直接访问数据
console.log('当前 introduction:', introduction.value);
notification
Ref<any>
示例
import { useGroupSettingState } from 'tuikit-atomicx-vue3';
const { notification } = useGroupSettingState();
// 监听数据变化
watch(notification, (newValue) => {
console.log('notification 更新:', newValue);
});
// 直接访问数据
console.log('当前 notification:', notification.value);
isMuted
Ref<any>
示例
import { useGroupSettingState } from 'tuikit-atomicx-vue3';
const { isMuted } = useGroupSettingState();
// 监听数据变化
watch(isMuted, (newValue) => {
console.log('isMuted 更新:', newValue);
});
// 直接访问数据
console.log('当前 isMuted:', isMuted.value);
isPinned
Ref<any>
示例
import { useGroupSettingState } from 'tuikit-atomicx-vue3';
const { isPinned } = useGroupSettingState();
// 监听数据变化
watch(isPinned, (newValue) => {
console.log('isPinned 更新:', newValue);
});
// 直接访问数据
console.log('当前 isPinned:', isPinned.value);
groupOwner
Ref<any>
示例
import { useGroupSettingState } from 'tuikit-atomicx-vue3';
const { groupOwner } = useGroupSettingState();
// 监听数据变化
watch(groupOwner, (newValue) => {
console.log('groupOwner 更新:', newValue);
});
// 直接访问数据
console.log('当前 groupOwner:', groupOwner.value);
adminMembers
Ref<any>
示例
import { useGroupSettingState } from 'tuikit-atomicx-vue3';
const { adminMembers } = useGroupSettingState();
// 监听数据变化
watch(adminMembers, (newValue) => {
console.log('adminMembers 更新:', newValue);
});
// 直接访问数据
console.log('当前 adminMembers:', adminMembers.value);
allMembers
Ref<any>
示例
import { useGroupSettingState } from 'tuikit-atomicx-vue3';
const { allMembers } = useGroupSettingState();
// 监听数据变化
watch(allMembers, (newValue) => {
console.log('allMembers 更新:', newValue);
});
// 直接访问数据
console.log('当前 allMembers:', allMembers.value);
memberCount
Ref<any>
示例
import { useGroupSettingState } from 'tuikit-atomicx-vue3';
const { memberCount } = useGroupSettingState();
// 监听数据变化
watch(memberCount, (newValue) => {
console.log('memberCount 更新:', newValue);
});
// 直接访问数据
console.log('当前 memberCount:', memberCount.value);
maxMemberCount
Ref<any>
示例
import { useGroupSettingState } from 'tuikit-atomicx-vue3';
const { maxMemberCount } = useGroupSettingState();
// 监听数据变化
watch(maxMemberCount, (newValue) => {
console.log('maxMemberCount 更新:', newValue);
});
// 直接访问数据
console.log('当前 maxMemberCount:', maxMemberCount.value);
currentUserID
Ref<any>
示例
import { useGroupSettingState } from 'tuikit-atomicx-vue3';
const { currentUserID } = useGroupSettingState();
// 监听数据变化
watch(currentUserID, (newValue) => {
console.log('currentUserID 更新:', newValue);
});
// 直接访问数据
console.log('当前 currentUserID:', currentUserID.value);
currentUserRole
Ref<any>
示例
import { useGroupSettingState } from 'tuikit-atomicx-vue3';
const { currentUserRole } = useGroupSettingState();
// 监听数据变化
watch(currentUserRole, (newValue) => {
console.log('currentUserRole 更新:', newValue);
});
// 直接访问数据
console.log('当前 currentUserRole:', currentUserRole.value);
nameCard
Ref<any>
示例
import { useGroupSettingState } from 'tuikit-atomicx-vue3';
const { nameCard } = useGroupSettingState();
// 监听数据变化
watch(nameCard, (newValue) => {
console.log('nameCard 更新:', newValue);
});
// 直接访问数据
console.log('当前 nameCard:', nameCard.value);
isMuteAllMembers
Ref<any>
示例
import { useGroupSettingState } from 'tuikit-atomicx-vue3';
const { isMuteAllMembers } = useGroupSettingState();
// 监听数据变化
watch(isMuteAllMembers, (newValue) => {
console.log('isMuteAllMembers 更新:', newValue);
});
// 直接访问数据
console.log('当前 isMuteAllMembers:', isMuteAllMembers.value);
isInGroup
Ref<any>
示例
import { useGroupSettingState } from 'tuikit-atomicx-vue3';
const { isInGroup } = useGroupSettingState();
// 监听数据变化
watch(isInGroup, (newValue) => {
console.log('isInGroup 更新:', newValue);
});
// 直接访问数据
console.log('当前 isInGroup:', isInGroup.value);
inviteOption
Ref<any>
示例
import { useGroupSettingState } from 'tuikit-atomicx-vue3';
const { inviteOption } = useGroupSettingState();
// 监听数据变化
watch(inviteOption, (newValue) => {
console.log('inviteOption 更新:', newValue);
});
// 直接访问数据
console.log('当前 inviteOption:', inviteOption.value);
接口函数
getGroupMemberList
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| groupID | string | 否 | 群组ID,不传则使用当前群组ID |
| count | number | 否 | 获取成员数量,默认100 |
| offset | number | 否 | 偏移量,用于分页,默认0 |
示例
import { useGroupSettingState } from 'tuikit-atomicx-vue3';
const { getGroupMemberList } = useGroupSettingState();
// 获取群组成员列表
try {
const members = await getGroupMemberList({
groupID: 'group123',
count: 50,
offset: 0
});
console.log('群组成员:', members);
} catch (error) {
console.error('获取成员列表失败:', error);
}
// 分页加载更多成员
const moreMembers = await getGroupMemberList({
count: 50,
offset: 50
});
updateGroupProfile
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| groupID | string | 否 | 群组ID,不传则使用当前群组ID |
| name | string | 否 | 群组名称,长度限制1-30字符 |
| avatar | string | 否 | 群组头像URL,长度限制500字符以内 |
| introduction | string | 否 | 群组简介,长度限制130字符以内 |
| notification | string | 否 | 群组公告,长度限制130字符以内 |
示例
import { useGroupSettingState } from 'tuikit-atomicx-vue3';
const { updateGroupProfile } = useGroupSettingState();
// 更新群组资料
try {
await updateGroupProfile({
groupID: 'group123',
name: '新的群组名称',
introduction: '这是一个学习交流群',
notification: '欢迎大家积极讨论',
avatar: 'https://example.com/avatar.jpg'
});
console.log('群组资料更新成功');
} catch (error) {
console.error('更新群组资料失败:', error);
}
// 只更新群名称
await updateGroupProfile({
name: '技术交流群'
});
addGroupMember
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| groupID | string | 否 | 群组ID,不传则使用当前群组ID |
| userIDList | string[] | 是 | 要添加的用户ID列表 |
示例
import { useGroupSettingState } from 'tuikit-atomicx-vue3';
const { addGroupMember } = useGroupSettingState();
// 添加群组成员
try {
const result = await addGroupMember({
groupID: 'group123',
userIDList: ['user1', 'user2', 'user3']
});
console.log('添加成功的用户:', result.successUserIDList);
console.log('添加失败的用户:', result.failureUserIDList);
} catch (error) {
console.error('添加群组成员失败:', error);
}
deleteGroupMember
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| groupID | string | 否 | 群组ID,不传则使用当前群组ID |
| userIDList | string[] | 是 | 要删除的用户ID列表 |
示例
import { useGroupSettingState } from 'tuikit-atomicx-vue3';
const { deleteGroupMember } = useGroupSettingState();
// 删除群组成员
try {
await deleteGroupMember({
groupID: 'group123',
userIDList: ['user1', 'user2']
});
console.log('群组成员删除成功');
} catch (error) {
console.error('删除群组成员失败:', error);
}
changeGroupOwner
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| groupID | string | 否 | 群组ID,不传则使用当前群组ID |
| newOwnerID | string | 是 | 新群主的用户ID |
示例
import { useGroupSettingState } from 'tuikit-atomicx-vue3';
const { changeGroupOwner } = useGroupSettingState();
// 转让群主
try {
await changeGroupOwner({
groupID: 'group123',
newOwnerID: 'user123'
});
console.log('群主转让成功');
} catch (error) {
console.error('转让群主失败:', error);
}
setGroupMemberRole
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| groupID | string | 否 | 群组ID,不传则使用当前群组ID |
| userID | string | 是 | 要设置角色的用户ID |
| role | GroupMemberRole | 是 | 新的角色类型 |
示例
import { useGroupSettingState, GroupMemberRole } from 'tuikit-atomicx-vue3';
const { setGroupMemberRole } = useGroupSettingState();
// 设置用户为管理员
try {
await setGroupMemberRole({
groupID: 'group123',
userID: 'user123',
role: GroupMemberRole.ADMIN
});
console.log('成员角色设置成功');
} catch (error) {
console.error('设置成员角色失败:', error);
}
// 取消管理员权限
await setGroupMemberRole({
userID: 'user123',
role: GroupMemberRole.COMMON
});
setGroupMemberNameCard
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| groupID | string | 否 | 群组ID,不传则使用当前群组ID |
| userID | string | 否 | 用户ID,不传则使用当前用户ID |
| nameCard | string | 是 | 群名片内容 |
示例
import { useGroupSettingState } from 'tuikit-atomicx-vue3';
const { setGroupMemberNameCard } = useGroupSettingState();
// 设置自己的群名片
try {
await setGroupMemberNameCard({
groupID: 'group123',
nameCard: '技术负责人-小王'
});
console.log('群名片设置成功');
} catch (error) {
console.error('设置群名片失败:', error);
}
// 设置其他成员的群名片(需要管理员权限)
await setGroupMemberNameCard({
userID: 'user123',
nameCard: '产品经理-小李'
});
setChatPinned
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| value | boolean | 是 | 是否置顶,true为置顶,false为取消置顶 |
示例
import { useGroupSettingState } from 'tuikit-atomicx-vue3';
const { setChatPinned } = useGroupSettingState();
// 置顶聊天
try {
await setChatPinned(true);
console.log('聊天置顶成功');
} catch (error) {
console.error('设置置顶失败:', error);
}
// 取消置顶
await setChatPinned(false);
setChatMuted
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| value | boolean | 是 | 是否免打扰,true为开启免打扰,false为关闭免打扰 |
示例
import { useGroupSettingState } from 'tuikit-atomicx-vue3';
const { setChatMuted } = useGroupSettingState();
// 开启免打扰
try {
await setChatMuted(true);
console.log('免打扰设置成功');
} catch (error) {
console.error('设置免打扰失败:', error);
}
// 关闭免打扰
await setChatMuted(false);
setGroupMemberMuteTime
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| groupID | string | 否 | 群组ID,不传则使用当前群组ID |
| userID | string | 是 | 要禁言的用户ID |
| time | number | 是 | 禁言时间(秒),0表示取消禁言 |
示例
import { useGroupSettingState } from 'tuikit-atomicx-vue3';
const { setGroupMemberMuteTime } = useGroupSettingState();
// 禁言用户10分钟
try {
await setGroupMemberMuteTime({
groupID: 'group123',
userID: 'user123',
time: 600 // 10分钟 = 600秒
});
console.log('用户禁言成功');
} catch (error) {
console.error('设置禁言失败:', error);
}
// 取消禁言
await setGroupMemberMuteTime({
userID: 'user123',
time: 0
});
setMuteAllMember
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| value | boolean | 是 | 是否全员禁言,true为开启,false为关闭 |
示例
import { useGroupSettingState } from 'tuikit-atomicx-vue3';
const { setMuteAllMember } = useGroupSettingState();
// 开启全员禁言
try {
await setMuteAllMember(true);
console.log('全员禁言开启成功');
} catch (error) {
console.error('设置全员禁言失败:', error);
}
// 关闭全员禁言
await setMuteAllMember(false);
dismissGroup
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| groupID | string | 否 | 群组ID,不传则使用当前群组ID |
示例
import { useGroupSettingState } from 'tuikit-atomicx-vue3';
const { dismissGroup } = useGroupSettingState();
// 解散群组
try {
await dismissGroup('group123');
console.log('群组解散成功');
} catch (error) {
console.error('解散群组失败:', error);
}
// 解散当前群组
await dismissGroup();
quitGroup
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| groupID | string | 否 | 群组ID,不传则使用当前群组ID |
示例
import { useGroupSettingState } from 'tuikit-atomicx-vue3';
const { quitGroup } = useGroupSettingState();
// 退出群组
try {
await quitGroup('group123');
console.log('退出群组成功');
} catch (error) {
console.error('退出群组失败:', error);
}
// 退出当前群组
await quitGroup();
hasPermission
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| permission | GroupPermission | 是 | 要检查的权限类型 |
| role | GroupMemberRole | 否 | 用户角色,不传则使用当前用户角色 |
| groupType | GroupType | 否 | 群组类型,不传则使用当前群组类型 |
示例
import { useGroupSettingState, GroupPermission, GroupMemberRole, GroupType } from 'tuikit-atomicx-vue3';
const { hasPermission } = useGroupSettingState();
// 检查当前用户是否有删除成员的权限
const canDeleteMember = hasPermission(GroupPermission.DELETE_MEMBER);
// 检查管理员在工作群中是否有修改群资料的权限
const canModifyProfile = hasPermission(
GroupPermission.MODIFY_GROUP_INFO,
GroupMemberRole.ADMIN,
GroupType.WORK
);
if (canDeleteMember) {
console.log('可以删除群成员');
}
canOperateOnMember
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| targetMember | GroupMember | 是 | 目标成员信息 |
示例
import { useGroupSettingState } from 'tuikit-atomicx-vue3';
const { canOperateOnMember, allMembers } = useGroupSettingState();
// 检查是否可以对某个成员进行操作
const member = allMembers.value?.find(m => m.userID === 'user123');
if (member && canOperateOnMember(member)) {
console.log('可以对该成员进行管理操作');
// 显示删除、禁言等操作按钮
} else {
console.log('无权限操作该成员');
}
// 权限规则:
// - 群主可以操作所有人(除自己)
// - 管理员只能操作普通成员
// - 普通成员不能操作任何人
// - 任何人都不能操作自己
getAvailablePermissions
示例
import { useGroupSettingState, GroupPermission } from 'tuikit-atomicx-vue3';
const { getAvailablePermissions } = useGroupSettingState();
// 获取当前用户的所有权限
const permissions = getAvailablePermissions();
// 根据权限显示不同的功能按钮
if (permissions.includes(GroupPermission.DELETE_MEMBER)) {
console.log('显示删除成员按钮');
}
if (permissions.includes(GroupPermission.MODIFY_GROUP_INFO)) {
console.log('显示编辑群资料按钮');
}
if (permissions.includes(GroupPermission.MUTE_MEMBER)) {
console.log('显示禁言成员按钮');
}
initWatcher
示例
// 该函数在模块加载时自动调用,监听以下数据变化:
// - 当前会话变化:自动更新群组信息和用户状态
// - 群组资料变化:同步更新群组ID等信息
// - 会话切换:自动重置或更新相关状态
// 通常不需要手动调用此函数
VideoMixerState
🎬 视频混流管理模块
核心功能:管理视频混流功能,支持多路视频合成、布局管理、媒体源控制等高级视频处理功能。
技术特点:支持实时视频混流、动态布局调整、媒体源管理等功能。新增isVideoMixerEnabled、mediaSourceList、activeMediaSource响应式数据和完整的混流控制接口。
业务价值:为直播平台提供专业的视频制作能力,提升直播质量。
应用场景:多人直播、画中画、视频合成、专业制作等场景。
响应式数据
publishVideoQuality
Ref<TUIVideoQuality>
示例
import { useVideoMixerState, TUIVideoQuality } from 'tuikit-atomicx-vue3';
const { publishVideoQuality } = useVideoMixerState();
// 监听视频质量变化
watch(publishVideoQuality, (newValue) => {
console.log('视频质量更新:', newValue);
});
// 设置视频质量
publishVideoQuality.value = TUIVideoQuality.kVideoQuality_720p;
isVideoMixerEnabled
Ref<boolean>
示例
import { useVideoMixerState } from 'tuikit-atomicx-vue3';
const { isVideoMixerEnabled, enableLocalVideoMixer } = useVideoMixerState();
// 监听混流状态变化
watch(isVideoMixerEnabled, (newValue) => {
console.log('视频混流状态:', newValue ? '已启用' : '未启用');
});
// 检查混流状态
if (!isVideoMixerEnabled.value) {
enableLocalVideoMixer();
}
mediaSourceList
Ref<MediaSource[]>
示例
import { useVideoMixerState } from 'tuikit-atomicx-vue3';
const { mediaSourceList } = useVideoMixerState();
// 监听媒体源列表变化
watch(mediaSourceList, (newValue) => {
console.log('媒体源数量:', newValue.length);
});
// 遍历所有媒体源
mediaSourceList.value.forEach(source => {
console.log('媒体源:', source.id, source.type);
});
activeMediaSource
ComputedRef<MediaSource | null>
示例
import { useVideoMixerState } from 'tuikit-atomicx-vue3';
const { activeMediaSource, updateMediaSource } = useVideoMixerState();
// 监听活跃媒体源变化
watch(activeMediaSource, (newValue) => {
if (newValue) {
console.log('当前选中的媒体源:', newValue.id);
}
});
// 更新当前活跃媒体源的布局
if (activeMediaSource.value) {
updateMediaSource(activeMediaSource.value, {
layout: { rect: { left: 0, top: 0, right: 640, bottom: 480 } }
});
}
接口函数
enableLocalVideoMixer
示例
import { useVideoMixerState } from 'tuikit-atomicx-vue3';
const { enableLocalVideoMixer, isVideoMixerEnabled } = useVideoMixerState();
// 启用视频混流
enableLocalVideoMixer();
console.log('视频混流已启用:', isVideoMixerEnabled.value);
addMediaSource
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| source | MediaSource | 是 | 媒体源对象,包含类型、配置和布局信息 |
示例
import { useVideoMixerState } from 'tuikit-atomicx-vue3';
import { TRTCMediaSourceType } from '@tencentcloud/tuiroom-engine-js';
const { addMediaSource } = useVideoMixerState();
// 添加摄像头媒体源
await addMediaSource({
type: TRTCMediaSourceType.kCamera,
camera: { cameraId: 'default' },
});
// 添加屏幕分享媒体源
await addMediaSource({
type: TRTCMediaSourceType.kScreen,
screen: { sourceId: 'screen' },
});
// 添加图片媒体源
await addMediaSource({
type: TRTCMediaSourceType.kImage,
image: { imagePath: '/path/to/image.png' },
});
updateMediaSource
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| source | MediaSource | 是 | 要更新的媒体源对象 |
| config | Partial<MediaSource> | 是 | 更新的配置内容 |
示例
import { useVideoMixerState } from 'tuikit-atomicx-vue3';
const { updateMediaSource, mediaSourceList } = useVideoMixerState();
// 更新媒体源布局
const source = mediaSourceList.value[0];
if (source) {
await updateMediaSource(source, {
layout: {
rect: { left: 100, top: 100, right: 500, bottom: 400 }
}
});
console.log('媒体源布局已更新');
}
removeMediaSource
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| source | MediaSource | 是 | 要移除的媒体源对象 |
示例
import { useVideoMixerState } from 'tuikit-atomicx-vue3';
const { removeMediaSource, mediaSourceList } = useVideoMixerState();
// 移除第一个媒体源
const source = mediaSourceList.value[0];
if (source) {
await removeMediaSource(source);
console.log('媒体源已移除');
}
clearMediaSource
示例
import { useVideoMixerState } from 'tuikit-atomicx-vue3';
const { clearMediaSource, mediaSourceList } = useVideoMixerState();
// 清空所有媒体源
clearMediaSource();
console.log('所有媒体源已清空,当前数量:', mediaSourceList.value.length);
VirtualBackgroundState
🖼️ 虚拟背景管理模块
核心功能:管理虚拟背景功能,支持背景替换、背景模糊、自定义背景等视频美化功能。
技术特点:基于AI技术实现实时背景分割和替换。新增virtualBackgroundConfig响应式数据和isSupported、setVirtualBackground接口函数。
业务价值:为用户提供隐私保护和视频美化功能,提升视频通话体验。
应用场景:视频通话、在线会议、直播美化、隐私保护等场景。
响应式数据
virtualBackgroundConfig
Ref<any>
示例
import { useVirtualBackgroundState } from 'tuikit-atomicx-vue3';
const { virtualBackgroundConfig } = useVirtualBackgroundState();
// 监听数据变化
watch(virtualBackgroundConfig, (newValue) => {
console.log('virtualBackgroundConfig 更新:', newValue);
});
// 直接访问数据
console.log('当前 virtualBackgroundConfig:', virtualBackgroundConfig.value);
接口函数
isSupported
示例
import { useVirtualBackgroundState } from 'tuikit-atomicx-vue3';
const { isSupported } = useVirtualBackgroundState();
// Check if virtual background is supported
if (isSupported()) {
console.log('虚拟背景功能可用');
} else {
console.log('当前设备不支持虚拟背景');
}
initVirtualBackground
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| assetsPath | string | 否 | 资源文件路径 |
示例
import { useVirtualBackgroundState } from 'tuikit-atomicx-vue3';
const { initVirtualBackground, isSupported } = useVirtualBackgroundState();
// Check support and initialize virtual background
if (isSupported()) {
await initVirtualBackground({
assetsPath: '/path/to/assets'
});
console.log('虚拟背景初始化成功');
}
setVirtualBackground
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| params | VirtualBackgroundConfig | 是 | 虚拟背景配置对象,包含 enable、type、source 等属性 |
示例
import { useVirtualBackgroundState } from 'tuikit-atomicx-vue3';
const { setVirtualBackground } = useVirtualBackgroundState();
// Enable blur background
await setVirtualBackground({
enable: true,
type: 'blur'
});
// Set image background
await setVirtualBackground({
enable: true,
type: 'image',
source: '/path/to/background.jpg'
});
// Disable virtual background
await setVirtualBackground({
enable: false
});
saveVirtualBackground
示例
import { useVirtualBackgroundState } from 'tuikit-atomicx-vue3';
const { setVirtualBackground, saveVirtualBackground } = useVirtualBackgroundState();
// Set and save virtual background
await setVirtualBackground({
enable: true,
type: 'blur'
});
await saveVirtualBackground();
console.log('虚拟背景配置已保存');
subscribeEvent
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| event | VirtualBackgroundEvent | 是 | 事件类型 |
| callback | VirtualBackgroundEventCallback | 是 | 事件回调函数 |
示例
import { useVirtualBackgroundState } from 'tuikit-atomicx-vue3';
import { VirtualBackgroundEvent } from 'tuikit-atomicx-vue3';
const { subscribeEvent } = useVirtualBackgroundState();
// Subscribe to abort event
subscribeEvent(VirtualBackgroundEvent.onAbort, () => {
console.log('虚拟背景被中断');
});
unsubscribeEvent
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| event | VirtualBackgroundEvent | 是 | 事件类型 |
| callback | VirtualBackgroundEventCallback | 是 | 之前订阅时使用的回调函数 |
示例
import { useVirtualBackgroundState } from 'tuikit-atomicx-vue3';
import { VirtualBackgroundEvent } from 'tuikit-atomicx-vue3';
const { subscribeEvent, unsubscribeEvent } = useVirtualBackgroundState();
const handleAbort = () => {
console.log('虚拟背景被中断');
};
// Subscribe
subscribeEvent(VirtualBackgroundEvent.onAbort, handleAbort);
// Unsubscribe when no longer needed
unsubscribeEvent(VirtualBackgroundEvent.onAbort, handleAbort);
ASRState
🎙️ 语音识别管理模块
核心功能:管理语音识别功能,支持实时语音转文字、转录历史管理、转录导出等功能。
技术特点:基于先进的ASR技术,支持多语言识别、实时转录、历史记录等功能。新增recentTranscripts、transcriptHistory响应式数据和exportTranscripts接口。
业务价值:为用户提供语音转文字服务,提升沟通效率和可访问性。
应用场景:会议记录、语音转录、无障碍通信、内容记录等场景。
响应式数据
recentTranscripts
Ref<any>
示例
import { useASRState } from 'tuikit-atomicx-vue3';
const { recentTranscripts } = useASRState();
// 监听数据变化
watch(recentTranscripts, (newValue) => {
console.log('recentTranscripts 更新:', newValue);
});
// 直接访问数据
console.log('当前 recentTranscripts:', recentTranscripts.value);
transcriptHistory
Ref<any>
示例
import { useASRState } from 'tuikit-atomicx-vue3';
const { transcriptHistory } = useASRState();
// 监听数据变化
watch(transcriptHistory, (newValue) => {
console.log('transcriptHistory 更新:', newValue);
});
// 直接访问数据
console.log('当前 transcriptHistory:', transcriptHistory.value);
接口函数
setRecentTranscriptsDuration
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| duration | number | 是 | 时间窗口大小,单位为毫秒 |
示例
import { useASRState } from 'tuikit-atomicx-vue3';
const { setRecentTranscriptsDuration } = useASRState();
// Set recent message window to 5 seconds
setRecentTranscriptsDuration(5000);
// Set recent message window to 10 seconds
setRecentTranscriptsDuration(10000);
clearHistory
示例
import { useASRState } from 'tuikit-atomicx-vue3';
const { clearHistory, transcriptHistory } = useASRState();
// Clear all transcript records
clearHistory();
console.log('转录记录已清空:', transcriptHistory.value.length === 0);
exportTranscripts
示例
import { useASRState } from 'tuikit-atomicx-vue3';
const { exportTranscripts } = useASRState();
// Export transcript records
const transcriptText = exportTranscripts();
if (transcriptText) {
// Save to file
const blob = new Blob([transcriptText], { type: 'text/plain' });
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = '会议转录记录.txt';
a.click();
URL.revokeObjectURL(url);
} else {
console.log('没有转录记录可导出');
}
SearchState
🔍 搜索功能管理模块
核心功能:管理全局搜索功能,支持消息搜索、用户搜索、群组搜索等多维度搜索能力。
技术特点:支持高级搜索、搜索历史、搜索建议等功能。重构响应式数据为keyword、results、isLoading等标准化字段,提供完整的搜索接口。
业务价值:为用户提供快速查找信息的能力,提升使用效率。
应用场景:消息搜索、联系人搜索、内容查找、历史记录等场景。
响应式数据
keyword
Ref<any>
示例
import { useSearchState } from 'tuikit-atomicx-vue3';
const { keyword } = useSearchState();
// 监听数据变化
watch(keyword, (newValue) => {
console.log('keyword 更新:', newValue);
});
// 直接访问数据
console.log('当前 keyword:', keyword.value);
results
Ref<any>
示例
import { useSearchState } from 'tuikit-atomicx-vue3';
const { results } = useSearchState();
// 监听数据变化
watch(results, (newValue) => {
console.log('results 更新:', newValue);
});
// 直接访问数据
console.log('当前 results:', results.value);
isLoading
Ref<any>
示例
import { useSearchState } from 'tuikit-atomicx-vue3';
const { isLoading } = useSearchState();
// 监听数据变化
watch(isLoading, (newValue) => {
console.log('isLoading 更新:', newValue);
});
// 直接访问数据
console.log('当前 isLoading:', isLoading.value);
error
Ref<any>
示例
import { useSearchState } from 'tuikit-atomicx-vue3';
const { error } = useSearchState();
// 监听数据变化
watch(error, (newValue) => {
console.log('error 更新:', newValue);
});
// 直接访问数据
console.log('当前 error:', error.value);
searchAdvancedParams
Ref<any>
示例
import { useSearchState } from 'tuikit-atomicx-vue3';
const { searchAdvancedParams } = useSearchState();
// 监听数据变化
watch(searchAdvancedParams, (newValue) => {
console.log('searchAdvancedParams 更新:', newValue);
});
// 直接访问数据
console.log('当前 searchAdvancedParams:', searchAdvancedParams.value);
selectedSearchType
Ref<any>
示例
import { useSearchState } from 'tuikit-atomicx-vue3';
const { selectedSearchType } = useSearchState();
// 监听数据变化
watch(selectedSearchType, (newValue) => {
console.log('selectedSearchType 更新:', newValue);
});
// 直接访问数据
console.log('当前 selectedSearchType:', selectedSearchType.value);
接口函数
setKeyword
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| keyword | string | 是 | 搜索关键词 |
示例
import { useSearchState } from 'tuikit-atomicx-vue3';
const { setKeyword } = useSearchState();
// Set search keyword
setKeyword('hello world');
// Clear search keyword
setKeyword('');
loadMore
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| type | SearchType | 否 | 搜索类型,如 SearchType.MESSAGE、SearchType.USER、SearchType.GROUP |
示例
import { useSearchState } from 'tuikit-atomicx-vue3';
import { SearchType } from '@tencentcloud/chat-uikit-engine-lite';
const { loadMore } = useSearchState();
// Load more message search results
await loadMore(SearchType.MESSAGE);
// Load more user search results
await loadMore(SearchType.USER);
setSelectedType
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| type | SearchType | 'all' | 是 | 搜索类型,'all' 表示搜索所有类型 |
示例
import { useSearchState } from 'tuikit-atomicx-vue3';
import { SearchType } from '@tencentcloud/chat-uikit-engine-lite';
const { setSelectedType } = useSearchState();
// Set search type to message
setSelectedType(SearchType.MESSAGE);
// Set search type to all
setSelectedType('all');
setSearchMessageAdvancedParams
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| params | SearchCloudMessagesParams | 是 | 消息搜索高级参数对象 |
示例
import { useSearchState } from 'tuikit-atomicx-vue3';
import TUIChatEngine from '@tencentcloud/chat-uikit-engine-lite';
const { setSearchMessageAdvancedParams } = useSearchState();
// Set message search advanced params
setSearchMessageAdvancedParams({
conversationID: 'C2C_user123',
senderUserIDList: ['user1', 'user2'],
messageTypeList: [TUIChatEngine.TYPES.MSG_TYPE_TEXT]
});
setSearchUserAdvancedParams
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| params | SearchCloudUsersParams | 是 | 用户搜索高级参数对象 |
示例
import { useSearchState } from 'tuikit-atomicx-vue3';
const { setSearchUserAdvancedParams } = useSearchState();
// Set user search advanced params
setSearchUserAdvancedParams({
// User search parameters
});
setSearchGroupAdvancedParams
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| params | SearchCloudGroupsParams | 是 | 群组搜索高级参数对象 |
示例
import { useSearchState } from 'tuikit-atomicx-vue3';
const { setSearchGroupAdvancedParams } = useSearchState();
// Set group search advanced params
setSearchGroupAdvancedParams({
// Group search parameters
});
SeatStore
🪑 座位存储管理模块
核心功能:提供座位状态的底层存储和管理,支持座位信息缓存、用户信息映射、设备请求处理等核心功能。
技术特点:采用响应式存储设计,支持实时状态同步、事件驱动更新等功能。新增liveOwnerUserId、localUserId、seatList等响应式数据和getUserInfo、convertUserInfoToAudienceInfo接口。
业务价值:为座位管理提供可靠的数据基础,确保座位状态的一致性。
应用场景:座位状态管理、用户信息存储、设备状态跟踪等底层场景。
响应式数据
liveOwnerUserId
Ref<any>
示例
import { useSeatStore } from 'tuikit-atomicx-vue3';
const { liveOwnerUserId } = useSeatStore();
// 监听数据变化
watch(liveOwnerUserId, (newValue) => {
console.log('liveOwnerUserId 更新:', newValue);
});
// 直接访问数据
console.log('当前 liveOwnerUserId:', liveOwnerUserId.value);
localUserId
Ref<any>
示例
import { useSeatStore } from 'tuikit-atomicx-vue3';
const { localUserId } = useSeatStore();
// 监听数据变化
watch(localUserId, (newValue) => {
console.log('localUserId 更新:', newValue);
});
// 直接访问数据
console.log('当前 localUserId:', localUserId.value);
seatList
Ref<any>
示例
import { useSeatStore } from 'tuikit-atomicx-vue3';
const { seatList } = useSeatStore();
// 监听数据变化
watch(seatList, (newValue) => {
console.log('seatList 更新:', newValue);
});
// 直接访问数据
console.log('当前 seatList:', seatList.value);
coHostUserList
Ref<any>
示例
import { useSeatStore } from 'tuikit-atomicx-vue3';
const { coHostUserList } = useSeatStore();
// 监听数据变化
watch(coHostUserList, (newValue) => {
console.log('coHostUserList 更新:', newValue);
});
// 直接访问数据
console.log('当前 coHostUserList:', coHostUserList.value);
sentDeviceRequestMap
Ref<any>
示例
import { useSeatStore } from 'tuikit-atomicx-vue3';
const { sentDeviceRequestMap } = useSeatStore();
// 监听数据变化
watch(sentDeviceRequestMap, (newValue) => {
console.log('sentDeviceRequestMap 更新:', newValue);
});
// 直接访问数据
console.log('当前 sentDeviceRequestMap:', sentDeviceRequestMap.value);
receivedDeviceRequestMap
Ref<any>
示例
import { useSeatStore } from 'tuikit-atomicx-vue3';
const { receivedDeviceRequestMap } = useSeatStore();
// 监听数据变化
watch(receivedDeviceRequestMap, (newValue) => {
console.log('receivedDeviceRequestMap 更新:', newValue);
});
// 直接访问数据
console.log('当前 receivedDeviceRequestMap:', receivedDeviceRequestMap.value);
userInfoMap
Ref<any>
示例
import { useSeatStore } from 'tuikit-atomicx-vue3';
const { userInfoMap } = useSeatStore();
// 监听数据变化
watch(userInfoMap, (newValue) => {
console.log('userInfoMap 更新:', newValue);
});
// 直接访问数据
console.log('当前 userInfoMap:', userInfoMap.value);
接口函数
getUserInfo
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| userId | string | 是 | 用户ID |
示例
import { useSeatStore } from 'tuikit-atomicx-vue3';
const { getUserInfo } = useSeatStore();
// Get user info by userId
const userInfo = await getUserInfo('user_123');
console.log('用户信息:', userInfo);
// Output: { userId, userName, avatarUrl, customInfo, userRole, isMessageDisabled }
convertUserInfoToAudienceInfo
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| userInfo | TUIUserInfo | 是 | TUIUserInfo 格式的用户信息对象 |
示例
import { useSeatStore } from 'tuikit-atomicx-vue3';
const { convertUserInfoToAudienceInfo } = useSeatStore();
// Convert TUIUserInfo to AudienceInfo format
const tuiUserInfo = {
userId: 'user_123',
userName: 'John',
avatarUrl: 'https://example.com/avatar.png',
roomCustomInfo: {},
userRole: 0,
isMessageDisabled: false
};
const audienceInfo = convertUserInfoToAudienceInfo(tuiUserInfo);
console.log('观众信息:', audienceInfo);
// Output: { userId, userName, avatarUrl, customInfo, userRole, isMessageDisabled }
RoomState
📦 RoomState 模块
核心功能:提供房间状态管理,包括房间创建、加入、离开、预约房间管理、呼叫功能等
应用场景:多人视频会议、在线教育、直播互动等需要房间管理的场景
响应式数据
scheduledRoomList
Ref<RoomInfo[]>
示例
import { useRoomState } from 'tuikit-atomicx-vue3';
const { scheduledRoomList } = useRoomState();
// 监听数据变化
watch(scheduledRoomList, (newValue) => {
console.log('scheduledRoomList 更新:', newValue);
});
// 直接访问数据
console.log('当前 scheduledRoomList:', scheduledRoomList.value);
scheduledRoomListCursor
Ref<string>
示例
import { useRoomState } from 'tuikit-atomicx-vue3';
const { scheduledRoomListCursor } = useRoomState();
// 监听数据变化
watch(scheduledRoomListCursor, (newValue) => {
console.log('scheduledRoomListCursor 更新:', newValue);
});
// 直接访问数据
console.log('当前 scheduledRoomListCursor:', scheduledRoomListCursor.value);
currentRoom
Ref<RoomInfo | null>
示例
import { useRoomState } from 'tuikit-atomicx-vue3';
const { currentRoom } = useRoomState();
// 监听数据变化
watch(currentRoom, (newValue) => {
console.log('currentRoom 更新:', newValue);
});
// 直接访问数据
console.log('当前 currentRoom:', currentRoom.value);
接口函数
getScheduledRoomList
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| cursor | string |
是 | 分页游标,首次请求传空字符串,后续请求传上次返回的 cursor |
示例
import { useRoomState } from 'tuikit-atomicx-vue3';
const { getScheduledRoomList } = useRoomState();
// 调用函数
await getScheduledRoomList({
cursor: '',
});
getScheduledAttendees
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| roomId | string |
是 | 房间 ID |
| cursor | string |
是 | 分页游标,首次请求传空字符串,后续请求传上次返回的 cursor |
示例
import { useRoomState } from 'tuikit-atomicx-vue3';
const { getScheduledAttendees } = useRoomState();
// 调用函数
await getScheduledAttendees({
roomId: 'room_123456',
cursor: '',
});
scheduleRoom
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| roomId | string |
是 | 房间 ID,需要保证唯一性 |
| roomName | string |
否 | 房间名称 |
| password | string |
否 | 房间密码 |
| scheduleStartTime | number |
是 | 预约开始时间(Unix 时间戳,单位秒) |
| scheduleEndTime | number |
是 | 预约结束时间(Unix 时间戳,单位秒) |
| reminderSecondsBeforeStart | number |
否 | 开始前提醒时间(单位秒) |
| scheduleAttendees | string[] |
否 | 预约参会人 userId 列表 |
| isAllMicrophoneDisabled | boolean |
否 | 是否全员禁用麦克风 |
| isAllCameraDisabled | boolean |
否 | 是否全员禁用摄像头 |
| isAllScreenShareDisabled | boolean |
否 | 是否全员禁用屏幕共享 |
| isAllMessageDisabled | boolean |
否 | 是否全员禁言 |
示例
import { useRoomState } from 'tuikit-atomicx-vue3';
const { scheduleRoom } = useRoomState();
// 调用函数
await scheduleRoom({
roomId: 'room_123456',
options: {},
roomName: '我的会议室',
password: '123456',
scheduleStartTime: 0,
scheduleEndTime: 0,
reminderSecondsBeforeStart: 0,
scheduleAttendees: [],
isAllMicrophoneDisabled: true,
isAllCameraDisabled: true,
isAllScreenShareDisabled: true,
isAllMessageDisabled: true,
});
updateScheduledRoom
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| roomId | string |
是 | 房间 ID |
示例
import { useRoomState } from 'tuikit-atomicx-vue3';
const { updateScheduledRoom } = useRoomState();
// 调用函数
await updateScheduledRoom({
roomId: 'room_123456',
options: {},
});
addScheduledAttendees
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| roomId | string |
是 | 房间 ID |
| userIdList | string[] |
否 | 要添加的用户 ID 列表 |
示例
import { useRoomState } from 'tuikit-atomicx-vue3';
const { addScheduledAttendees } = useRoomState();
// 调用函数
await addScheduledAttendees({
roomId: 'room_123456',
userIdList: ['user_001', 'user_002'],
});
removeScheduledAttendees
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| roomId | string |
是 | 房间 ID |
| userIdList | string[] |
否 | 要移除的用户 ID 列表 |
示例
import { useRoomState } from 'tuikit-atomicx-vue3';
const { removeScheduledAttendees } = useRoomState();
// 调用函数
await removeScheduledAttendees({
roomId: 'room_123456',
userIdList: ['user_001', 'user_002'],
});
cancelScheduledRoom
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| roomId | string |
是 | 房间 ID |
示例
import { useRoomState } from 'tuikit-atomicx-vue3';
const { cancelScheduledRoom } = useRoomState();
// 调用函数
await cancelScheduledRoom({
roomId: 'room_123456',
});
createAndJoinRoom
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| roomId | string |
是 | 房间 ID,需要保证唯一性 |
| roomName | string |
否 | 房间名称 |
| password | string |
否 | 房间密码 |
| isAllMicrophoneDisabled | boolean |
否 | 是否全员禁用麦克风 |
| isAllCameraDisabled | boolean |
否 | 是否全员禁用摄像头 |
| isAllScreenShareDisabled | boolean |
否 | 是否全员禁用屏幕共享 |
| isAllMessageDisabled | boolean |
否 | 是否全员禁言 |
示例
import { useRoomState } from 'tuikit-atomicx-vue3';
const { createAndJoinRoom } = useRoomState();
// 调用函数
await createAndJoinRoom({
roomId: 'room_123456',
options: {},
roomName: '我的会议室',
password: '123456',
isAllMicrophoneDisabled: true,
isAllCameraDisabled: true,
isAllScreenShareDisabled: true,
isAllMessageDisabled: true,
});
joinRoom
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| roomId | string |
是 | 房间 ID |
| password | string |
否 | 房间密码(如果房间设置了密码则必填) |
示例
import { useRoomState } from 'tuikit-atomicx-vue3';
const { joinRoom } = useRoomState();
// 调用函数
await joinRoom({
roomId: 'room_123456',
password: '123456',
});
leaveRoom
示例
import { useRoomState } from 'tuikit-atomicx-vue3';
const { leaveRoom } = useRoomState();
// 调用函数
await leaveRoom();
endRoom
示例
import { useRoomState } from 'tuikit-atomicx-vue3';
const { endRoom } = useRoomState();
// 调用函数
await endRoom();
updateRoomInfo
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| roomId | string |
是 | 房间 ID |
| roomName | string |
否 | 新的房间名称 |
| password | string |
否 | 新的房间密码 |
示例
import { useRoomState } from 'tuikit-atomicx-vue3';
const { updateRoomInfo } = useRoomState();
// 调用函数
await updateRoomInfo({
roomId: 'room_123456',
options: {},
roomName: '我的会议室',
password: '123456',
});
getRoomInfo
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| roomId | string |
是 | 房间 ID |
示例
import { useRoomState } from 'tuikit-atomicx-vue3';
const { getRoomInfo } = useRoomState();
// 调用函数
await getRoomInfo({
roomId: 'room_123456',
});
getPendingCalls
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| roomId | string |
是 | 房间 ID |
| cursor | string |
是 | 分页游标,首次请求传空字符串,后续请求传上次返回的 cursor |
示例
import { useRoomState } from 'tuikit-atomicx-vue3';
const { getPendingCalls } = useRoomState();
// 调用函数
await getPendingCalls({
roomId: 'room_123456',
cursor: '',
});
callUserToRoom
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| roomId | string |
是 | 房间 ID |
| userIdList | string[] |
否 | 要呼叫的用户 ID 列表 |
| timeout | number |
否 | 呼叫超时时间(单位秒),超时后被呼叫方会收到 onCallTimeout 事件 |
| extensionInfo | string |
否 | 扩展信息,会透传给被呼叫方 |
示例
import { useRoomState } from 'tuikit-atomicx-vue3';
const { callUserToRoom } = useRoomState();
// 调用函数
await callUserToRoom({
roomId: 'room_123456',
userIdList: ['user_001', 'user_002'],
timeout: 30,
extensionInfo: '额外信息',
});
cancelCall
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| roomId | string |
是 | 房间 ID |
| userIdList | string[] |
否 | 要取消呼叫的用户 ID 列表 |
示例
import { useRoomState } from 'tuikit-atomicx-vue3';
const { cancelCall } = useRoomState();
// 调用函数
await cancelCall({
roomId: 'room_123456',
userIdList: ['user_001', 'user_002'],
});
acceptCall
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| roomId | string |
是 | 房间 ID |
示例
import { useRoomState } from 'tuikit-atomicx-vue3';
const { acceptCall } = useRoomState();
// 调用函数
await acceptCall({
roomId: 'room_123456',
});
rejectCall
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| roomId | string |
是 | 房间 ID |
| extensionInfo | string |
否 | 扩展信息,会透传给呼叫方(如拒绝原因) |
示例
import { useRoomState } from 'tuikit-atomicx-vue3';
const { rejectCall } = useRoomState();
// 调用函数
await rejectCall({
roomId: 'room_123456',
extensionInfo: '额外信息',
});
RoomParticipantState
📦 RoomParticipantState 模块
核心功能:提供房间参与者的状态管理和操作功能,包括参与者列表管理、权限管理、设备控制等
应用场景:多人视频会议、在线教育、直播互动等需要管理房间参与者的场景
响应式数据
participantList
Ref<RoomParticipant[]>
属性
| 属性名 | 类型 | 描述 |
|---|---|---|
| userId | string |
用户ID |
| userName | string |
用户名称 |
| avatarUrl | string |
用户头像URL |
| nameCard | string |
用户名片(房间内显示名称) |
| role | RoomParticipantRole |
用户角色(Owner/Admin/GeneralUser) |
| roomStatus | RoomParticipantStatus |
用户在房间内的状态 |
| microphoneStatus | DeviceStatus |
麦克风状态 |
| cameraStatus | DeviceStatus |
摄像头状态 |
| screenShareStatus | DeviceStatus |
屏幕共享状态 |
| isMessageDisabled | boolean |
是否被禁言 |
| metaData | Record<string, string> |
用户自定义元数据 |
示例
import { useRoomParticipantState } from 'tuikit-atomicx-vue3';
const { participantList } = useRoomParticipantState();
// 监听数据变化
watch(participantList, (newValue) => {
console.log('participantList 更新:', newValue);
});
// 直接访问数据
console.log('当前 participantList:', participantList.value);
participantListCursor
Ref<string>
示例
import { useRoomParticipantState } from 'tuikit-atomicx-vue3';
const { participantListCursor } = useRoomParticipantState();
// 监听数据变化
watch(participantListCursor, (newValue) => {
console.log('participantListCursor 更新:', newValue);
});
// 直接访问数据
console.log('当前 participantListCursor:', participantListCursor.value);
participantListWithVideo
Ref<RoomParticipant[]>
示例
import { useRoomParticipantState } from 'tuikit-atomicx-vue3';
const { participantListWithVideo } = useRoomParticipantState();
// 监听数据变化
watch(participantListWithVideo, (newValue) => {
console.log('participantListWithVideo 更新:', newValue);
});
// 直接访问数据
console.log('当前 participantListWithVideo:', participantListWithVideo.value);
participantWithScreen
Ref<RoomParticipant | null>
示例
import { useRoomParticipantState } from 'tuikit-atomicx-vue3';
const { participantWithScreen } = useRoomParticipantState();
// 监听数据变化
watch(participantWithScreen, (newValue) => {
console.log('participantWithScreen 更新:', newValue);
});
// 直接访问数据
console.log('当前 participantWithScreen:', participantWithScreen.value);
localParticipant
Ref<RoomParticipant | null>
示例
import { useRoomParticipantState } from 'tuikit-atomicx-vue3';
const { localParticipant } = useRoomParticipantState();
// 监听数据变化
watch(localParticipant, (newValue) => {
console.log('localParticipant 更新:', newValue);
});
// 直接访问数据
console.log('当前 localParticipant:', localParticipant.value);
pendingDeviceApplications
Ref<DeviceRequestInfo[]>
属性
| 属性名 | 类型 | 描述 |
|---|---|---|
| timestamp | number |
申请时间戳 |
| senderUserId | string |
申请者用户ID |
| senderUserName | string |
申请者用户名 |
| senderNameCard | string |
申请者名片 |
| senderAvatarUrl | string |
申请者头像URL |
| content | string |
申请内容 |
| deviceType | DeviceType |
申请开启的设备类型 |
示例
import { useRoomParticipantState } from 'tuikit-atomicx-vue3';
const { pendingDeviceApplications } = useRoomParticipantState();
// 监听数据变化
watch(pendingDeviceApplications, (newValue) => {
console.log('pendingDeviceApplications 更新:', newValue);
});
// 直接访问数据
console.log('当前 pendingDeviceApplications:', pendingDeviceApplications.value);
pendingDeviceInvitations
Ref<DeviceRequestInfo[]>
属性
| 属性名 | 类型 | 描述 |
|---|---|---|
| timestamp | number |
邀请时间戳 |
| senderUserId | string |
邀请者用户ID |
| senderUserName | string |
邀请者用户名 |
| senderNameCard | string |
邀请者名片 |
| senderAvatarUrl | string |
邀请者头像URL |
| content | string |
邀请内容 |
| deviceType | DeviceType |
邀请开启的设备类型 |
示例
import { useRoomParticipantState } from 'tuikit-atomicx-vue3';
const { pendingDeviceInvitations } = useRoomParticipantState();
// 监听数据变化
watch(pendingDeviceInvitations, (newValue) => {
console.log('pendingDeviceInvitations 更新:', newValue);
});
// 直接访问数据
console.log('当前 pendingDeviceInvitations:', pendingDeviceInvitations.value);
speakingUsers
Ref<Map<string, number>>
示例
import { useRoomParticipantState } from 'tuikit-atomicx-vue3';
const { speakingUsers } = useRoomParticipantState();
// 监听数据变化
watch(speakingUsers, (newValue) => {
console.log('speakingUsers 更新:', newValue);
});
// 直接访问数据
console.log('当前 speakingUsers:', speakingUsers.value);
networkQualities
Ref<Map<string, NetworkInfo>>
示例
import { useRoomParticipantState } from 'tuikit-atomicx-vue3';
const { networkQualities } = useRoomParticipantState();
// 监听数据变化
watch(networkQualities, (newValue) => {
console.log('networkQualities 更新:', newValue);
});
// 直接访问数据
console.log('当前 networkQualities:', networkQualities.value);
pendingParticipantList
Ref<RoomParticipant[]>
示例
import { useRoomParticipantState } from 'tuikit-atomicx-vue3';
const { pendingParticipantList } = useRoomParticipantState();
// 监听数据变化
watch(pendingParticipantList, (newValue) => {
console.log('pendingParticipantList 更新:', newValue);
});
// 直接访问数据
console.log('当前 pendingParticipantList:', pendingParticipantList.value);
接口函数
getParticipantList
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| cursor | string |
否 | 分页游标,首次获取传空字符串或不传,后续传入上次返回的 cursor |
示例
import { useRoomParticipantState } from 'tuikit-atomicx-vue3';
const { getParticipantList } = useRoomParticipantState();
// 调用函数
await getParticipantList({
cursor: '',
});
transferOwner
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| userId | string |
是 | 目标用户ID,将成为新的房间所有者 |
示例
import { useRoomParticipantState } from 'tuikit-atomicx-vue3';
const { transferOwner } = useRoomParticipantState();
// 调用函数
await transferOwner({
userId: 'user_001',
});
setAdmin
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| userId | string |
是 | 目标用户ID |
示例
import { useRoomParticipantState } from 'tuikit-atomicx-vue3';
const { setAdmin } = useRoomParticipantState();
// 调用函数
await setAdmin({
userId: 'user_001',
});
revokeAdmin
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| userId | string |
是 | 目标用户ID |
示例
import { useRoomParticipantState } from 'tuikit-atomicx-vue3';
const { revokeAdmin } = useRoomParticipantState();
// 调用函数
await revokeAdmin({
userId: 'user_001',
});
kickParticipant
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| userId | string |
是 | 要踢出的用户ID |
示例
import { useRoomParticipantState } from 'tuikit-atomicx-vue3';
const { kickParticipant } = useRoomParticipantState();
// 调用函数
await kickParticipant({
userId: 'user_001',
});
updateParticipantNameCard
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| userId | string |
是 | 目标用户ID |
| nameCard | string |
是 | 新的名片内容 |
示例
import { useRoomParticipantState } from 'tuikit-atomicx-vue3';
const { updateParticipantNameCard } = useRoomParticipantState();
// 调用函数
await updateParticipantNameCard({
userId: 'user_001',
nameCard: '我的名片',
});
updateParticipantMetaData
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| userId | string |
是 | 目标用户ID |
| metaData | Record<string, string> |
是 | 自定义元数据键值对 |
示例
import { useRoomParticipantState } from 'tuikit-atomicx-vue3';
const { updateParticipantMetaData } = useRoomParticipantState();
// 调用函数
await updateParticipantMetaData({
userId: 'user_001',
metaData: { key: 'value' },
});
closeParticipantDevice
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| userId | string |
是 | 目标用户ID |
| deviceType | DeviceType |
是 | 要关闭的设备类型(Camera/Microphone/ScreenShare) |
示例
import { useRoomParticipantState } from 'tuikit-atomicx-vue3';
const { closeParticipantDevice } = useRoomParticipantState();
// 调用函数
await closeParticipantDevice({
userId: 'user_001',
deviceType: 'Camera',
});
muteParticipantMessage
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| userId | string |
是 | 目标用户ID |
| mute | boolean |
是 | true 表示禁言,false 表示解禁 |
示例
import { useRoomParticipantState } from 'tuikit-atomicx-vue3';
const { muteParticipantMessage } = useRoomParticipantState();
// 调用函数
await muteParticipantMessage({
userId: 'user_001',
mute: true,
});
disableAllDevices
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| deviceType | DeviceType |
是 | 要禁用的设备类型(Camera/Microphone/ScreenShare) |
| disable | boolean |
是 | true 表示禁用,false 表示启用 |
示例
import { useRoomParticipantState } from 'tuikit-atomicx-vue3';
const { disableAllDevices } = useRoomParticipantState();
// 调用函数
await disableAllDevices({
deviceType: 'Camera',
disable: true,
});
disableAllMessages
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| disable | boolean |
是 | true 表示禁用(全体禁言),false 表示启用 |
示例
import { useRoomParticipantState } from 'tuikit-atomicx-vue3';
const { disableAllMessages } = useRoomParticipantState();
// 调用函数
await disableAllMessages({
disable: true,
});
requestToOpenDevice
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| device | DeviceType |
是 | 要申请开启的设备类型(Camera/Microphone/ScreenShare) |
| timeout | number |
否 | =60] - 申请超时时间(秒),默认60秒 |
示例
import { useRoomParticipantState } from 'tuikit-atomicx-vue3';
const { requestToOpenDevice } = useRoomParticipantState();
// 调用函数
await requestToOpenDevice({
device: 'Camera',
timeout: 30,
});
cancelOpenDeviceRequest
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| device | DeviceType |
是 | 要取消申请的设备类型(Camera/Microphone/ScreenShare) |
示例
import { useRoomParticipantState } from 'tuikit-atomicx-vue3';
const { cancelOpenDeviceRequest } = useRoomParticipantState();
// 调用函数
await cancelOpenDeviceRequest({
device: 'Camera',
});
approveOpenDeviceRequest
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| device | DeviceType |
是 | 申请的设备类型(Camera/Microphone/ScreenShare) |
| userId | string |
是 | 申请者的用户ID |
示例
import { useRoomParticipantState } from 'tuikit-atomicx-vue3';
const { approveOpenDeviceRequest } = useRoomParticipantState();
// 调用函数
await approveOpenDeviceRequest({
device: 'Camera',
userId: 'user_001',
});
rejectOpenDeviceRequest
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| device | DeviceType |
是 | 申请的设备类型(Camera/Microphone/ScreenShare) |
| userId | string |
是 | 申请者的用户ID |
示例
import { useRoomParticipantState } from 'tuikit-atomicx-vue3';
const { rejectOpenDeviceRequest } = useRoomParticipantState();
// 调用函数
await rejectOpenDeviceRequest({
device: 'Camera',
userId: 'user_001',
});
inviteToOpenDevice
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| userId | string |
是 | 被邀请者的用户ID |
| device | DeviceType |
是 | 邀请开启的设备类型(Camera/Microphone/ScreenShare) |
| timeout | number |
否 | =0] - 邀请超时时间(秒),0表示不超时 |
示例
import { useRoomParticipantState } from 'tuikit-atomicx-vue3';
const { inviteToOpenDevice } = useRoomParticipantState();
// 调用函数
await inviteToOpenDevice({
userId: 'user_001',
device: 'Camera',
timeout: 30,
});
cancelOpenDeviceInvitation
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| userId | string |
是 | 被邀请者的用户ID |
| device | DeviceType |
是 | 邀请的设备类型(Camera/Microphone/ScreenShare) |
示例
import { useRoomParticipantState } from 'tuikit-atomicx-vue3';
const { cancelOpenDeviceInvitation } = useRoomParticipantState();
// 调用函数
await cancelOpenDeviceInvitation({
userId: 'user_001',
device: 'Camera',
});
acceptOpenDeviceInvitation
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| userId | string |
是 | 邀请者的用户ID |
| device | DeviceType |
是 | 邀请的设备类型(Camera/Microphone/ScreenShare) |
示例
import { useRoomParticipantState } from 'tuikit-atomicx-vue3';
const { acceptOpenDeviceInvitation } = useRoomParticipantState();
// 调用函数
await acceptOpenDeviceInvitation({
userId: 'user_001',
device: 'Camera',
});
declineOpenDeviceInvitation
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| userId | string |
是 | 邀请者的用户ID |
| device | DeviceType |
是 | 邀请的设备类型(Camera/Microphone/ScreenShare) |
示例
import { useRoomParticipantState } from 'tuikit-atomicx-vue3';
const { declineOpenDeviceInvitation } = useRoomParticipantState();
// 调用函数
await declineOpenDeviceInvitation({
userId: 'user_001',
device: 'Camera',
});
FreeBeautyState
📦 FreeBeautyState 模块
核心功能:提供免费美颜功能的状态管理,包括磨皮、美白、红润等美颜参数的设置
应用场景:视频通话、直播等需要美颜功能的场景
响应式数据
beautyConfig
Ref<FreeBeautyConfig>
属性
| 属性名 | 类型 | 描述 |
|---|---|---|
| beautyLevel | number |
磨皮级别,取值范围 0-100 |
| whitenessLevel | number |
美白级别,取值范围 0-100 |
| ruddinessLevel | number |
红润级别,取值范围 0-100 |
示例
import { useFreeBeautyState } from 'tuikit-atomicx-vue3';
const { beautyConfig } = useFreeBeautyState();
// 监听数据变化
watch(beautyConfig, (newValue) => {
console.log('beautyConfig 更新:', newValue);
});
// 直接访问数据
console.log('当前 beautyConfig:', beautyConfig.value);
接口函数
setFreeBeauty
参数
| 参数名 | 类型 | 必填 | 描述 |
|---|---|---|---|
| beautyLevel | number |
是 | 磨皮级别,取值范围 0-100 |
| whitenessLevel | number |
是 | 美白级别,取值范围 0-100 |
| ruddinessLevel | number |
是 | 红润级别,取值范围 0-100 |
示例
import { useFreeBeautyState } from 'tuikit-atomicx-vue3';
const { setFreeBeauty } = useFreeBeautyState();
// 调用函数
await setFreeBeauty({
beautyLevel: 50,
whitenessLevel: 30,
ruddinessLevel: 20,
});
saveBeautySetting
示例
import { useFreeBeautyState } from 'tuikit-atomicx-vue3';
const { saveBeautySetting } = useFreeBeautyState();
// 调用函数
await saveBeautySetting();
Interface
📋 接口类型定义
核心功能:本模块包含所有的接口类型定义,为 SDK 的各种数据结构提供类型说明。
技术特点:提供完整的 TypeScript 类型定义,确保开发时的类型安全和代码提示。
业务价值:帮助开发者理解各种数据结构的字段含义和类型,提高开发效率和代码质量。
类型定义
LoginUserInfo
属性列表
| 属性名 | 类型 | 描述 |
|---|---|---|
| userId | string | 登录用户的 userId |
| userName | string | 登录用户的 userName |
| avatarUrl | string | 登录用户的头像 URL |
| customInfo | Record<string, any> | 自定义资料信息对象 |
SetSelfInfoParams
属性列表
| 属性名 | 类型 | 描述 |
|---|---|---|
| userName | string | 用户昵称 |
| avatarUrl | string | 用户头像 URL |
| customInfo | Record<string, any> | 可选,自定义信息 |
LoginParams
属性列表
| 属性名 | 类型 | 描述 |
|---|---|---|
| userId | string | 用户ID |
| userSig | string | 用户签名 |
| sdkAppId | number | SDK 应用 ID |
TUIRoomInfo
属性列表
| 属性名 | 类型 | 描述 |
|---|---|---|
| roomId | string | 房间 ID |
| roomName | string | 房间名称,默认为 roomId |
| roomType | TUIRoomType | 房间类型,默认为 TUIRoomType.kConference |
| isSeatEnabled | boolean | 是否开启麦位控制,该属性 2.0.0 版本以后支持,默认为 false |
| seatMode | TUISeatMode | 上麦模式(开启麦位控制后生效),该属性 2.0.0 版本以后支持,默认为 TUISeatMode.kFreeToTake |
| password | string | 房间密码,默认为空字符串,该属性 2.5.0 版本以后支持 |
| isMicrophoneDisableForAllUser | boolean | 是否开启全员禁音(创建房间可选参数,默认值为 false) |
| isScreenShareDisableForAllUser | boolean | 是否开启禁止屏幕分享(创建房间可选参数,该属性自 v2.2.0 版本以后支持,默认值为 false) |
| isCameraDisableForAllUser | boolean | 是否开启全员禁画(创建房间可选参数, 默认值为 false) |
| isMessageDisableForAllUser | boolean | 是否允许所有用户发消息(创建房间可选参数,默认值为 false) |
| maxSeatCount | number | 最大麦位数量,默认为 6 |
| roomOwner | string | 房间主持人ID,只读,v2.4.1 以上建议使用 ownerId |
| ownerId | string | 房间主持人ID,只读,该属性 2.4.1 版本以后支持 |
| ownerName | string | 房间主持人昵称,只读,该属性 2.4.1 版本以后支持 |
| ownerAvatarUrl | string | 房间主持人头像地址,只读,该属性 2.4.1 版本以后支持 |
| createTime | number | 房间创建时间,只读,精确到秒 |
| roomMemberCount | number | 房间成员数量,只读 |
TUIEnterRoomOptions
属性列表
| 属性名 | 类型 | 描述 |
|---|---|---|
| password | string | 房间密码,默认为空,表示没有密码 |
TUISeatLockParams
属性列表
| 属性名 | 类型 | 描述 |
|---|---|---|
| lockSeat | boolean | 锁定麦位 |
| lockVideo | boolean | 锁定麦位视频 |
| lockAudio | boolean | 锁定麦位音频 |
TUIMessage
属性列表
| 属性名 | 类型 | 描述 |
|---|---|---|
| messageId | string | 消息 Id |
| message | string | 消息内容 |
| timestamp | number | 时间戳信息, 精确到秒 |
| userId | string | 用户 Id |
| userName | string | 用户名称 |
| avatarUrl | string | 用户头像地址 |
TUINetwork
属性列表
| 属性名 | 类型 | 描述 |
|---|---|---|
| userId | string | 用户 Id |
| quality | TUINetworkQuality | 网络质量 |
| upLoss | number | 上行丢包率,单位 (%) 该数值越小越好,目前仅本地用户有该信息 |
| downLoss | number | 下行丢包率,单位 (%) 该数值越小越好,目前仅本地用户有该信息 |
| delay | number | 网络延迟,单位 ms,目前仅本地用户有该信息 |
TUIVideoEncoderParams
属性列表
| 属性名 | 类型 | 描述 |
|---|---|---|
| fps | number | 帧率设置 |
| bitrate | number | 目标编码码率设置 |
| quality | TUIVideoQuality | 上行视频分辨率 |
| videoResolution | TUIVideoQuality | 上行视频分辨率(自 v1.6.0 版本开始支持,v1.6.0 之前版本请使用 quality 参数) |
| resolutionMode | TUIResolutionMode | 横竖屏模式 |
TUIUserInfo
属性列表
| 属性名 | 类型 | 描述 |
|---|---|---|
| userId | string | 用户 Id |
| userName | string | 用户名称 |
| nameCard | string | 房间内用户名称,自 v2.5.0 支持 |
| avatarUrl | string | 用户头像地址 |
| userRole | TUIRole | 用户角色 |
| hasAudioStream | boolean | 是否有音频流 |
| hasVideoStream | boolean | 是否有视频流 |
| hasScreenStream | boolean | 是否有屏幕分享流 |
| isMessageDisabled | boolean | 是否被禁止发送消息 |
| roomCustomInfo | object | 用户房间自定义字段 |
TUISeatInfo
属性列表
| 属性名 | 类型 | 描述 |
|---|---|---|
| index | number | 麦位序号 |
| userId | string | 麦位对应的用户 Id |
| userName | string | 用户名称 |
| nameCard | string | 房间内用户名称,自 v2.5.0 支持 |
| avatarUrl | string | 用户头像地址 |
| isLocked | boolean | 当前麦位是否被锁 |
| isVideoLocked | boolean | 当前麦位是否禁止视频 |
| isAudioLocked | boolean | 当前麦位是否禁止音频 |
SeatInfo
属性列表
| 属性名 | 类型 | 描述 |
|---|---|---|
| index | number | 座位索引 |
| isLocked | boolean | 座位是否被锁定 |
| isVideoLocked | boolean | 座位视频是否被锁定 |
| isAudioLocked | boolean | 座位音频是否被锁定 |
| userInfo | SeatUserInfo | undefined | 座位上的用户信息,座位为空时为 undefined |
SeatUserInfo
属性列表
| 属性名 | 类型 | 描述 |
|---|---|---|
| roomId | string | 房间 ID |
| userId | string | 用户 ID |
| userName | string | 用户名称 |
| avatarUrl | string | 用户头像 URL |
| microphoneStatus | DeviceStatus | 麦克风状态 |
| cameraStatus | DeviceStatus | 摄像头状态 |
| onSeatTimestamp | number | 上座时间戳 |
| networkQuality | NetworkQuality | undefined | 网络质量 |
| customInfo | Record<string, any> | 自定义信息 |
TUIRequest
属性列表
| 属性名 | 类型 | 描述 |
|---|---|---|
| requestAction | TUIRequestAction | 请求类型 |
| timestamp | number | 请求发起时间 |
| requestId | string | 请求 ID |
| userId | string | 发起请求的用户 ID |
| userName | string | 用户名称 |
| nameCard | string | 房间内用户名称,自 v2.5.0 支持 |
| avatarUrl | string | 用户头像地址 |
| content | string | 其他内容 |
TUIRequestCallback
属性列表
| 属性名 | 类型 | 描述 |
|---|---|---|
| requestCallbackType | TUIRequestCallbackType | 请求回调类型 |
| requestId | string | 请求 ID |
| userId | string | 用户 Id |
| code | number | 请求响应码 |
| message | string | 请求补充说明 |
TUIDeviceInfo
属性列表
| 属性名 | 类型 | 描述 |
|---|---|---|
| deviceId | string | 设备 Id |
| deviceName | string | 设备名称 |
| deviceProperties | Record<string, any> | 设备属性对象 |
NetworkInfo
属性列表
| 属性名 | 类型 | 描述 |
|---|---|---|
| quality | NetworkQuality | 网络质量等级 |
| upLoss | number | 上行丢包率,单位 (%) |
| downLoss | number | 下行丢包率,单位 (%) |
| delay | number | 网络延迟,单位 ms |
TUIConferenceInfo
属性列表
| 属性名 | 类型 | 描述 |
|---|---|---|
| scheduleStartTime | number | 预定会议开始时间。 |
| scheduleEndTime | number | 预定会议结束时间。 |
| scheduleAttendees | string[] | 邀请参会成员列表。 |
| reminderSecondsBeforeStart | number | 会议开始前提醒时间(秒)。 |
| status | TUIConferenceStatus | 房间状态(只读)。 |
| basicRoomInfo | TUIRoomInfo | 房间信息。 |
TUIConferenceModifyInfo
属性列表
| 属性名 | 类型 | 描述 |
|---|---|---|
| scheduleStartTime | number | 预定会议开始时间 |
| scheduleEndTime | number | 预定会议结束时间 |
| basicRoomInfo | object | 房间基本信息 |
| basicRoomInfo.roomId | string | 房间 ID |
| basicRoomInfo.roomName | string | 房间名称 |
TUIInvitation
属性列表
| 属性名 | 类型 | 描述 |
|---|---|---|
| status | TUIInvitationStatus | 会中邀请状态 |
| invitee | TUIUserInfo | 受邀者 |
| inviter | TUIUserInfo | 邀请者 |
TUILiveInfo
属性列表
| 属性名 | 类型 | 描述 |
|---|---|---|
| basicRoomInfo | TUIRoomInfo | 房间信息,只读 |
| isGiftEnabled | boolean | 直播间是否支持礼物 |
| isLikeEnabled | boolean | 直播间是否支持点赞 |
| isPublicVisible | boolean | 直播间是否公开 |
| activityStatus | number | 直播间活跃状态: 用户自定义标记 |
| viewCount | number | 累计观看次数,只读 |
| coverUrl | string | 直播间封面图片 HTTP URL 地址,最大支持 200 个字节 |
| backgroundUrl | string | 直播间背景图片 HTTP URL 地址,最大支持 200 个字节 |
| categoryList | Array<number> | 直播间分类标签,单个房间最大支持3个标记 |
TUILiveModifyInfo
属性列表
| 属性名 | 类型 | 描述 |
|---|---|---|
| roomId | string | 直播间 ID |
| isPublicVisible | boolean | 可选,直播间是否公开 |
| activityStatus | number | 可选,直播间活跃状态: 用户自定义标记 |
| coverUrl | string | 可选,直播间封面图片 HTTP URL 地址,最大支持 200 个字节 |
| backgroundUrl | string | 可选,直播间背景图片 HTTP URL 地址,最大支持 200 个字节 |
| categoryList | Array<number> | 可选,直播间分类标签,单个房间最大支持3个标记 |
TUILiveModifyFlag
属性列表
| 属性名 | 类型 | 描述 |
|---|---|---|
| kNone | number | 不修改 |
| kActivityStatus | number | 直播间活跃状态,支持自定义设置 |
| kCoverUrl | number | 直播间封面 |
| kCategory | number | 直播间分类 |
| kEnableGift | number | 直播间支持发送礼物标记 |
| kEnableLike | number | 直播支持点赞标记 |
| kPublic | number | 直播间公开标记 |
| kBackgroundUrl | number | 直播间背景 |
AudienceInfo
属性列表
| 属性名 | 类型 | 描述 |
|---|---|---|
| userId | string | 用户 ID |
| userName | string | 用户名称 |
| avatarUrl | string | 用户头像 URL |
| customInfo | Record<string, any> | 自定义信息 |
| userRole | TUIRole | 用户角色 |
| isMessageDisabled | boolean | 是否禁止发送消息 |
LiveUserInfo
属性列表
| 属性名 | 类型 | 描述 |
|---|---|---|
| userId | string | 用户 ID |
| userName | string | 用户名称 |
| avatarUrl | string | 用户头像 URL |
SearchResult
属性列表
| 属性名 | 类型 | 描述 |
|---|---|---|
| resultList | Array<T> | 搜索结果列表 |
| hasMore | boolean | 是否有更多结果 |
| cursor | string | 分页游标 |
| totalCount | number | 总结果数量 |
| params | Record<string, any> | 搜索参数 |