@streamplace/components 0.7.18 → 0.7.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/emoji-data.json +19371 -0
- package/dist/components/chat/chat-box.js +319 -0
- package/dist/components/chat/chat-message.js +87 -0
- package/dist/components/chat/chat.js +150 -0
- package/dist/components/chat/emoji-suggestions.js +35 -0
- package/dist/components/chat/mention-suggestions.js +42 -0
- package/dist/components/chat/mod-view.js +112 -0
- package/dist/components/chat/system-message.js +19 -0
- package/dist/components/dashboard/chat-panel.js +38 -0
- package/dist/components/dashboard/header.js +80 -0
- package/dist/components/dashboard/index.js +14 -0
- package/dist/components/dashboard/information-widget.js +234 -0
- package/dist/components/dashboard/mod-actions.js +71 -0
- package/dist/components/dashboard/problems.js +74 -0
- package/dist/components/icons/bluesky-icon.js +9 -0
- package/dist/components/keep-awake.js +7 -0
- package/dist/components/keep-awake.native.js +16 -0
- package/dist/components/mobile-player/fullscreen.js +76 -0
- package/dist/components/mobile-player/fullscreen.native.js +141 -0
- package/dist/components/mobile-player/player.js +94 -0
- package/dist/components/mobile-player/props.js +2 -0
- package/dist/components/mobile-player/shared.js +54 -0
- package/dist/components/mobile-player/ui/autoplay-button.js +68 -0
- package/dist/components/mobile-player/ui/countdown.js +83 -0
- package/dist/components/mobile-player/ui/index.js +12 -0
- package/dist/components/mobile-player/ui/input.js +42 -0
- package/dist/components/mobile-player/ui/metrics.js +44 -0
- package/dist/components/mobile-player/ui/report-modal.js +90 -0
- package/dist/components/mobile-player/ui/streamer-context-menu.js +7 -0
- package/dist/components/mobile-player/ui/streamer-loading-overlay.js +104 -0
- package/dist/components/mobile-player/ui/viewer-context-menu.js +51 -0
- package/dist/components/mobile-player/ui/viewer-loading-overlay.js +49 -0
- package/dist/components/mobile-player/ui/viewers.js +23 -0
- package/dist/components/mobile-player/use-webrtc.js +243 -0
- package/dist/components/mobile-player/video-async.native.js +276 -0
- package/dist/components/mobile-player/video-retry.js +29 -0
- package/dist/components/mobile-player/video.js +475 -0
- package/dist/components/mobile-player/video.native.js +56 -0
- package/dist/components/mobile-player/webrtc-diagnostics.js +110 -0
- package/dist/components/mobile-player/webrtc-primitives.js +27 -0
- package/dist/components/mobile-player/webrtc-primitives.native.js +8 -0
- package/dist/components/share/sharesheet.js +91 -0
- package/dist/components/ui/button.js +223 -0
- package/dist/components/ui/dialog.js +206 -0
- package/dist/components/ui/dropdown.js +172 -0
- package/dist/components/ui/icons.js +25 -0
- package/dist/components/ui/index.js +34 -0
- package/dist/components/ui/info-box.js +31 -0
- package/dist/components/ui/info-row.js +23 -0
- package/dist/components/ui/input.js +205 -0
- package/dist/components/ui/loader.js +10 -0
- package/dist/components/ui/primitives/button.js +125 -0
- package/dist/components/ui/primitives/input.js +206 -0
- package/dist/components/ui/primitives/modal.js +206 -0
- package/dist/components/ui/primitives/text.js +292 -0
- package/dist/components/ui/resizeable.js +121 -0
- package/dist/components/ui/slider.js +5 -0
- package/dist/components/ui/text.js +177 -0
- package/dist/components/ui/textarea.js +19 -0
- package/dist/components/ui/toast.js +175 -0
- package/dist/components/ui/view.js +252 -0
- package/dist/hooks/index.js +14 -0
- package/dist/hooks/useAvatars.js +35 -0
- package/dist/hooks/useCameraToggle.js +12 -0
- package/dist/hooks/useKeyboard.js +36 -0
- package/dist/hooks/useKeyboardSlide.js +14 -0
- package/dist/hooks/useLivestreamInfo.js +69 -0
- package/dist/hooks/useOuterAndInnerDimensions.js +30 -0
- package/dist/hooks/usePlayerDimensions.js +22 -0
- package/dist/hooks/usePointerDevice.js +71 -0
- package/dist/hooks/useSegmentDimensions.js +17 -0
- package/dist/hooks/useSegmentTiming.js +65 -0
- package/dist/index.js +34 -0
- package/dist/lib/browser.js +35 -0
- package/dist/lib/facet.js +92 -0
- package/dist/lib/system-messages.js +101 -0
- package/dist/lib/theme/atoms.js +646 -0
- package/dist/lib/theme/atoms.types.js +6 -0
- package/dist/lib/theme/index.js +35 -0
- package/dist/lib/theme/theme.js +256 -0
- package/dist/lib/theme/tokens.js +659 -0
- package/dist/lib/utils.js +105 -0
- package/dist/livestream-provider/index.js +30 -0
- package/dist/livestream-provider/websocket.js +45 -0
- package/dist/livestream-store/chat.js +308 -0
- package/dist/livestream-store/context.js +5 -0
- package/dist/livestream-store/index.js +7 -0
- package/dist/livestream-store/livestream-state.js +2 -0
- package/dist/livestream-store/livestream-store.js +58 -0
- package/dist/livestream-store/problems.js +76 -0
- package/dist/livestream-store/stream-key.js +88 -0
- package/dist/livestream-store/websocket-consumer.js +94 -0
- package/dist/player-store/context.js +5 -0
- package/dist/player-store/index.js +9 -0
- package/dist/player-store/player-provider.js +58 -0
- package/dist/player-store/player-state.js +25 -0
- package/dist/player-store/player-store.js +201 -0
- package/dist/player-store/single-player-provider.js +121 -0
- package/dist/streamplace-provider/context.js +5 -0
- package/dist/streamplace-provider/index.js +20 -0
- package/dist/streamplace-provider/poller.js +49 -0
- package/dist/streamplace-provider/xrpc.js +0 -0
- package/dist/streamplace-store/block.js +65 -0
- package/dist/streamplace-store/index.js +6 -0
- package/dist/streamplace-store/stream.js +247 -0
- package/dist/streamplace-store/streamplace-store.js +47 -0
- package/dist/streamplace-store/user.js +52 -0
- package/dist/streamplace-store/xrpc.js +15 -0
- package/dist/ui/index.js +79 -0
- package/node-compile-cache/v22.15.0-x64-efe9a9df-0/37be0eec +0 -0
- package/package.json +5 -4
- package/src/components/chat/chat-box.tsx +3 -0
- package/src/components/chat/mod-view.tsx +39 -5
- package/src/components/mobile-player/fullscreen.tsx +2 -0
- package/src/components/mobile-player/ui/autoplay-button.tsx +86 -0
- package/src/components/mobile-player/ui/index.ts +1 -0
- package/src/components/mobile-player/video.tsx +11 -1
- package/src/livestream-store/chat.tsx +22 -0
- package/src/player-store/player-provider.tsx +2 -1
- package/src/player-store/player-state.tsx +6 -0
- package/src/player-store/player-store.tsx +4 -0
- package/tsconfig.tsbuildinfo +1 -0
|
@@ -16,12 +16,14 @@ export function Fullscreen(props: {
|
|
|
16
16
|
const fullscreen = usePlayerStore((x) => x.fullscreen, playerId);
|
|
17
17
|
const setFullscreen = usePlayerStore((x) => x.setFullscreen, playerId);
|
|
18
18
|
const setSrc = usePlayerStore((x) => x.setSrc);
|
|
19
|
+
const setAutoplayFailed = usePlayerStore((x) => x.setAutoplayFailed);
|
|
19
20
|
|
|
20
21
|
const divRef = useRef<RNView>(null);
|
|
21
22
|
const videoRef = useRef<HTMLVideoElement | null>(null);
|
|
22
23
|
|
|
23
24
|
useEffect(() => {
|
|
24
25
|
setSrc(props.src);
|
|
26
|
+
setAutoplayFailed(false);
|
|
25
27
|
}, [props.src]);
|
|
26
28
|
|
|
27
29
|
useEffect(() => {
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { Play } from "lucide-react-native";
|
|
2
|
+
import { Pressable } from "react-native";
|
|
3
|
+
import { View, layout, usePlayerStore } from "../../..";
|
|
4
|
+
import { h, p, w } from "../../../ui";
|
|
5
|
+
|
|
6
|
+
export function AutoplayButton() {
|
|
7
|
+
const autoplayFailed = usePlayerStore((x) => x.autoplayFailed);
|
|
8
|
+
const setAutoplayFailed = usePlayerStore((x) => x.setAutoplayFailed);
|
|
9
|
+
const setMuted = usePlayerStore((x) => x.setMuted);
|
|
10
|
+
const setMuteWasForced = usePlayerStore((x) => x.setMuteWasForced);
|
|
11
|
+
const setUserInteraction = usePlayerStore((x) => x.setUserInteraction);
|
|
12
|
+
const videoRef = usePlayerStore((x) => x.videoRef);
|
|
13
|
+
|
|
14
|
+
const handlePlayButtonPress = () => {
|
|
15
|
+
if (videoRef && typeof videoRef === "object" && videoRef.current) {
|
|
16
|
+
videoRef.current
|
|
17
|
+
.play()
|
|
18
|
+
.then(() => {
|
|
19
|
+
setAutoplayFailed(false);
|
|
20
|
+
setUserInteraction();
|
|
21
|
+
})
|
|
22
|
+
.catch((err) => {
|
|
23
|
+
console.error("Manual play failed", err);
|
|
24
|
+
if (err.name === "NotAllowedError") {
|
|
25
|
+
setMuted(true);
|
|
26
|
+
videoRef.current!.muted = true;
|
|
27
|
+
videoRef
|
|
28
|
+
.current!.play()
|
|
29
|
+
.then(() => {
|
|
30
|
+
setAutoplayFailed(false);
|
|
31
|
+
setMuteWasForced(true);
|
|
32
|
+
setUserInteraction();
|
|
33
|
+
})
|
|
34
|
+
.catch((err) => {
|
|
35
|
+
console.error("Manual muted play also failed", err);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
if (!autoplayFailed) return null;
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<View
|
|
46
|
+
style={[
|
|
47
|
+
layout.position.absolute,
|
|
48
|
+
layout.flex.center,
|
|
49
|
+
h.percent[100],
|
|
50
|
+
w.percent[100],
|
|
51
|
+
]}
|
|
52
|
+
>
|
|
53
|
+
<Pressable
|
|
54
|
+
onPress={handlePlayButtonPress}
|
|
55
|
+
style={[
|
|
56
|
+
{
|
|
57
|
+
flexDirection: "column",
|
|
58
|
+
alignItems: "center",
|
|
59
|
+
justifyContent: "center",
|
|
60
|
+
gap: 8,
|
|
61
|
+
},
|
|
62
|
+
]}
|
|
63
|
+
>
|
|
64
|
+
<View
|
|
65
|
+
style={[
|
|
66
|
+
p[4],
|
|
67
|
+
{
|
|
68
|
+
backgroundColor: "rgba(200,200,255, 0.1)",
|
|
69
|
+
borderRadius: 999,
|
|
70
|
+
borderWidth: 2,
|
|
71
|
+
borderColor: "rgba(200,200,255, 0.45)",
|
|
72
|
+
boxShadow: "0 0px 4px rgba(0, 0, 0, 1)",
|
|
73
|
+
shadowColor: "rgba(0, 0, 0, 1)",
|
|
74
|
+
},
|
|
75
|
+
]}
|
|
76
|
+
>
|
|
77
|
+
<Play
|
|
78
|
+
size="48"
|
|
79
|
+
color="rgba(120,120,120,0.3)"
|
|
80
|
+
fill="rgba(200,200,255,1)"
|
|
81
|
+
/>
|
|
82
|
+
</View>
|
|
83
|
+
</Pressable>
|
|
84
|
+
</View>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
@@ -154,6 +154,7 @@ const VideoElement = forwardRef<
|
|
|
154
154
|
playerEvent(url, now.toISOString(), evType, {});
|
|
155
155
|
};
|
|
156
156
|
const [firstAttempt, setFirstAttempt] = useState(true);
|
|
157
|
+
const setAutoplayFailed = usePlayerStore((x) => x.setAutoplayFailed);
|
|
157
158
|
|
|
158
159
|
const localVideoRef = props.videoRef ?? useRef<HTMLVideoElement | null>(null);
|
|
159
160
|
|
|
@@ -206,13 +207,22 @@ const VideoElement = forwardRef<
|
|
|
206
207
|
})
|
|
207
208
|
.catch((err) => {
|
|
208
209
|
console.error("Muted play also failed", err);
|
|
210
|
+
setAutoplayFailed(true);
|
|
209
211
|
});
|
|
210
212
|
}
|
|
213
|
+
} else {
|
|
214
|
+
// For other errors (not NotAllowedError), also show play button
|
|
215
|
+
setAutoplayFailed(true);
|
|
211
216
|
}
|
|
212
217
|
});
|
|
213
218
|
}
|
|
214
219
|
};
|
|
215
220
|
|
|
221
|
+
const handlePlaying = (e) => {
|
|
222
|
+
setAutoplayFailed(false);
|
|
223
|
+
event("playing")(e);
|
|
224
|
+
};
|
|
225
|
+
|
|
216
226
|
useEffect(() => {
|
|
217
227
|
return () => {
|
|
218
228
|
setStatus(PlayerStatus.START);
|
|
@@ -275,7 +285,7 @@ const VideoElement = forwardRef<
|
|
|
275
285
|
onLoadStart={event("loadstart")}
|
|
276
286
|
onPause={event("pause")}
|
|
277
287
|
onPlay={event("play")}
|
|
278
|
-
onPlaying={
|
|
288
|
+
onPlaying={handlePlaying}
|
|
279
289
|
onRateChange={event("ratechange")}
|
|
280
290
|
onSeeked={event("seeked")}
|
|
281
291
|
onSeeking={event("seeking")}
|
|
@@ -119,6 +119,28 @@ export const useCreateChatMessage = () => {
|
|
|
119
119
|
};
|
|
120
120
|
};
|
|
121
121
|
|
|
122
|
+
export const useDeleteChatMessage = () => {
|
|
123
|
+
const pdsAgent = usePDSAgent();
|
|
124
|
+
if (!pdsAgent) {
|
|
125
|
+
throw new Error("No PDS agent found");
|
|
126
|
+
}
|
|
127
|
+
const userDID = useDID();
|
|
128
|
+
if (!userDID) {
|
|
129
|
+
throw new Error("No user DID found");
|
|
130
|
+
}
|
|
131
|
+
return async (uri: string) => {
|
|
132
|
+
const rkey = uri.split("/").pop();
|
|
133
|
+
if (!rkey) {
|
|
134
|
+
throw new Error("No rkey found");
|
|
135
|
+
}
|
|
136
|
+
return await pdsAgent.com.atproto.repo.deleteRecord({
|
|
137
|
+
repo: userDID,
|
|
138
|
+
collection: "place.stream.chat.message",
|
|
139
|
+
rkey: rkey,
|
|
140
|
+
});
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
|
|
122
144
|
const buildSortedChatList = (
|
|
123
145
|
chatIndex: { [key: string]: ChatMessageViewHydrated },
|
|
124
146
|
existingChatList: ChatMessageViewHydrated[],
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { randomUUID } from "crypto";
|
|
1
2
|
import React, { useCallback, useMemo, useState } from "react";
|
|
2
3
|
import { StoreApi } from "zustand";
|
|
3
4
|
import { PlayerContext } from "./context";
|
|
@@ -33,7 +34,7 @@ export const PlayerProvider: React.FC<PlayerProviderProps> = ({
|
|
|
33
34
|
);
|
|
34
35
|
|
|
35
36
|
const createPlayer = useCallback((id?: string) => {
|
|
36
|
-
const playerId = id ||
|
|
37
|
+
const playerId = id || randomUUID();
|
|
37
38
|
const playerStore = makePlayerStore(playerId);
|
|
38
39
|
|
|
39
40
|
setPlayers((prev) => ({
|
|
@@ -142,6 +142,12 @@ export interface PlayerState {
|
|
|
142
142
|
/** Function to set the muteWasForced flag */
|
|
143
143
|
setMuteWasForced: (muteWasForced: boolean) => void;
|
|
144
144
|
|
|
145
|
+
/** Flag indicating if autoplay failed and needs user interaction */
|
|
146
|
+
autoplayFailed: boolean;
|
|
147
|
+
|
|
148
|
+
/** Function to set the autoplayFailed flag */
|
|
149
|
+
setAutoplayFailed: (autoplayFailed: boolean) => void;
|
|
150
|
+
|
|
145
151
|
/** Flag indicating if the player is embedded in another context */
|
|
146
152
|
embedded: boolean;
|
|
147
153
|
|
|
@@ -99,6 +99,10 @@ export const makePlayerStore = (id?: string): StoreApi<PlayerState> => {
|
|
|
99
99
|
setMuteWasForced: (muteWasForced: boolean) =>
|
|
100
100
|
set(() => ({ muteWasForced })),
|
|
101
101
|
|
|
102
|
+
autoplayFailed: false,
|
|
103
|
+
setAutoplayFailed: (autoplayFailed: boolean) =>
|
|
104
|
+
set(() => ({ autoplayFailed })),
|
|
105
|
+
|
|
102
106
|
embedded: false,
|
|
103
107
|
setEmbedded: (embedded: boolean) => set(() => ({ embedded })),
|
|
104
108
|
|