Skip to content
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/docs/routes/experimental/camera-control-h264.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useState } from 'react';
import { useState, useMemo } from 'react';
import { createFileRoute } from '@tanstack/react-router'
import { PageHeader } from "../../components/page-header"
import { CameraControl } from '../../../ui/experimental/camera-control'
Expand All @@ -7,6 +7,7 @@ import { TypographyH1 } from '../../../ui/elements/typography'
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "../../../ui/layout/card"
import { DemoContainer } from "@/docs/components/demo-container"

import { h264FetchApi } from '@/ui/experimental/h264-fetch';

export const Route = createFileRoute('/experimental/camera-control-h264')({
component: CameraControlWebsocketH264Page,
Expand All @@ -17,9 +18,10 @@ export const Route = createFileRoute('/experimental/camera-control-h264')({
function CameraControlWebsocketH264Demo() {
const [mousePos, setMousePos] = useState<{ x: number, y: number, intensity: number } | null>(null);
const [clickPos, setClickPos] = useState<{ x: number, y: number, intensity: number } | null>(null);
const api = useMemo(() => h264FetchApi("localhost:9999"), []);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How will this work in the docs if you don't have something running at localhost?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it won't. I wonder if there is a way to fake it for the docs.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can implement a mock context that just emits some test images in a loop or something. If we mock out the API, we would still need a mock websocket that emits h264 I guess which sounds hard.

return (
<div>
<WebsocketH264Provider wsUrl="ws://localhost:8080/ws">
<div style={{width: "100%", height: "100%"}}>
<WebsocketH264Provider api={api}>
<CameraControl
className="border"
onMousePositionChange={setMousePos}
Expand Down
Loading