From 924552a025821d5edbb57669ddce20a55655b2fb Mon Sep 17 00:00:00 2001 From: Yahya Alhinai Date: Sun, 28 Jun 2026 03:00:12 +0000 Subject: [PATCH] chore: remove unused screen publish hook --- frontend/src/livekit/useScreenPublish.ts | 41 ------------------------ 1 file changed, 41 deletions(-) delete mode 100644 frontend/src/livekit/useScreenPublish.ts diff --git a/frontend/src/livekit/useScreenPublish.ts b/frontend/src/livekit/useScreenPublish.ts deleted file mode 100644 index e1e49fc..0000000 --- a/frontend/src/livekit/useScreenPublish.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { useCallback, useRef, useState } from 'react'; -import { Room, Track, createLocalScreenTracks, VideoPresets } from 'livekit-client'; -import { fetchToken } from '../lib/api'; - -export function useScreenPublish() { - const roomRef = useRef(null); - const [connected, setConnected] = useState(false); - const [sharing, setSharing] = useState(false); - - const join = useCallback( - async (pod: string, identity: string, name: string, githubLogin?: string) => { - const { token, url } = await fetchToken({ room: pod, identity, name, githubLogin }); - const room = new Room({ adaptiveStream: true, dynacast: true }); - await room.connect(url, token); - roomRef.current = room; - setConnected(true); - return room; - }, - [], - ); - - const startSharing = useCallback(async () => { - const room = roomRef.current; - if (!room) throw new Error('join the pod first'); - const tracks = await createLocalScreenTracks({ - audio: true, - resolution: VideoPresets.h1080.resolution, - }); - for (const t of tracks) { - await room.localParticipant.publishTrack(t.mediaStreamTrack, { - source: - t.kind === Track.Kind.Audio ? Track.Source.ScreenShareAudio : Track.Source.ScreenShare, - }); - } - await room.localParticipant.setMicrophoneEnabled(true); - await room.localParticipant.setCameraEnabled(true); - setSharing(true); - }, []); - - return { join, startSharing, connected, sharing, room: roomRef }; -}