import { Match, Show, Switch } from "solid-js"; import { TrackLoop, TrackReference, VideoTrack, isTrackReference, useEnsureParticipant, useIsMuted, useIsSpeaking, useTrackRefContext, useTracks, } from "solid-livekit-components"; import { Track } from "livekit-client"; import { Channel } from "stoat.js"; import { css } from "styled-system/css"; import { styled } from "styled-system/jsx"; import { UserContextMenu } from "@revolt/app"; import { useUser } from "@revolt/markdown/users"; import { Avatar, Button, Column, IconButton, OverflowingText, Row, iconSize, } from "@revolt/ui"; import MdHeadsetOff from "@material-design-icons/svg/outlined/headset_off.svg?component-solid"; import MdMicOn from "@material-design-icons/svg/outlined/mic.svg?component-solid"; import MdMicOff from "@material-design-icons/svg/outlined/mic_off.svg?component-solid"; import { InRoom, useVoice } from "."; export function RoomParticipants() { const tracks = useTracks( [ { source: Track.Source.Camera, withPlaceholder: true }, { source: Track.Source.ScreenShare, withPlaceholder: false }, ], { onlySubscribed: false }, ); return (
{() => }
); } export function FakeParticipants() { return (
); } const Tile = styled("div", { base: { minWidth: "240px", maxWidth: "240px", display: "grid", aspectRatio: "16/9", transition: ".3s ease all", borderRadius: "var(--borderRadius-lg)", background: "#0001", overflow: "hidden", outlineWidth: "3px", outlineStyle: "solid", outlineOffset: "-3px", outlineColor: "transparent", }, variants: { speaking: { yes: { outlineColor: "#23a559", }, }, }, }); export function LeParticipant() { const participant = useEnsureParticipant(); const track = useTrackRefContext(); const isMuted = useIsMuted({ participant, source: Track.Source.Microphone, }); const isSpeaking = useIsSpeaking(participant); const user = useUser(participant.identity); return ( {/*{participant.identity}
muted? {isMuted() ? 'yes' : 'no'}*/} ( ), }} > } >
{participant.identity}
); } export function DemoWrapper(props: { channel: Channel }) { const voice = useVoice()!; const shouldShow = () => { const room = voice.room(); return !room ? !!props.channel.server : voice.channel()?.id === props.channel.id; }; return ( ); } export function Demo(props: { channel: Channel }) { const voice = useVoice()!; /** * Join voice call * copy pasted from channelheader * todo: make this consistnet */ async function joinCall() { voice.connect(props.channel); } return ( /*
state: {voice.state()}



} >
*/ {/* */} Connecting...
voice.toggleMute()} > }>
voice.disconnect()}>Leave Call } > {/* */}
); } const Actions = styled("div", { base: { display: "flex", gap: "2", padding: "2", }, });