debugging eingebaut, deploy gefixt
All checks were successful
Deploy SingleChat / deploy (push) Successful in 25s

This commit is contained in:
Torsten Schulz (local)
2026-06-17 16:37:40 +02:00
parent c46e64367d
commit 0d24fcd9e5
7 changed files with 187 additions and 26 deletions

View File

@@ -8,6 +8,7 @@ const MAX_VIDEO_CONNECTIONS_DEFAULT = 3;
const VIDEO_TERMINAL_STATUSES = new Set(['rejected', 'cancelled', 'ended', 'failed']);
const VIDEO_LIVE_STATUSES = new Set(['ringing', 'connecting', 'active']);
const WEBRTC_CONNECTION_STATES = new Set(['new', 'connecting', 'connected', 'disconnected', 'failed', 'closed']);
const VIDEO_CONNECT_TIMEOUT_MS = 20000;
const VIDEO_STATUS_ORDER = {
ringing: 1,
connecting: 2,
@@ -221,6 +222,9 @@ export const useChatStore = defineStore('chat', () => {
}
try {
if (runtime.connectTimeoutId) {
window.clearTimeout(runtime.connectTimeoutId);
}
runtime.pc.ontrack = null;
runtime.pc.onicecandidate = null;
runtime.pc.onconnectionstatechange = null;
@@ -361,7 +365,8 @@ export const useChatStore = defineStore('chat', () => {
pc,
localStream,
pendingCandidates: [],
offerCreated: false
offerCreated: false,
connectTimeoutId: null
};
for (const track of localStream.getTracks()) {
@@ -391,6 +396,10 @@ export const useChatStore = defineStore('chat', () => {
pc.onconnectionstatechange = () => {
const state = pc.connectionState;
if (state === 'connected' && runtime.connectTimeoutId) {
window.clearTimeout(runtime.connectTimeoutId);
runtime.connectTimeoutId = null;
}
if (WEBRTC_CONNECTION_STATES.has(state)) {
emitConnectionState(session.callId, state);
}
@@ -442,7 +451,17 @@ export const useChatStore = defineStore('chat', () => {
async function startVideoMediaForSession(session) {
if (!session?.media) return;
try {
await ensurePeerConnectionForSession(session);
const runtime = await ensurePeerConnectionForSession(session);
if (runtime && !runtime.connectTimeoutId) {
runtime.connectTimeoutId = window.setTimeout(() => {
const activeRuntime = peerConnections.get(session.callId);
const state = activeRuntime?.pc?.connectionState || 'new';
if (state !== 'connected') {
setTemporaryError('Videoverbindung konnte nicht aufgebaut werden. TURN-Server, Ports und Firewall prüfen.', 7000);
emitConnectionState(session.callId, 'failed');
}
}, VIDEO_CONNECT_TIMEOUT_MS);
}
await maybeCreateOffer(session);
} catch (error) {
console.error('Video-Medienpfad konnte nicht gestartet werden:', error);