双端适配,web端的修改父容器和接口

This commit is contained in:
2026-03-29 02:34:13 +08:00
parent 3c071957ce
commit ebb0c003e3
16 changed files with 1419 additions and 226 deletions

View File

@@ -332,8 +332,22 @@ class MessageService {
page: data.page || 1,
page_size: data.page_size || 20,
};
} catch (error) {
console.error('获取消息列表失败:', error);
} catch (error: any) {
// 检查是否是权限错误或会话不存在错误 - 这是正常情况,不需要打印错误日志
const errorMessage = error?.message || String(error);
if (
errorMessage.includes('not found') ||
errorMessage.includes('no permission') ||
error?.code === 'NOT_FOUND' ||
error?.code === 'FORBIDDEN'
) {
// 会话不存在或无权限访问,返回空消息列表
// 这可能是因为会话已被删除、用户被踢出群聊等情况
console.warn('[MessageService] 会话不存在或无权限访问:', conversationId);
} else {
// 其他错误才打印错误日志
console.error('[MessageService] 获取消息列表失败:', error);
}
return {
messages: [],
total: 0,

View File

@@ -0,0 +1,89 @@
// WebRTCManager for Web platform (stub implementation)
import type {
ICEServer,
ConnectionState,
WebRTCManagerEvent,
} from './WebRTCManager';
type EventHandler = (event: WebRTCManagerEvent) => void;
class WebRTCManagerWeb {
private eventHandlers: Set<EventHandler> = new Set();
private disposed = false;
async initialize(iceServers: ICEServer[] = []): Promise<void> {
console.log('[WebRTC] WebRTC not supported on web platform');
}
async createLocalStream(voiceOnly = true): Promise<MediaStream | null> {
console.warn('[WebRTC] WebRTC not supported on web platform');
return null;
}
async startCall(isInitiator: boolean): Promise<RTCSessionDescriptionInit | null> {
console.warn('[WebRTC] WebRTC not supported on web platform');
return null;
}
async createOffer(): Promise<RTCSessionDescriptionInit | null> {
console.warn('[WebRTC] WebRTC not supported on web platform');
return null;
}
async createAnswer(): Promise<RTCSessionDescriptionInit | null> {
console.warn('[WebRTC] WebRTC not supported on web platform');
return null;
}
async createAnswerFromOffer(offer: RTCSessionDescriptionInit): Promise<RTCSessionDescriptionInit | null> {
console.warn('[WebRTC] WebRTC not supported on web platform');
return null;
}
async setRemoteDescription(description: RTCSessionDescriptionInit): Promise<void> {
console.warn('[WebRTC] WebRTC not supported on web platform');
}
async addIceCandidate(candidate: RTCIceCandidateInit): Promise<void> {
console.warn('[WebRTC] WebRTC not supported on web platform');
}
setMuted(muted: boolean): void {
console.warn('[WebRTC] WebRTC not supported on web platform');
}
isMuted(): boolean {
console.warn('[WebRTC] WebRTC not supported on web platform');
return false;
}
getRemoteStream(): MediaStream | null {
console.warn('[WebRTC] WebRTC not supported on web platform');
return null;
}
getLocalStream(): MediaStream | null {
console.warn('[WebRTC] WebRTC not supported on web platform');
return null;
}
getPeerConnection(): RTCPeerConnection | null {
console.warn('[WebRTC] WebRTC not supported on web platform');
return null;
}
onEvent(handler: EventHandler): () => void {
console.warn('[WebRTC] WebRTC not supported on web platform');
return () => {
this.eventHandlers.delete(handler);
};
}
dispose(): void {
this.disposed = true;
this.eventHandlers.clear();
console.log('[WebRTC] WebRTC disposed on web platform');
}
}
export const webrtcManager = new WebRTCManagerWeb();