Live video on the AT Protocol
1import {
2 Button,
3 layout,
4 PlayerUI,
5 Text,
6 useAvatars,
7 useLivestreamInfo,
8 useLivestreamStore,
9 zero,
10} from "@streamplace/components";
11import { ChevronLeft } from "@tamagui/lucide-icons";
12import { ChevronRight } from "lucide-react-native";
13import { Image, View } from "react-native";
14const { gap, px, py, colors } = zero;
15
16export function BottomMetadata({
17 setShowChat,
18 showChat,
19}: {
20 setShowChat: (show: boolean) => void;
21 showChat: boolean;
22}) {
23 const { profile } = useLivestreamInfo();
24 const avatars = useAvatars(profile?.did ? [profile?.did] : []);
25 const ls = useLivestreamStore((x) => x.livestream);
26
27 return (
28 <View
29 style={[
30 layout.position.relative,
31 {
32 backgroundColor: "rgba(0, 0, 0, 0.9)",
33 borderTopWidth: 1,
34 borderTopColor: "rgba(255, 255, 255, 0.1)",
35 },
36 px[5],
37 py[3],
38 ]}
39 >
40 <View
41 style={[layout.flex.row, layout.flex.spaceBetween, { height: "100%" }]}
42 >
43 {/* Left side - Profile info */}
44 <View style={[layout.flex.row, layout.flex.center, gap.all[3]]}>
45 {profile?.did && avatars[profile?.did]?.avatar && (
46 <Image
47 key="avatar"
48 source={{
49 uri: avatars[profile?.did]?.avatar,
50 }}
51 style={{ width: 42, height: 42, borderRadius: 999 }}
52 resizeMode="cover"
53 />
54 )}
55 {!(profile?.did && avatars[profile?.did]?.avatar) && (
56 <Image
57 key="avatar"
58 source={require("./../../assets/images/goose.png")}
59 style={{ width: 42, height: 42, borderRadius: 999 }}
60 resizeMode="cover"
61 />
62 )}
63 <View>
64 <Text style={{ color: "white", fontWeight: "600" }}>
65 @{profile?.handle || "user"}
66 </Text>
67 <Text style={{ color: colors.gray[400] }}>
68 {ls?.record.title || "Stream Title"}
69 </Text>
70 </View>
71 </View>
72
73 {/* Right side - Viewer count and collapse chat */}
74 <View style={[layout.flex.row, layout.flex.center, gap.all[4]]}>
75 <View style={[layout.flex.row, layout.flex.center, gap.all[2]]}>
76 <PlayerUI.Viewers />
77 </View>
78 <Button
79 variant="outline"
80 size="sm"
81 onPress={() => {
82 setShowChat(!showChat);
83 }}
84 >
85 {showChat ? (
86 <ChevronRight color="white" size={16} />
87 ) : (
88 <ChevronLeft color="white" size={16} />
89 )}
90 </Button>
91 </View>
92 </View>
93 </View>
94 );
95}