与会议相关的所有元数据都存储在 meeting.meta 中。这包括关于会议状态、类型和连接的重要信息。
根据您要构建的平台选择一个框架。
meeting.meta 对象包含以下属性:
viewType- 指示会议的类型。可能的值为WEBINAR、GROUP_CALLroomType- 指示会议是组通话(group-call)还是网络研讨会(webinar)meetingTitle- 会议的主题meetingStartedTimestamp- 会议开始的时间戳mediaState- 媒体连接状态socketState- Socket 连接状态
meeting.meta 对象包含以下属性:
viewType- 指示会议的类型。可能的值为WEBINAR、GROUP_CALLroomType- 指示会议是组通话(group-call)还是网络研讨会(webinar)meetingTitle- 会议的主题meetingStartedTimestamp- 会议开始的时间戳mediaState- 媒体连接状态socketState- Socket 连接状态
meeting.meta 对象包含以下属性:
meetingId- 会议的唯一标识符meetingTitle- 会议的主题meetingStartedTimestamp- 会议开始的时间戳meetingType- 指示会议类型,可以是RtkMeetingType枚举中的GROUP_CALL、WEBINAR、AUDIO_ROOM或LIVESTREAM之一meetingConfig- 包含音频和视频设置的会议配置meetingState-RtkMeetingState类型的会议状态authToken- 用户加入会议的身份验证令牌selfActiveTab- 有关本地参与者当前活动标签页的信息mediaConnectionState- 媒体连接的当前状态socketConnectionState- Socket 连接的当前状态
meeting.meta 对象包含以下属性:
meetingId- 会议的唯一标识符meetingTitle- 会议的主题meetingStartedTimestamp- 会议开始的时间戳meetingType- 指示会议类型,可以是RtkMeetingType枚举中的.groupCall、.webinar、.audioRoom或.livestream之一meetingConfig- 包含音频和视频设置的会议配置meetingState-RtkMeetingState类型的会议状态authToken- 用户加入会议的身份验证令牌selfActiveTab- 有关本地参与者当前活动标签页的信息mediaConnectionState- 媒体连接的当前状态socketConnectionState- Socket 连接的当前状态
meeting.meta 对象包含以下属性:
meetingId- 会议的唯一标识符meetingTitle- 会议的主题meetingStartedTimestamp- 会议开始的时间戳meetingType- 指示会议类型,可以是RtkMeetingType枚举中的groupCall、webinar或livestream之一activeTab- 有关本地参与者当前活动标签页的信息
meeting.meta 对象包含以下属性:
viewType- 指示会议的类型。可能的值为WEBINAR、GROUP_CALLroomType- 指示会议是组通话(group-call)还是网络研讨会(webinar)meetingTitle- 会议的主题meetingStartedTimestamp- 会议开始的时间戳mediaState- 媒体连接状态socketState- Socket 连接状态
要访问会议元数据,请使用 meeting.meta 对象。
// 解构元数据以获取 meetingTitle
const { meetingTitle } = meeting.meta;
if (meeting.self.roomJoined) {
console.log(
`The local user has joined a meeting with title ${meetingTitle}.`,
);
}import { useRealtimeKitSelector } from "@cloudflare/realtimekit-react";
import { useEffect } from "react";
function MeetingInfo() {
const [meetingTitle, roomJoined] = useRealtimeKitSelector((m) => [
m.meta.meetingTitle,
m.self.roomJoined,
]);
useEffect(() => {
if (roomJoined) {
console.log(
`The local user has joined a meeting with title ${meetingTitle}.`,
);
}
}, [roomJoined, meetingTitle]);
return null;
}val meetingTitle = meeting.meta.meetingTitlelet meetingTitle = meeting.meta.meetingTitlefinal meetingTitle = meeting.meta.meetingTitle;
print("The local user has joined ${meetingTitle}.");import { useRealtimeKitSelector } from "@cloudflare/realtimekit-react-native";
import { useEffect } from "react";
const [meetingTitle, roomJoined] = useRealtimeKitSelector((m) => [
m.meta.meetingTitle,
m.self.roomJoined,
]);
useEffect(() => {
if (roomJoined) {
console.log(
`The local user has joined a meeting with title ${meetingTitle}.`,
);
}
}, [roomJoined, meetingTitle]);meta 对象还会触发事件以指示会议连接状态的变化。
对媒体连接(用于传输实际媒体的 WebRTC 连接)的更新通过 mediaConnectionUpdate 事件发送。
meeting.meta.on("mediaConnectionUpdate", ({ transport, state }) => {
// transport - 'consuming' | 'producing'
// state - 'new' | 'connecting' | 'connected' | 'disconnected' | 'reconnecting' | 'failed'
console.log(`Media connection ${transport} is now ${state}`);
});mediaConnectionUpdate 事件提供:
transport-'consuming'(接收媒体)或'producing'(发送媒体)state- 连接状态:'new'、'connecting'、'connected'、'disconnected'、'reconnecting'或'failed'
对媒体连接(用于传输实际媒体的 WebRTC 连接)的更新通过 mediaConnectionUpdate 事件发送。
import { useRealtimeKitClient } from "@cloudflare/realtimekit-react";
import { useEffect } from "react";
function MediaConnectionMonitor() {
const [meeting] = useRealtimeKitClient();
useEffect(() => {
if (meeting) {
const handleMediaConnection = ({ transport, state }) => {
// transport - 'consuming' | 'producing'
// state - 'new' | 'connecting' | 'connected' | 'disconnected' | 'reconnecting' | 'failed'
console.log(`Media connection ${transport} is now ${state}`);
};
meeting.meta.on("mediaConnectionUpdate", handleMediaConnection);
return () => {
meeting.meta.off("mediaConnectionUpdate", handleMediaConnection);
};
}
}, [meeting]);
return null;
}mediaConnectionUpdate 事件提供:
transport-'consuming'(接收媒体)或'producing'(发送媒体)state- 连接状态:'new'、'connecting'、'connected'、'disconnected'、'reconnecting'或'failed'
您可以直接从元数据访问当前媒体连接状态。
val mediaConnectionState = meeting.meta.mediaConnectionState您可以直接从元数据访问当前媒体连接状态。
let mediaConnectionState = meeting.meta.mediaConnectionStateFlutter 中不可用媒体连接事件。请通过会议状态更改来监控连接状态。
对媒体连接(用于传输实际媒体的 WebRTC 连接)的更新通过 mediaConnectionUpdate 事件发送。
meeting.meta.on("mediaConnectionUpdate", ({ transport, state }) => {
// transport - 'consuming' | 'producing'
// state - 'new' | 'connecting' | 'connected' | 'disconnected' | 'reconnecting' | 'failed'
console.log(`Media connection ${transport} is now ${state}`);
});mediaConnectionUpdate 事件提供:
transport-'consuming'(接收媒体)或'producing'(发送媒体)state- 连接状态:'new'、'connecting'、'connected'、'disconnected'、'reconnecting'或'failed'
对 WebSocket 连接(用于聊天、投票和其他基本信令)的更新通过 socketConnectionUpdate 事件发送。
meeting.meta.on(
"socketConnectionUpdate",
({ state, reconnectionAttempt, reconnected }) => {
// state - 'connected' | 'disconnected' | 'reconnecting' | 'failed'
console.log(`Socket connection is now ${state}`);
if (reconnectionAttempt) {
console.log(`Reconnection attempt: ${reconnectionAttempt}`);
}
if (reconnected) {
console.log("Successfully reconnected");
}
},
);socketConnectionUpdate 事件提供:
state- 连接状态:'connected'、'disconnected'、'reconnecting'或'failed'reconnectionAttempt- 进行的重新连接尝试次数(如果正在重新连接)reconnected- 指示是否成功重新建立连接的布尔值
对 WebSocket 连接(用于聊天、投票和其他基本信令)的更新通过 socketConnectionUpdate 事件发送。
import { useRealtimeKitClient } from "@cloudflare/realtimekit-react";
import { useEffect } from "react";
function SocketConnectionMonitor() {
const [meeting] = useRealtimeKitClient();
useEffect(() => {
if (meeting) {
const handleSocketConnection = ({
state,
reconnectionAttempt,
reconnected,
}) => {
// state - 'connected' | 'disconnected' | 'reconnecting' | 'failed'
console.log(`Socket connection is now ${state}`);
if (reconnectionAttempt) {
console.log(`Reconnection attempt: ${reconnectionAttempt}`);
}
if (reconnected) {
console.log("Successfully reconnected");
}
};
meeting.meta.on("socketConnectionUpdate", handleSocketConnection);
return () => {
meeting.meta.off("socketConnectionUpdate", handleSocketConnection);
};
}
}, [meeting]);
return null;
}socketConnectionUpdate 事件提供:
state- 连接状态:'connected'、'disconnected'、'reconnecting'或'failed'reconnectionAttempt- 进行的重新连接尝试次数(如果正在重新连接)reconnected- 指示是否成功重新建立连接的布尔值
您可以直接从元数据访问当前的 socket 连接状态。
val socketConnectionState = meeting.meta.socketConnectionState您可以直接从元数据访问当前的 socket 连接状态。
let socketConnectionState = meeting.meta.socketConnectionStateSocket 连接事件在 Flutter 中不可用。请通过会议状态更改来监控连接状态。
对 WebSocket 连接(用于聊天、投票和其他基本信令)的更新通过 socketConnectionUpdate 事件发送。
meeting.meta.on(
"socketConnectionUpdate",
({ state, reconnectionAttempt, reconnected }) => {
// state - 'connected' | 'disconnected' | 'reconnecting' | 'failed'
console.log(`Socket connection is now ${state}`);
if (reconnectionAttempt) {
console.log(`Reconnection attempt: ${reconnectionAttempt}`);
}
if (reconnected) {
console.log("Successfully reconnected");
}
},
);socketConnectionUpdate 事件提供:
state- 连接状态:'connected'、'disconnected'、'reconnecting'或'failed'reconnectionAttempt- 进行的重新连接尝试次数(如果正在重新连接)reconnected- 指示是否成功重新建立连接的布尔值
探索相关主题: