Add real-time viewer count component and integrate it into stream page; update presence tracking logic with Jazz.

This commit is contained in:
Nikita
2025-12-21 15:12:32 -08:00
parent c16440c876
commit f188310411
7 changed files with 372 additions and 52 deletions
+28
View File
@@ -0,0 +1,28 @@
import { JazzReactProvider } from "jazz-tools/react"
import { ViewerAccount } from "./schema"
// Jazz Cloud API key - using public demo key for now
// TODO: Replace with linsa-specific key from https://jazz.tools
const JAZZ_API_KEY = "jazz_cloud_demo"
interface JazzProviderProps {
children: React.ReactNode
}
/**
* Jazz provider for stream viewer presence tracking
* Uses anonymous auth - viewers don't need to sign in
*/
export function JazzProvider({ children }: JazzProviderProps) {
return (
<JazzReactProvider
sync={{
peer: `wss://cloud.jazz.tools/?key=${JAZZ_API_KEY}`,
when: "always",
}}
AccountSchema={ViewerAccount}
>
{children}
</JazzReactProvider>
)
}