@streamplace/components 0.9.7 → 0.9.9
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/components/chat/chat.js +2 -2
- package/dist/components/chat/chat.js.map +1 -1
- package/dist/components/dashboard/header.d.ts +1 -2
- package/dist/components/dashboard/header.d.ts.map +1 -1
- package/dist/components/dashboard/header.js +2 -2
- package/dist/components/dashboard/header.js.map +1 -1
- package/dist/components/dashboard/information-widget.d.ts.map +1 -1
- package/dist/components/dashboard/information-widget.js +2 -1
- package/dist/components/dashboard/information-widget.js.map +1 -1
- package/dist/components/mobile-player/player.d.ts.map +1 -1
- package/dist/components/mobile-player/player.js +15 -0
- package/dist/components/mobile-player/player.js.map +1 -1
- package/dist/components/mobile-player/ui/input.d.ts +3 -1
- package/dist/components/mobile-player/ui/input.d.ts.map +1 -1
- package/dist/components/mobile-player/ui/input.js +18 -2
- package/dist/components/mobile-player/ui/input.js.map +1 -1
- package/dist/components/mobile-player/ui/streamer-context-menu.d.ts +3 -1
- package/dist/components/mobile-player/ui/streamer-context-menu.d.ts.map +1 -1
- package/dist/components/mobile-player/ui/streamer-context-menu.js +64 -2
- package/dist/components/mobile-player/ui/streamer-context-menu.js.map +1 -1
- package/dist/components/ui/textarea.d.ts.map +1 -1
- package/dist/components/ui/textarea.js +1 -1
- package/dist/components/ui/textarea.js.map +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/useAQState.d.ts +2 -0
- package/dist/hooks/useAQState.d.ts.map +1 -0
- package/dist/hooks/useAQState.js +37 -0
- package/dist/hooks/useAQState.js.map +1 -0
- package/dist/hooks/useLivestreamInfo.d.ts +1 -0
- package/dist/hooks/useLivestreamInfo.d.ts.map +1 -1
- package/dist/hooks/useLivestreamInfo.js +7 -0
- package/dist/hooks/useLivestreamInfo.js.map +1 -1
- package/dist/lib/theme/atoms.d.ts +125 -125
- package/dist/player-store/player-state.d.ts +2 -0
- package/dist/player-store/player-state.d.ts.map +1 -1
- package/dist/player-store/player-store.d.ts.map +1 -1
- package/dist/player-store/player-store.js +12 -0
- package/dist/player-store/player-store.js.map +1 -1
- package/dist/streamplace-store/branding.d.ts.map +1 -1
- package/dist/streamplace-store/branding.js +52 -1
- package/dist/streamplace-store/branding.js.map +1 -1
- package/locales/en-US/common.ftl +13 -1
- package/node-compile-cache/v22.15.0-x64-92db9086-0/37be0eec +0 -0
- package/package.json +2 -2
- package/src/components/chat/chat.tsx +2 -2
- package/src/components/dashboard/header.tsx +1 -14
- package/src/components/dashboard/information-widget.tsx +2 -1
- package/src/components/mobile-player/player.tsx +22 -1
- package/src/components/mobile-player/ui/input.tsx +42 -8
- package/src/components/mobile-player/ui/streamer-context-menu.tsx +138 -2
- package/src/components/ui/textarea.tsx +2 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useAQState.ts +37 -0
- package/src/hooks/useLivestreamInfo.ts +8 -0
- package/src/player-store/player-state.tsx +3 -0
- package/src/player-store/player-store.tsx +17 -0
- package/src/streamplace-store/branding.tsx +60 -1
|
@@ -9,6 +9,7 @@ export function useLivestreamInfo(url?: string) {
|
|
|
9
9
|
const ingestStarting = usePlayerStore((x) => x.ingestStarting);
|
|
10
10
|
const setIngestStarting = usePlayerStore((x) => x.setIngestStarting);
|
|
11
11
|
const setIngestLive = usePlayerStore((x) => x.setIngestLive);
|
|
12
|
+
const stopIngest = usePlayerStore((x) => x.stopIngest);
|
|
12
13
|
|
|
13
14
|
const createStreamRecord = useCreateStreamRecord();
|
|
14
15
|
|
|
@@ -54,6 +55,12 @@ export function useLivestreamInfo(url?: string) {
|
|
|
54
55
|
}
|
|
55
56
|
};
|
|
56
57
|
|
|
58
|
+
// Stop the current broadcast
|
|
59
|
+
const toggleStopStream = () => {
|
|
60
|
+
console.log("Stopping stream...");
|
|
61
|
+
stopIngest();
|
|
62
|
+
};
|
|
63
|
+
|
|
57
64
|
return {
|
|
58
65
|
ingest,
|
|
59
66
|
profile,
|
|
@@ -67,5 +74,6 @@ export function useLivestreamInfo(url?: string) {
|
|
|
67
74
|
setIngestStarting,
|
|
68
75
|
handleSubmit,
|
|
69
76
|
toggleGoLive,
|
|
77
|
+
toggleStopStream,
|
|
70
78
|
};
|
|
71
79
|
}
|
|
@@ -63,6 +63,9 @@ export interface PlayerState {
|
|
|
63
63
|
ingestAutoStart?: boolean;
|
|
64
64
|
setIngestAutoStart?: (autoStart: boolean) => void;
|
|
65
65
|
|
|
66
|
+
/** stop ingest process, again with a slight delay to allow UI to update */
|
|
67
|
+
stopIngest: () => void;
|
|
68
|
+
|
|
66
69
|
/** Timestamp (number) when ingest started, or null if not started */
|
|
67
70
|
ingestStarted: number | null;
|
|
68
71
|
|
|
@@ -53,6 +53,23 @@ export const makePlayerStore = (id?: string): StoreApi<PlayerState> => {
|
|
|
53
53
|
setIngestStarted: (timestamp: number | null) =>
|
|
54
54
|
set(() => ({ ingestStarted: timestamp })),
|
|
55
55
|
|
|
56
|
+
stopIngest: () => {
|
|
57
|
+
set(() => ({
|
|
58
|
+
ingestLive: false,
|
|
59
|
+
ingestConnectionState: "new",
|
|
60
|
+
ingestStarted: null,
|
|
61
|
+
})),
|
|
62
|
+
setTimeout(
|
|
63
|
+
() =>
|
|
64
|
+
set(() => ({
|
|
65
|
+
ingestLive: false,
|
|
66
|
+
ingestConnectionState: "new",
|
|
67
|
+
ingestStarted: null,
|
|
68
|
+
})),
|
|
69
|
+
200,
|
|
70
|
+
);
|
|
71
|
+
},
|
|
72
|
+
|
|
56
73
|
fullscreen: false,
|
|
57
74
|
setFullscreen: (isFullscreen: boolean) =>
|
|
58
75
|
set(() => ({ fullscreen: isFullscreen })),
|
|
@@ -25,11 +25,66 @@ const blobToBase64 = (blob: Blob): Promise<string> => {
|
|
|
25
25
|
});
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
+
const PropsInHeader = [
|
|
29
|
+
"siteTitle",
|
|
30
|
+
"siteDescription",
|
|
31
|
+
"primaryColor",
|
|
32
|
+
"accentColor",
|
|
33
|
+
"defaultStreamer",
|
|
34
|
+
"mainLogo",
|
|
35
|
+
"favicon",
|
|
36
|
+
"sidebarBg",
|
|
37
|
+
"legalLinks",
|
|
38
|
+
];
|
|
39
|
+
|
|
40
|
+
function getMetaContent(key: string): BrandingAsset | null {
|
|
41
|
+
if (typeof window === "undefined" || !window.document) return null;
|
|
42
|
+
const meta = document.querySelector(`meta[name="internal-brand:${key}`);
|
|
43
|
+
if (meta && meta.getAttribute("content")) {
|
|
44
|
+
let content = meta.getAttribute("content");
|
|
45
|
+
if (content) return JSON.parse(content) as BrandingAsset;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
|
|
28
51
|
// hook to fetch broadcaster DID (unauthenticated)
|
|
29
52
|
export function useFetchBroadcasterDID() {
|
|
30
53
|
const streamplaceAgent = usePossiblyUnauthedPDSAgent();
|
|
31
54
|
const store = getStreamplaceStoreFromContext();
|
|
32
55
|
|
|
56
|
+
// prefetch from meta records, if on web
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
if (typeof window !== "undefined" && window.document) {
|
|
59
|
+
try {
|
|
60
|
+
const metaRecords = PropsInHeader.reduce(
|
|
61
|
+
(acc, key) => {
|
|
62
|
+
const meta = document.querySelector(
|
|
63
|
+
`meta[name="internal-brand:${key}`,
|
|
64
|
+
);
|
|
65
|
+
// hrmmmmmmmmmmmm
|
|
66
|
+
if (meta && meta.getAttribute("content")) {
|
|
67
|
+
let content = meta.getAttribute("content");
|
|
68
|
+
if (content) acc[key] = JSON.parse(content) as BrandingAsset;
|
|
69
|
+
}
|
|
70
|
+
return acc;
|
|
71
|
+
},
|
|
72
|
+
{} as Record<string, BrandingAsset>,
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
console.log("Found meta records for broadcaster DID:", metaRecords);
|
|
76
|
+
// filter out all non-text values, can get on second fetch?
|
|
77
|
+
for (const key of Object.keys(metaRecords)) {
|
|
78
|
+
if (metaRecords[key].mimeType != "text/plain") {
|
|
79
|
+
delete metaRecords[key];
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
} catch (e) {
|
|
83
|
+
console.warn("Failed to parse broadcaster DID from meta tags", e);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}, []);
|
|
87
|
+
|
|
33
88
|
return useCallback(async () => {
|
|
34
89
|
try {
|
|
35
90
|
if (!streamplaceAgent) {
|
|
@@ -140,7 +195,11 @@ export function useFetchBranding() {
|
|
|
140
195
|
|
|
141
196
|
// hook to get a specific branding asset by key
|
|
142
197
|
export function useBrandingAsset(key: string): BrandingAsset | undefined {
|
|
143
|
-
return
|
|
198
|
+
return (
|
|
199
|
+
useStreamplaceStore((state) => state.branding?.[key]) ||
|
|
200
|
+
getMetaContent(key) ||
|
|
201
|
+
undefined
|
|
202
|
+
);
|
|
144
203
|
}
|
|
145
204
|
|
|
146
205
|
// convenience hook for main logo
|