completed Audio frontend

This commit is contained in:
PxlLoewe
2025-03-17 00:41:07 -07:00
parent e722adaf8e
commit 9a7049ec44
28 changed files with 252 additions and 889 deletions

View File

@@ -0,0 +1,6 @@
import clsx, { ClassValue } from "clsx";
import { twMerge } from "tailwind-merge";
export const cn = (...inputs: ClassValue[]) => {
return twMerge(clsx(inputs));
};

View File

@@ -0,0 +1,46 @@
import {
LocalParticipant,
LocalTrackPublication,
Participant,
RemoteParticipant,
RemoteTrack,
RemoteTrackPublication,
Track,
} from "livekit-client";
export const handleTrackSubscribed = (
track: RemoteTrack,
publication: RemoteTrackPublication,
participant: RemoteParticipant,
) => {
if (track.kind === Track.Kind.Video || track.kind === Track.Kind.Audio) {
// attach it to a new HTMLVideoElement or HTMLAudioElement
const element = track.attach();
element.play();
}
};
export const handleTrackUnsubscribed = (
track: RemoteTrack,
publication: RemoteTrackPublication,
participant: RemoteParticipant,
) => {
// remove tracks from all attached elements
track.detach();
};
export const handleLocalTrackUnpublished = (
publication: LocalTrackPublication,
participant: LocalParticipant,
) => {
// when local tracks are ended, update UI to remove them from rendering
publication.track?.detach();
};
export const handleActiveSpeakerChange = (speakers: Participant[]) => {
// show UI indicators when participant is speaking
};
export const handleDisconnect = () => {
console.log("disconnected from room");
};