【m】界面分为3个页面
This commit is contained in:
@@ -6,6 +6,7 @@ import { mockCallSession, mockMessages } from './models.js';
|
||||
import { Signaling, WebSocketSignaling } from "../../module/signaling.js";// 信令管理
|
||||
import { RenderStreaming } from "../../module/renderstreaming.js"; // WebRTC连接管理
|
||||
import { getServerConfig, getRTCConfiguration } from "../js/config.js";//服务器配置和RTC配置
|
||||
import { showNotification } from './utils.js'; // 导入通知函数
|
||||
// 默认视频流尺寸
|
||||
const defaultStreamWidth = 1280;
|
||||
const defaultStreamHeight = 720;
|
||||
@@ -19,7 +20,10 @@ class CallStateManager {
|
||||
let connectionId; // 连接ID
|
||||
// 核心状态
|
||||
this.state = {
|
||||
session: { ...mockCallSession },
|
||||
session: {
|
||||
...mockCallSession,
|
||||
status: 'idle' // 初始状态为空闲
|
||||
},
|
||||
messages: [...mockMessages],
|
||||
isSidebarOpen: false,
|
||||
unreadCount: 0,
|
||||
@@ -305,6 +309,29 @@ class CallStateManager {
|
||||
// [WEBSOCKET_EMIT: leave-call]
|
||||
}
|
||||
|
||||
// 加入通话
|
||||
joinCall(connectionId) {
|
||||
this.state.session.status = 'connecting';
|
||||
this.notify({ type: 'CALL_STATUS_CHANGE', status: 'connecting' });
|
||||
showNotification(`正在加入通话 (${connectionId})`);
|
||||
|
||||
// 初始化
|
||||
this.init();
|
||||
|
||||
// 保存连接ID
|
||||
this.connectionId = connectionId;
|
||||
}
|
||||
|
||||
// 创建通话
|
||||
createCall() {
|
||||
this.state.session.status = 'connecting';
|
||||
this.notify({ type: 'CALL_STATUS_CHANGE', status: 'connecting' });
|
||||
showNotification('正在创建通话...');
|
||||
|
||||
// 初始化
|
||||
this.init();
|
||||
}
|
||||
|
||||
// 模拟远端活动 (开发测试用)
|
||||
simulateRemoteActivity() {
|
||||
setInterval(() => {
|
||||
@@ -342,6 +369,7 @@ class CallStateManager {
|
||||
getLocalUser() { return this.state.session.localUser; }
|
||||
getRemoteUser() { return this.state.session.remoteUser; }
|
||||
getMessages() { return this.state.messages; }
|
||||
getConnectionId() { return this.connectionId; }
|
||||
}
|
||||
|
||||
// 创建单例实例
|
||||
@@ -354,4 +382,3 @@ window.addEventListener('beforeunload', async () => {
|
||||
await store.renderstreaming.stop(); // 停止WebRTC连接
|
||||
}, true);
|
||||
export default store;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user