feat(CallScreen, FloatingCallWindow, callStore, wsService): enhance call status handling and UI updates
- Updated call status messages to include 'calling', 'reconnecting', and 'failed' states for better user feedback. - Improved video handling logic in CallScreen to use currentCall.isVideoEnabled for local video display. - Enhanced callStore to manage new call statuses and ensure proper timeout handling during 'calling' state. - Added a method in wsService to retrieve the active call state after WebSocket reconnections. - Refactored FloatingCallWindow to reflect updated call status messages for consistency across components.
This commit is contained in:
@@ -617,6 +617,10 @@ class WebSocketService {
|
||||
|
||||
// Call signaling handlers
|
||||
private handleCallIncoming(payload: any): void {
|
||||
console.log('[WSService] call_incoming payload:', JSON.stringify({
|
||||
call_type: payload.call_type,
|
||||
media_type: payload.media_type,
|
||||
}));
|
||||
const m: WSCallIncomingMessage = {
|
||||
type: 'call_incoming',
|
||||
call_id: payload.call_id,
|
||||
@@ -727,6 +731,21 @@ class WebSocketService {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询当前活跃的通话
|
||||
* 用于 WebSocket 重连后恢复通话状态
|
||||
*/
|
||||
async getActiveCall(): Promise<any | null> {
|
||||
try {
|
||||
const { api } = await import('./api');
|
||||
const response = await api.get('/calls/active');
|
||||
return response.data || null;
|
||||
} catch (error) {
|
||||
console.log('[WSService] No active call found');
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
sendCallAnswer(callId: string): void {
|
||||
this.sendFireAndForget('call_answer', { call_id: callId });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user