Live video on the AT Protocol
79
fork

Configure Feed

Select the types of activity you want to include in your feed.

at natb/dropdown-stuff-2 19 lines 652 B view raw
1import { selectMySegments } from "features/streamplace/streamplaceSlice"; 2import { useAppSelector } from "store/hooks"; 3import { PlaceStreamSegment } from "streamplace"; 4 5// composite selector that tells us when the current user is live 6export const useLiveUser = (): boolean => { 7 const mySegments = useAppSelector(selectMySegments); 8 if (mySegments.length === 0) { 9 return false; 10 } 11 if (!PlaceStreamSegment.isRecord(mySegments[0].record)) { 12 return false; 13 } 14 const record = mySegments[0].record as PlaceStreamSegment.Record; 15 if (Date.now() - new Date(record.startTime).getTime() < 1000 * 10) { 16 return true; 17 } 18 return false; 19};