/** * 类型定义和数据模型 */ /** * @typedef {Object} CallSession * @property {string} id - 通话唯一标识 (UUID) * @property {'video'|'audio'} type - 通话类型 * @property {'connecting'|'ongoing'|'ended'|'failed'} status - 通话状态 * @property {string} startTime - ISO 8601 时间戳 * @property {number} duration - 已进行秒数 * @property {boolean} isEncrypted - 是否启用端到端加密 * @property {LocalUser} localUser - 本地用户信息 * @property {RemoteUser} remoteUser - 远端用户信息 */ /** * @typedef {Object} LocalUser * @property {string} id - 用户ID * @property {string} name - 显示名称 * @property {string} avatar - 头像URL * @property {boolean} isHost - 是否主持人 * @property {MediaState} mediaState - 媒体状态 */ /** * @typedef {Object} RemoteUser * @property {string} id - 用户ID * @property {string} name - 显示名称 * @property {string} avatar - 头像URL * @property {'online'|'offline'|'connecting'} status - 在线状态 * @property {MediaState} mediaState - 媒体状态 * @property {'excellent'|'good'|'fair'|'poor'} networkQuality - 网络质量 */ /** * @typedef {Object} MediaState * @property {boolean} audio - 音频是否开启 * @property {boolean} video - 视频是否开启 * @property {boolean} screenShare - 是否屏幕共享 * @property {boolean} recording - 是否正在录屏 * @property {boolean} isSpeaking - 是否正在说话(VAD) */ /** * @typedef {Object} ChatMessage * @property {string} id - 消息唯一ID * @property {string} senderId - 发送者ID * @property {string} senderName - 发送者名称 * @property {string} senderAvatar - 发送者头像URL * @property {string} content - 消息内容 * @property {'text'|'file'|'system'} type - 消息类型 * @property {string} timestamp - ISO 8601 时间戳 * @property {boolean} isSelf - 是否为自己发送 */ // 模拟通话会话数据 const mockCallSession = { id: "call-8842-2024-001", type: "video", status: "ongoing", // connecting | ongoing | ended | failed startTime: "2024-01-15T14:30:00.000Z", duration: 0, // 秒数,后端可不返回,前端本地计算 isEncrypted: true, // 本地用户信息 localUser: { id: "user-local-001", name: "我", avatar: "/images/p1.png", isHost: true, mediaState: { audio: true, video: true, screenShare: false, recording: false, isSpeaking: false } }, // 远端用户信息 remoteUser: { id: "user-remote-002", name: "Unity", avatar: "/images/p2.png", status: "offline", // online | offline | connecting networkQuality: "no_signal", // excellent | good | fair | poor | no_signal mediaState: { audio: true, video: true, screenShare: false, recording: false, isSpeaking: false } } }; // 模拟聊天消息数据 const mockMessages = [ { id: "msg-001", senderId: "system", senderName: "系统", senderAvatar: "/images/screenshot.png", content: "通话已建立连接", type: "system", timestamp: "2024-01-15T14:30:00.000Z", isSelf: false } ]; export { mockCallSession, mockMessages };