@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.
Files changed (122) hide show
  1. package/dist/assets/emoji-data.json +19371 -0
  2. package/dist/components/chat/chat-box.js +319 -0
  3. package/dist/components/chat/chat-message.js +87 -0
  4. package/dist/components/chat/chat.js +150 -0
  5. package/dist/components/chat/emoji-suggestions.js +35 -0
  6. package/dist/components/chat/mention-suggestions.js +42 -0
  7. package/dist/components/chat/mod-view.js +112 -0
  8. package/dist/components/chat/system-message.js +19 -0
  9. package/dist/components/dashboard/chat-panel.js +38 -0
  10. package/dist/components/dashboard/header.js +80 -0
  11. package/dist/components/dashboard/index.js +14 -0
  12. package/dist/components/dashboard/information-widget.js +234 -0
  13. package/dist/components/dashboard/mod-actions.js +71 -0
  14. package/dist/components/dashboard/problems.js +74 -0
  15. package/dist/components/icons/bluesky-icon.js +9 -0
  16. package/dist/components/keep-awake.js +7 -0
  17. package/dist/components/keep-awake.native.js +16 -0
  18. package/dist/components/mobile-player/fullscreen.js +76 -0
  19. package/dist/components/mobile-player/fullscreen.native.js +141 -0
  20. package/dist/components/mobile-player/player.js +94 -0
  21. package/dist/components/mobile-player/props.js +2 -0
  22. package/dist/components/mobile-player/shared.js +54 -0
  23. package/dist/components/mobile-player/ui/autoplay-button.js +68 -0
  24. package/dist/components/mobile-player/ui/countdown.js +83 -0
  25. package/dist/components/mobile-player/ui/index.js +12 -0
  26. package/dist/components/mobile-player/ui/input.js +42 -0
  27. package/dist/components/mobile-player/ui/metrics.js +44 -0
  28. package/dist/components/mobile-player/ui/report-modal.js +90 -0
  29. package/dist/components/mobile-player/ui/streamer-context-menu.js +7 -0
  30. package/dist/components/mobile-player/ui/streamer-loading-overlay.js +104 -0
  31. package/dist/components/mobile-player/ui/viewer-context-menu.js +51 -0
  32. package/dist/components/mobile-player/ui/viewer-loading-overlay.js +49 -0
  33. package/dist/components/mobile-player/ui/viewers.js +23 -0
  34. package/dist/components/mobile-player/use-webrtc.js +243 -0
  35. package/dist/components/mobile-player/video-async.native.js +276 -0
  36. package/dist/components/mobile-player/video-retry.js +29 -0
  37. package/dist/components/mobile-player/video.js +475 -0
  38. package/dist/components/mobile-player/video.native.js +56 -0
  39. package/dist/components/mobile-player/webrtc-diagnostics.js +110 -0
  40. package/dist/components/mobile-player/webrtc-primitives.js +27 -0
  41. package/dist/components/mobile-player/webrtc-primitives.native.js +8 -0
  42. package/dist/components/share/sharesheet.js +91 -0
  43. package/dist/components/ui/button.js +223 -0
  44. package/dist/components/ui/dialog.js +206 -0
  45. package/dist/components/ui/dropdown.js +172 -0
  46. package/dist/components/ui/icons.js +25 -0
  47. package/dist/components/ui/index.js +34 -0
  48. package/dist/components/ui/info-box.js +31 -0
  49. package/dist/components/ui/info-row.js +23 -0
  50. package/dist/components/ui/input.js +205 -0
  51. package/dist/components/ui/loader.js +10 -0
  52. package/dist/components/ui/primitives/button.js +125 -0
  53. package/dist/components/ui/primitives/input.js +206 -0
  54. package/dist/components/ui/primitives/modal.js +206 -0
  55. package/dist/components/ui/primitives/text.js +292 -0
  56. package/dist/components/ui/resizeable.js +121 -0
  57. package/dist/components/ui/slider.js +5 -0
  58. package/dist/components/ui/text.js +177 -0
  59. package/dist/components/ui/textarea.js +19 -0
  60. package/dist/components/ui/toast.js +175 -0
  61. package/dist/components/ui/view.js +252 -0
  62. package/dist/hooks/index.js +14 -0
  63. package/dist/hooks/useAvatars.js +35 -0
  64. package/dist/hooks/useCameraToggle.js +12 -0
  65. package/dist/hooks/useKeyboard.js +36 -0
  66. package/dist/hooks/useKeyboardSlide.js +14 -0
  67. package/dist/hooks/useLivestreamInfo.js +69 -0
  68. package/dist/hooks/useOuterAndInnerDimensions.js +30 -0
  69. package/dist/hooks/usePlayerDimensions.js +22 -0
  70. package/dist/hooks/usePointerDevice.js +71 -0
  71. package/dist/hooks/useSegmentDimensions.js +17 -0
  72. package/dist/hooks/useSegmentTiming.js +65 -0
  73. package/dist/index.js +34 -0
  74. package/dist/lib/browser.js +35 -0
  75. package/dist/lib/facet.js +92 -0
  76. package/dist/lib/system-messages.js +101 -0
  77. package/dist/lib/theme/atoms.js +646 -0
  78. package/dist/lib/theme/atoms.types.js +6 -0
  79. package/dist/lib/theme/index.js +35 -0
  80. package/dist/lib/theme/theme.js +256 -0
  81. package/dist/lib/theme/tokens.js +659 -0
  82. package/dist/lib/utils.js +105 -0
  83. package/dist/livestream-provider/index.js +30 -0
  84. package/dist/livestream-provider/websocket.js +45 -0
  85. package/dist/livestream-store/chat.js +308 -0
  86. package/dist/livestream-store/context.js +5 -0
  87. package/dist/livestream-store/index.js +7 -0
  88. package/dist/livestream-store/livestream-state.js +2 -0
  89. package/dist/livestream-store/livestream-store.js +58 -0
  90. package/dist/livestream-store/problems.js +76 -0
  91. package/dist/livestream-store/stream-key.js +88 -0
  92. package/dist/livestream-store/websocket-consumer.js +94 -0
  93. package/dist/player-store/context.js +5 -0
  94. package/dist/player-store/index.js +9 -0
  95. package/dist/player-store/player-provider.js +58 -0
  96. package/dist/player-store/player-state.js +25 -0
  97. package/dist/player-store/player-store.js +201 -0
  98. package/dist/player-store/single-player-provider.js +121 -0
  99. package/dist/streamplace-provider/context.js +5 -0
  100. package/dist/streamplace-provider/index.js +20 -0
  101. package/dist/streamplace-provider/poller.js +49 -0
  102. package/dist/streamplace-provider/xrpc.js +0 -0
  103. package/dist/streamplace-store/block.js +65 -0
  104. package/dist/streamplace-store/index.js +6 -0
  105. package/dist/streamplace-store/stream.js +247 -0
  106. package/dist/streamplace-store/streamplace-store.js +47 -0
  107. package/dist/streamplace-store/user.js +52 -0
  108. package/dist/streamplace-store/xrpc.js +15 -0
  109. package/dist/ui/index.js +79 -0
  110. package/node-compile-cache/v22.15.0-x64-efe9a9df-0/37be0eec +0 -0
  111. package/package.json +5 -4
  112. package/src/components/chat/chat-box.tsx +3 -0
  113. package/src/components/chat/mod-view.tsx +39 -5
  114. package/src/components/mobile-player/fullscreen.tsx +2 -0
  115. package/src/components/mobile-player/ui/autoplay-button.tsx +86 -0
  116. package/src/components/mobile-player/ui/index.ts +1 -0
  117. package/src/components/mobile-player/video.tsx +11 -1
  118. package/src/livestream-store/chat.tsx +22 -0
  119. package/src/player-store/player-provider.tsx +2 -1
  120. package/src/player-store/player-state.tsx +6 -0
  121. package/src/player-store/player-store.tsx +4 -0
  122. 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
+ }
@@ -1,3 +1,4 @@
1
+ export * from "./autoplay-button";
1
2
  export * from "./countdown";
2
3
  export * from "./input";
3
4
  export * from "./metrics";
@@ -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={event("playing")}
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 || Math.random().toString(36).slice(8);
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