Live video on the AT Protocol
1import { selectUserProfile } from "features/bluesky/blueskySlice";
2import { selectRecentSegments } from "features/streamplace/streamplaceSlice";
3import { useAppSelector } from "store/hooks";
4
5// composite selector that tells us when the current user is live
6export const useLiveUser = (): boolean => {
7 const profile = useAppSelector(selectUserProfile);
8 const { segments } = useAppSelector(selectRecentSegments);
9 if (!profile) {
10 return false;
11 }
12 const isLive = segments.some(
13 (segment) => segment.repo && segment.repo.did === profile.did,
14 );
15 return isLive;
16};