/** * API для работы с LiveKit */ import apiClient from '@/lib/api-client'; export interface LiveKitRoomResponse { room_name: string; ws_url: string; access_token: string; server_url: string; ice_servers?: Array<{ urls: string[]; username?: string; credential?: string; }>; video_room_id?: number; is_admin?: boolean; lesson?: { id: number; title: string; start_time: string; end_time: string; }; } export interface LiveKitConfig { server_url: string; ice_servers?: Array<{ urls: string[]; username?: string; credential?: string; }>; } /** * Создать LiveKit комнату для занятия */ export async function createLiveKitRoom(lessonId: number): Promise { const res = await apiClient.post('/video/livekit/create-room/', { lesson_id: lessonId, }); return res.data; } /** * Получить конфигурацию LiveKit */ export async function getLiveKitConfig(): Promise { const res = await apiClient.get('/video/livekit/config/'); return res.data; } /** * Отметить подключение участника к видеокомнате (для метрик) */ export async function participantConnected(roomName: string): Promise { await apiClient.post('/video/livekit/participant-connected/', { room_name: roomName }); }